From f270f72badd9c61d48f290c3396004802841b9df Mon Sep 17 00:00:00 2001 From: kinitrupti Date: Fri, 12 May 2017 18:53:46 +0530 Subject: Removed duplicates --- .../AdityaAnand_version_backup/Chapter_8.ipynb | 14 +- .../AdityaAnand_version_backup/Chapter_8_-.ipynb | 390 ----- .../AdityaR/AdityaR_version_backup/Chapter.ipynb | 279 +++ .../AdityaR_version_backup/Chapter_5-Sample.ipynb | 279 --- .../Chapter_6_Objects.ipynb | 934 ++++++++++ .../Chapter_6_Objects_and.ipynb | 934 ---------- sample_notebooks/AnaySonawane/Solid_State.ipynb | 971 +++++++++++ .../AnaySonawane/Solid_State_electronics.ipynb | 971 ----------- sample_notebooks/BhavithaInnamuri/Chapter_1.ipynb | 677 ++++++++ .../BhavithaInnamuri/Chapter_1_CRYSTAL.ipynb | 677 -------- .../Chapter_1_Introduction_to_Radio.ipynb | 102 ++ ...ter_1_Introduction_to_Radio_Communication.ipynb | 102 -- .../DurgasriInnamuri/Chapter_3_Semoconductor.ipynb | 223 +++ .../Chapter_3_Semoconductor_Devices.ipynb | 223 --- ...r_3_Ionization_and_Deionization_Processes.ipynb | 656 ++++++++ ..._Ionization_and_Deionization_Processes_in.ipynb | 656 -------- sample_notebooks/Hrituraj/Various_types.ipynb | 318 ++++ sample_notebooks/Hrituraj/Various_types_of.ipynb | 318 ---- sample_notebooks/InnamuriBhavitha/Chapter_1.ipynb | 234 +++ .../InnamuriBhavitha/Chapter_1_CRYSTAL.ipynb | 234 --- sample_notebooks/JayDadlani/SAMPLE_NB.ipynb | 220 +++ sample_notebooks/JayDadlani/SAMPLE_NB_KI.ipynb | 220 --- .../KavinkumarD/Chapter_11__Impulse_and.ipynb | 345 ++++ .../Chapter_11__Impulse_and_Reaction.ipynb | 345 ---- .../Chapter_8_FREQUENCY_EFFECTS.ipynb | 120 ++ .../Chapter_8_FREQUENCY_EFFECTS_IN.ipynb | 120 -- sample_notebooks/KonasaniSai Dheeraj/sample.ipynb | 256 +++ .../KonasaniSai Dheeraj/sample_(chapter.ipynb | 256 --- .../Pinciples_of_electronic.ipynb | 406 +++++ .../Pinciples_of_electronic_Instrumentation.ipynb | 406 ----- .../ManchukondaGopi Krishna/Chapter_7.ipynb | 299 ++++ .../ManchukondaGopi Krishna/Chapter_7_Wave.ipynb | 299 ---- ...igurations_and_Functional_Descriptions_of.ipynb | 109 ++ ..._and_Functional_Descriptions_of_Measuring.ipynb | 109 -- .../MandalaManoj pruthvi/Chapter_4.ipynb | 658 ++++++++ .../MandalaManoj pruthvi/Chapter_4_Radian.ipynb | 658 -------- .../Chapter_2_Light_propagation_in.ipynb | 430 +++++ .../Chapter_2_Light_propagation_in_optical.ipynb | 430 ----- .../ManikandanD/Chapter_2_Motion_in_a.ipynb | 825 +++++++++ .../Chapter_2_Motion_in_a_straight.ipynb | 825 --------- sample_notebooks/MeenaChandrupatla/Chapter_1.ipynb | 289 ++++ .../MeenaChandrupatla/Chapter_1_Magnetic.ipynb | 289 ---- sample_notebooks/MeenaChandrupatla/Chapter_2.ipynb | 249 +++ .../MeenaChandrupatla/Chapter_2_The.ipynb | 249 --- sample_notebooks/MohdAsif/Chapter2,.ipynb | 257 +++ .../MohdAsif/Chapter2,_Measurement.ipynb | 257 --- sample_notebooks/MohdAsif/Chapter2_-.ipynb | 1549 +++++++++++++++++ .../MohdAsif/Chapter2_-_Measurement.ipynb | 1549 ----------------- ...PAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI.ipynb | 462 +++++ ...GATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_1.ipynb | 462 +++++ ...ATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_10.ipynb | 462 +++++ ...ATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_11.ipynb | 462 +++++ ...ATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_12.ipynb | 462 +++++ ...GATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_2.ipynb | 462 +++++ ...GATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_3.ipynb | 462 +++++ ...GATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_4.ipynb | 462 +++++ ...GATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_5.ipynb | 462 +++++ ...GATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_6.ipynb | 462 +++++ ...GATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_7.ipynb | 462 +++++ ...GATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_8.ipynb | 462 +++++ ...GATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_9.ipynb | 462 +++++ ...ATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI.ipynb | 462 ----- ...ION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_1.ipynb | 462 ----- ...ON_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_10.ipynb | 462 ----- ...ON_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_11.ipynb | 462 ----- ...ON_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_12.ipynb | 462 ----- ...ION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_2.ipynb | 462 ----- ...ION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_3.ipynb | 462 ----- ...ION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_4.ipynb | 462 ----- ...ION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_5.ipynb | 462 ----- ...ION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_6.ipynb | 462 ----- ...ION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_7.ipynb | 462 ----- ...ION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_8.ipynb | 462 ----- ...ION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_9.ipynb | 462 ----- .../Chapter_4.ipynb | 544 ++++++ .../Chapter_4_BJT.ipynb | 544 ------ .../NitamoniDas_version_backup/Chapter_8.ipynb | 809 +++++++++ ...traction_through_Classes_and_User-Defined.ipynb | 809 +++++++++ ...traction_through_Classes_and_User_Defined.ipynb | 809 +++++++++ .../Chapter_8_Data.ipynb | 809 --------- ...ion_through_Classes_and_User-Defined_Data.ipynb | 809 --------- ...ion_through_Classes_and_User_Defined_Data.ipynb | 809 --------- ...traction_through_Classes_and_User-Defined.ipynb | 809 +++++++++ .../chapter_8_Data_Abstraction.ipynb | 809 +++++++++ .../chapter_8_Data_Abstraction_through.ipynb | 809 --------- ...ion_through_Classes_and_User-Defined_Data.ipynb | 809 --------- ...rough_Classes_and_User-Defined_Data_Types.ipynb | 809 --------- sample_notebooks/PrashantSahu/Chapter_2.ipynb | 657 ++++++++ .../PrashantSahu/Chapter_2_Molecular.ipynb | 657 -------- ..._Transfer_and_Separation_Process_by_Binay.ipynb | 753 +++++++++ ...ransfer_and_Separation_Process_by_Binay_K.ipynb | 753 --------- .../RahulJoshi/Chapter_1_An_Overview_of.ipynb | 1396 +++++++++++++++ .../RahulJoshi/Chapter_1_An_Overview_of_Heat.ipynb | 1396 --------------- .../Reshma Ustad/Chapter_2_Properties.ipynb | 146 ++ .../Reshma Ustad/Chapter_2_Properties_Of.ipynb | 146 -- .../SalilKapur/IntroductionConcept.ipynb | 282 ++++ .../SalilKapur/IntroductionConcept_of.ipynb | 282 ---- .../Chapter_11-_Object_Initialization.ipynb | 1779 ++++++++++++++++++++ .../Chapter_11-_Object_Initialization_and.ipynb | 1779 -------------------- .../Chapter_4_Op_Amps_as.ipynb | 363 ++++ .../Chapter_4_Op_Amps_as_AC.ipynb | 363 ---- sample_notebooks/SumadhuriDamerla/Chapter_1.ipynb | 370 ++++ .../SumadhuriDamerla/Chapter_1_Passive.ipynb | 370 ---- sample_notebooks/SumedhKadam/Chapter_1.ipynb | 117 ++ .../SumedhKadam/Chapter_1_General.ipynb | 117 -- .../Chapter_6_IMPEDENCE_MATCHING.ipynb | 277 +++ .../Chapter_6_IMPEDENCE_MATCHING_AND.ipynb | 277 --- .../Vedantam Lakshmi Manasa/Chapter_2.ipynb | 296 ++++ .../Chapter_2_Electric.ipynb | 296 ---- .../1_An_overview.ipynb | 254 +++ .../1_An_overview_of.ipynb | 254 --- .../harikagunturu_version_backup/Chapter_4.ipynb | 666 ++++++++ .../Chapter_4_Angle.ipynb | 666 -------- .../karansingh/Thyristors_Principles.ipynb | 209 +++ .../karansingh/Thyristors_Principles_&.ipynb | 209 --- .../samplebook(process.ipynb | 278 +++ .../samplebook(process_heat.ipynb | 278 --- .../Chapter_1_Stress,Axial_load_and.ipynb | 395 +++++ .../Chapter_1_Stress,Axial_load_and_Safety.ipynb | 395 ----- .../kushrami/Chapter_1_-_Overview_of_optical.ipynb | 251 +++ .../Chapter_1_-_Overview_of_optical_fiber.ipynb | 251 --- .../Chapter_2_Nuclear_Sturcture.ipynb | 234 +++ .../Chapter_2_Nuclear_Sturcture_and.ipynb | 234 --- .../Chapter_5_Imperfection.ipynb | 227 +++ .../Chapter_5_Imperfection_in.ipynb | 227 --- .../manchukondasrinivasa rao/Chapter_7.ipynb | 299 ++++ .../manchukondasrinivasa rao/Chapter_7_Wave.ipynb | 299 ---- .../marupeddisameer chaitanya/Sample.ipynb | 247 +++ .../Sample_(chapter.ipynb | 247 --- .../Chapter_4_Diffusion_and_Reaction_in.ipynb | 303 ++++ ...hapter_4_Diffusion_and_Reaction_in_Porous.ipynb | 303 ---- sample_notebooks/pramodkumardesu/Chapter_2.ipynb | 263 +++ .../pramodkumardesu/Chapter_2_Transmission.ipynb | 263 --- .../ravindra m gowda/Chapter_1_Basics_of.ipynb | 461 +++++ .../Chapter_1_Basics_of_thermodynamics.ipynb | 461 ----- .../Chapter_5_Force_Torque_and_Shaft.ipynb | 265 +++ .../Chapter_5_Force_Torque_and_Shaft_power.ipynb | 265 --- sample_notebooks/vijayadurga/sample.ipynb | 410 +++++ sample_notebooks/vijayadurga/sample_(chapter.ipynb | 410 ----- 139 files changed, 32206 insertions(+), 33405 deletions(-) delete mode 100755 sample_notebooks/AdityaAnand/AdityaAnand_version_backup/Chapter_8_-.ipynb create mode 100755 sample_notebooks/AdityaR/AdityaR_version_backup/Chapter.ipynb delete mode 100755 sample_notebooks/AdityaR/AdityaR_version_backup/Chapter_5-Sample.ipynb create mode 100755 sample_notebooks/Aman KumarJain/Aman KumarJain_version_backup/Chapter_6_Objects.ipynb delete mode 100755 sample_notebooks/Aman KumarJain/Aman KumarJain_version_backup/Chapter_6_Objects_and.ipynb create mode 100755 sample_notebooks/AnaySonawane/Solid_State.ipynb delete mode 100755 sample_notebooks/AnaySonawane/Solid_State_electronics.ipynb create mode 100755 sample_notebooks/BhavithaInnamuri/Chapter_1.ipynb delete mode 100755 sample_notebooks/BhavithaInnamuri/Chapter_1_CRYSTAL.ipynb create mode 100755 sample_notebooks/DesuSandeep Kumar/Chapter_1_Introduction_to_Radio.ipynb delete mode 100755 sample_notebooks/DesuSandeep Kumar/Chapter_1_Introduction_to_Radio_Communication.ipynb create mode 100755 sample_notebooks/DurgasriInnamuri/Chapter_3_Semoconductor.ipynb delete mode 100755 sample_notebooks/DurgasriInnamuri/Chapter_3_Semoconductor_Devices.ipynb create mode 100755 sample_notebooks/GundaChaitnaya rani/GundaChaitnaya rani_version_backup/Chapter_3_Ionization_and_Deionization_Processes.ipynb delete mode 100755 sample_notebooks/GundaChaitnaya rani/GundaChaitnaya rani_version_backup/Chapter_3_Ionization_and_Deionization_Processes_in.ipynb create mode 100755 sample_notebooks/Hrituraj/Various_types.ipynb delete mode 100755 sample_notebooks/Hrituraj/Various_types_of.ipynb create mode 100755 sample_notebooks/InnamuriBhavitha/Chapter_1.ipynb delete mode 100755 sample_notebooks/InnamuriBhavitha/Chapter_1_CRYSTAL.ipynb create mode 100755 sample_notebooks/JayDadlani/SAMPLE_NB.ipynb delete mode 100755 sample_notebooks/JayDadlani/SAMPLE_NB_KI.ipynb create mode 100755 sample_notebooks/KavinkumarD/Chapter_11__Impulse_and.ipynb delete mode 100755 sample_notebooks/KavinkumarD/Chapter_11__Impulse_and_Reaction.ipynb create mode 100755 sample_notebooks/KavinkumarD/KavinkumarD_version_backup/Chapter_8_FREQUENCY_EFFECTS.ipynb delete mode 100755 sample_notebooks/KavinkumarD/KavinkumarD_version_backup/Chapter_8_FREQUENCY_EFFECTS_IN.ipynb create mode 100755 sample_notebooks/KonasaniSai Dheeraj/sample.ipynb delete mode 100755 sample_notebooks/KonasaniSai Dheeraj/sample_(chapter.ipynb create mode 100755 sample_notebooks/LaxmanSole/LaxmanSole_version_backup/Pinciples_of_electronic.ipynb delete mode 100755 sample_notebooks/LaxmanSole/LaxmanSole_version_backup/Pinciples_of_electronic_Instrumentation.ipynb create mode 100755 sample_notebooks/ManchukondaGopi Krishna/Chapter_7.ipynb delete mode 100755 sample_notebooks/ManchukondaGopi Krishna/Chapter_7_Wave.ipynb create mode 100755 sample_notebooks/ManchukondaMaruthi Naga Vijaya Durga/Chapter_2_Generalized_Configurations_and_Functional_Descriptions_of.ipynb delete mode 100755 sample_notebooks/ManchukondaMaruthi Naga Vijaya Durga/Chapter_2_Generalized_Configurations_and_Functional_Descriptions_of_Measuring.ipynb create mode 100755 sample_notebooks/MandalaManoj pruthvi/Chapter_4.ipynb delete mode 100755 sample_notebooks/MandalaManoj pruthvi/Chapter_4_Radian.ipynb create mode 100755 sample_notebooks/ManikandanD/Chapter_2_Light_propagation_in.ipynb delete mode 100755 sample_notebooks/ManikandanD/Chapter_2_Light_propagation_in_optical.ipynb create mode 100755 sample_notebooks/ManikandanD/Chapter_2_Motion_in_a.ipynb delete mode 100755 sample_notebooks/ManikandanD/Chapter_2_Motion_in_a_straight.ipynb create mode 100755 sample_notebooks/MeenaChandrupatla/Chapter_1.ipynb delete mode 100755 sample_notebooks/MeenaChandrupatla/Chapter_1_Magnetic.ipynb create mode 100755 sample_notebooks/MeenaChandrupatla/Chapter_2.ipynb delete mode 100755 sample_notebooks/MeenaChandrupatla/Chapter_2_The.ipynb create mode 100755 sample_notebooks/MohdAsif/Chapter2,.ipynb delete mode 100755 sample_notebooks/MohdAsif/Chapter2,_Measurement.ipynb create mode 100755 sample_notebooks/MohdAsif/Chapter2_-.ipynb delete mode 100755 sample_notebooks/MohdAsif/Chapter2_-_Measurement.ipynb create mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI.ipynb create mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_1.ipynb create mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_10.ipynb create mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_11.ipynb create mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_12.ipynb create mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_2.ipynb create mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_3.ipynb create mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_4.ipynb create mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_5.ipynb create mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_6.ipynb create mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_7.ipynb create mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_8.ipynb create mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_9.ipynb delete mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI.ipynb delete mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_1.ipynb delete mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_10.ipynb delete mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_11.ipynb delete mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_12.ipynb delete mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_2.ipynb delete mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_3.ipynb delete mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_4.ipynb delete mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_5.ipynb delete mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_6.ipynb delete mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_7.ipynb delete mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_8.ipynb delete mode 100755 sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_9.ipynb create mode 100755 sample_notebooks/NarasimhaMamidala/NarasimhaMamidala_version_backup/Chapter_4.ipynb delete mode 100755 sample_notebooks/NarasimhaMamidala/NarasimhaMamidala_version_backup/Chapter_4_BJT.ipynb create mode 100755 sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8.ipynb create mode 100755 sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8_Abstraction_through_Classes_and_User-Defined.ipynb create mode 100755 sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8_Abstraction_through_Classes_and_User_Defined.ipynb delete mode 100755 sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8_Data.ipynb delete mode 100755 sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8_Data_Abstraction_through_Classes_and_User-Defined_Data.ipynb delete mode 100755 sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8_Data_Abstraction_through_Classes_and_User_Defined_Data.ipynb create mode 100755 sample_notebooks/NitamoniDas/NitamoniDas_version_backup/chapter_8_Abstraction_through_Classes_and_User-Defined.ipynb create mode 100755 sample_notebooks/NitamoniDas/NitamoniDas_version_backup/chapter_8_Data_Abstraction.ipynb delete mode 100755 sample_notebooks/NitamoniDas/NitamoniDas_version_backup/chapter_8_Data_Abstraction_through.ipynb delete mode 100755 sample_notebooks/NitamoniDas/NitamoniDas_version_backup/chapter_8_Data_Abstraction_through_Classes_and_User-Defined_Data.ipynb delete mode 100755 sample_notebooks/NitamoniDas/NitamoniDas_version_backup/chapter_8_Data_Abstraction_through_Classes_and_User-Defined_Data_Types.ipynb create mode 100755 sample_notebooks/PrashantSahu/Chapter_2.ipynb delete mode 100755 sample_notebooks/PrashantSahu/Chapter_2_Molecular.ipynb create mode 100755 sample_notebooks/PrashantSahu/PrashantSahu_version_backup/Chapter-2-Molecular_Diffusion_-_Principles_of_Mass_Transfer_and_Separation_Process_by_Binay.ipynb delete mode 100755 sample_notebooks/PrashantSahu/PrashantSahu_version_backup/Chapter-2-Molecular_Diffusion_-_Principles_of_Mass_Transfer_and_Separation_Process_by_Binay_K.ipynb create mode 100644 sample_notebooks/RahulJoshi/Chapter_1_An_Overview_of.ipynb delete mode 100644 sample_notebooks/RahulJoshi/Chapter_1_An_Overview_of_Heat.ipynb create mode 100755 sample_notebooks/Reshma Ustad/Chapter_2_Properties.ipynb delete mode 100755 sample_notebooks/Reshma Ustad/Chapter_2_Properties_Of.ipynb create mode 100755 sample_notebooks/SalilKapur/IntroductionConcept.ipynb delete mode 100755 sample_notebooks/SalilKapur/IntroductionConcept_of.ipynb create mode 100755 sample_notebooks/SrutiGoyal/SrutiGoyal_version_backup/Chapter_11-_Object_Initialization.ipynb delete mode 100755 sample_notebooks/SrutiGoyal/SrutiGoyal_version_backup/Chapter_11-_Object_Initialization_and.ipynb create mode 100755 sample_notebooks/SudheerBommisetty/SudheerBommisetty_version_backup/Chapter_4_Op_Amps_as.ipynb delete mode 100755 sample_notebooks/SudheerBommisetty/SudheerBommisetty_version_backup/Chapter_4_Op_Amps_as_AC.ipynb create mode 100755 sample_notebooks/SumadhuriDamerla/Chapter_1.ipynb delete mode 100755 sample_notebooks/SumadhuriDamerla/Chapter_1_Passive.ipynb create mode 100644 sample_notebooks/SumedhKadam/Chapter_1.ipynb delete mode 100644 sample_notebooks/SumedhKadam/Chapter_1_General.ipynb create mode 100755 sample_notebooks/SwathiSyamala/SwathiSyamala_version_backup/Chapter_6_IMPEDENCE_MATCHING.ipynb delete mode 100755 sample_notebooks/SwathiSyamala/SwathiSyamala_version_backup/Chapter_6_IMPEDENCE_MATCHING_AND.ipynb create mode 100755 sample_notebooks/Vedantam Lakshmi Manasa/Chapter_2.ipynb delete mode 100755 sample_notebooks/Vedantam Lakshmi Manasa/Chapter_2_Electric.ipynb create mode 100755 sample_notebooks/asmitaasmita/asmitaasmita_version_backup/1_An_overview.ipynb delete mode 100755 sample_notebooks/asmitaasmita/asmitaasmita_version_backup/1_An_overview_of.ipynb create mode 100755 sample_notebooks/harikagunturu/harikagunturu_version_backup/Chapter_4.ipynb delete mode 100755 sample_notebooks/harikagunturu/harikagunturu_version_backup/Chapter_4_Angle.ipynb create mode 100755 sample_notebooks/karansingh/Thyristors_Principles.ipynb delete mode 100755 sample_notebooks/karansingh/Thyristors_Principles_&.ipynb create mode 100755 sample_notebooks/kotaDinesh Babu/kotaDinesh Babu_version_backup/samplebook(process.ipynb delete mode 100755 sample_notebooks/kotaDinesh Babu/kotaDinesh Babu_version_backup/samplebook(process_heat.ipynb create mode 100755 sample_notebooks/kowshikChilamkurthy/Chapter_1_Stress,Axial_load_and.ipynb delete mode 100755 sample_notebooks/kowshikChilamkurthy/Chapter_1_Stress,Axial_load_and_Safety.ipynb create mode 100755 sample_notebooks/kushrami/Chapter_1_-_Overview_of_optical.ipynb delete mode 100755 sample_notebooks/kushrami/Chapter_1_-_Overview_of_optical_fiber.ipynb create mode 100755 sample_notebooks/makarala shamukha venkatasahithi/Chapter_2_Nuclear_Sturcture.ipynb delete mode 100755 sample_notebooks/makarala shamukha venkatasahithi/Chapter_2_Nuclear_Sturcture_and.ipynb create mode 100755 sample_notebooks/makarala shamukha venkatasahithi/Chapter_5_Imperfection.ipynb delete mode 100755 sample_notebooks/makarala shamukha venkatasahithi/Chapter_5_Imperfection_in.ipynb create mode 100755 sample_notebooks/manchukondasrinivasa rao/Chapter_7.ipynb delete mode 100755 sample_notebooks/manchukondasrinivasa rao/Chapter_7_Wave.ipynb create mode 100755 sample_notebooks/marupeddisameer chaitanya/Sample.ipynb delete mode 100755 sample_notebooks/marupeddisameer chaitanya/Sample_(chapter.ipynb create mode 100755 sample_notebooks/marupeddisameer chaitanya/marupeddisameer chaitanya_version_backup/Chapter_4_Diffusion_and_Reaction_in.ipynb delete mode 100755 sample_notebooks/marupeddisameer chaitanya/marupeddisameer chaitanya_version_backup/Chapter_4_Diffusion_and_Reaction_in_Porous.ipynb create mode 100755 sample_notebooks/pramodkumardesu/Chapter_2.ipynb delete mode 100755 sample_notebooks/pramodkumardesu/Chapter_2_Transmission.ipynb create mode 100644 sample_notebooks/ravindra m gowda/Chapter_1_Basics_of.ipynb delete mode 100644 sample_notebooks/ravindra m gowda/Chapter_1_Basics_of_thermodynamics.ipynb create mode 100755 sample_notebooks/vijayadurga/Chapter_5_Force_Torque_and_Shaft.ipynb delete mode 100755 sample_notebooks/vijayadurga/Chapter_5_Force_Torque_and_Shaft_power.ipynb create mode 100755 sample_notebooks/vijayadurga/sample.ipynb delete mode 100755 sample_notebooks/vijayadurga/sample_(chapter.ipynb (limited to 'sample_notebooks') diff --git a/sample_notebooks/AdityaAnand/AdityaAnand_version_backup/Chapter_8.ipynb b/sample_notebooks/AdityaAnand/AdityaAnand_version_backup/Chapter_8.ipynb index cbd1971a..c08a4250 100755 --- a/sample_notebooks/AdityaAnand/AdityaAnand_version_backup/Chapter_8.ipynb +++ b/sample_notebooks/AdityaAnand/AdityaAnand_version_backup/Chapter_8.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "###Example 8.2" + "## Example 8.2 , page : 187" ] }, { @@ -64,7 +64,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "###Example 8.3 " + "## Example 8.3 , page : 192" ] }, { @@ -117,7 +117,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "###Example 8.4" + "## Example 8.4 , page : 193" ] }, { @@ -170,7 +170,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "###Example 8.5 " + "## Example 8.5 , page : 195" ] }, { @@ -225,7 +225,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "###Example 8.6" + "## Example 8.6 , page : 195" ] }, { @@ -279,7 +279,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "###Example 8.7 " + "## Example 8.7 , page : 195 " ] }, { @@ -322,7 +322,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "###Example 8.8 " + "## Example 8.8 , page : 196 " ] }, { diff --git a/sample_notebooks/AdityaAnand/AdityaAnand_version_backup/Chapter_8_-.ipynb b/sample_notebooks/AdityaAnand/AdityaAnand_version_backup/Chapter_8_-.ipynb deleted file mode 100755 index c08a4250..00000000 --- a/sample_notebooks/AdityaAnand/AdityaAnand_version_backup/Chapter_8_-.ipynb +++ /dev/null @@ -1,390 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8.2 , page : 187" - ] - }, - { - "cell_type": "code", - "execution_count": 37, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(a) The force acting = [0.0, 2.5849394142282115e-26, 0.0] ≈ 0\n", - "(b) The force acting = 2 Gm²\n" - ] - } - ], - "source": [ - "# Importing module\n", - "\n", - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "G=6.67*pow(10,-11) # Gravitational constant\n", - "m=1 # For convenience,mass is assumed to be unity \n", - "x=30 # The angle between GC and the positive x-axis is 30° and so is the angle between GB and the negative x-axis\n", - "y=math.radians(x) # The angle in radians\n", - "a=math.cos(y)\n", - "b=math.sin(y)\n", - "v1=(0,1,0)\n", - "v2=(-a,-b,0)\n", - "v3=(a,-b,0)\n", - "c=(2*G*pow(m,2))/1 # 2Gm²/1\n", - "\n", - "# Calculation\n", - "\n", - "#(a)\n", - "F1=[y * c for y in v1] # F(GA)\n", - "F2=[y * c for y in v2] # F(GB)\n", - "F3=[y * c for y in v3] # F(GC)\n", - "# From the principle of superposition and the law of vector addition, the resultant gravitational force FR on (2m) is given by\n", - "Fa=[sum(x) for x in zip(F1,F2,F3)]\n", - "\n", - "#(b)\n", - "# By symmetry the x-component of the force cancels out and the y-component survives\n", - "Fb=4-2 # 4Gm² j - 2Gm² j\n", - "\n", - "# Result\n", - "\n", - "print(\"(a) The force acting =\",Fa,\"≈ 0\")\n", - "print(\"(b) The force acting =\",Fb,\"Gm²\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8.3 , page : 192" - ] - }, - { - "cell_type": "code", - "execution_count": 38, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Potential energy of a system of four particles = -5.414213562373095 Gm²/l\n", - "The gravitational potential at the centre of the square = -5.65685424949238 Gm²/l\n" - ] - } - ], - "source": [ - "# Importing module\n", - "\n", - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "G=6.67*pow(10,-11) # Gravitational constant\n", - "m=1 # For convenience,mass is assumed to be unity \n", - "l=1 # For convenience,side of the square is assumed to be unity \n", - "c=(G*pow(m,2))/l\n", - "n=4 # Number of particles\n", - "\n", - "# Calculation\n", - "\n", - "d=math.sqrt(2)\n", - "# If the side of a square is l then the diagonal distance is √2l\n", - "# We have four mass pairs at distance l and two diagonal pairs at distance √2l \n", - "# Since the Potential Energy of a system of four particles is -4Gm²/l) - 2Gm²/dl\n", - "w=(-n-(2/d)) \n", - "# If the side of a square is l then the diagonal distance from the centre to corner is \n", - "# Since the Gravitational Potential at the centre of the square\n", - "u=-n*(2/d)\n", - "\n", - "# Result\n", - "\n", - "print (\"Potential energy of a system of four particles =\",w,\"Gm²/l\")\n", - "print(\"The gravitational potential at the centre of the square =\",u,\"Gm²/l\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8.4 , page : 193" - ] - }, - { - "cell_type": "code", - "execution_count": 33, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Minimum speed of the projectile to reach the surface of the second sphere = ( 0.6 GM/R ) ^(1/2)\n" - ] - } - ], - "source": [ - "# Importing module\n", - "\n", - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "R=1 # For convenience,radii of both the spheres is assumed to be unity \n", - "M=1 # For convenience,mass is assumed to be unity \n", - "m1=M # Mass of the first sphere\n", - "m2=6*M # Mass of the second sphere\n", - "m=1 # Since the mass of the projectile is unknown,take it as unity\n", - "d=6*R # Distance between the centres of both the spheres\n", - "r=1 # The distance from the centre of first sphere to the neutral point N\n", - "\n", - "G=6.67*pow(10,-11) # Gravitational constant\n", - "\n", - "# Calculation\n", - "\n", - "# Since N is the neutral point; GMm/r² = 4GMm/(6R-r)² and we get\n", - "r=2*R\n", - "# The mechanical energy at the surface of M is; Et = m(v^2)/2 - GMm/R - 4GMm/5R\n", - "# The mechanical energy at N is; En = -GMm/2R - 4GMm/4R\n", - "# From the principle of conservation of mechanical energy; Et = En and we get\n", - "v_sqr=2*((4/5)-(1/2))\n", - "\n", - "# Result\n", - "\n", - "print(\"Minimum speed of the projectile to reach the surface of the second sphere =\",\"(\",round(v_sqr,5),\"GM/R\",\")\",\"^(1/2)\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8.5 , page : 195" - ] - }, - { - "cell_type": "code", - "execution_count": 36, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(i) Mass of Mars = 6.475139697520706e+23 kg\n", - "(ii) Period of revolution of Mars = 684.0033777694376 days\n" - ] - } - ], - "source": [ - "# Importing module\n", - "\n", - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "π=3.14 # Constant pi\n", - "G=6.67*pow(10,-11) # Gravitational constant\n", - "R=9.4*pow(10,3) # Orbital radius of Mars in km\n", - "T=459*60\n", - "Te=365 # Period of revolution of Earth\n", - "r=1.52 # Ratio of Rms/Res, where Rms is the mars-sun distance and Res is the earth-sun distance. \n", - "\n", - "# Calculation\n", - "\n", - "# (i) \n", - "R=R*pow(10,3)\n", - "# Using Kepler's 3rd law:T²=4π²(R^3)/GMm\n", - "Mm=(4*pow(π,2)*pow(R,3))/(G*pow(T,2))\n", - "\n", - "# (ii)\n", - "# Using Kepler's 3rd law: Tm²/Te² = (Rms^3/Res^3)\n", - "Tm=pow(r,(3/2))*365\n", - "\n", - "\n", - "# Result\n", - "\n", - "print(\"(i) Mass of Mars =\",Mm,\"kg\")\n", - "print(\"(ii) Period of revolution of Mars =\",Tm,\"days\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8.6 , page : 195" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Mass of the Earth = 5.967906881559221e+24 kg\n", - "Mass of the Earth = 6.017752855396305e+24 kg\n" - ] - } - ], - "source": [ - "# Importing module\n", - "\n", - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "g=9.81 # Acceleration due to gravity\n", - "G=6.67*pow(10,-11) # Gravitational constant\n", - "Re=6.37*pow(10,6) # Radius of Earth in m\n", - "R=3.84*pow(10,8) # Distance of Moon from Earth in m\n", - "T=27.3 # Period of revolution of Moon in days\n", - "π=3.14 # Constant pi\n", - "\n", - "# Calculation\n", - "\n", - "# I Method\n", - "# Using Newton's 2nd law of motion:g = F/m = GMe/Re²\n", - "Me1=(g*pow(Re,2))/G\n", - "\n", - "# II Method\n", - "# Using Kepler's 3rd law: T²= 4π²(R^3)/GMe\n", - "T1=T*24*60*60\n", - "Me2=(4*pow(π,2)*pow(R,3))/(G*pow(T1,2))\n", - "\n", - "#Result\n", - "\n", - "print(\"Mass of the Earth =\",Me1,\"kg\")\n", - "print(\"Mass of the Earth =\",Me2,\"kg\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8.7 , page : 195 " - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Period of revolution of Moon = 27.5 days\n" - ] - } - ], - "source": [ - "# Importing module\n", - "\n", - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "k=pow(10,-13) # A constant = 4π² / GME\n", - "Re=3.84*pow(10,5) # Distance of the Moon from the Earth in m\n", - "\n", - "# Calculation\n", - "\n", - "k=pow(10,-13)*(pow(1/(24*60*60),2))*(1/pow((1/1000),3))\n", - "T2=k*pow(Re,3)\n", - "T=math.sqrt(T2) # Period of revolution of Moon in days\n", - "\n", - "# Result\n", - "\n", - "print(\"Period of revolution of Moon =\",round(T,1),\"days\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 8.8 , page : 196 " - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Change in Kinetic Energy = 3124485000.0 J\n", - "Change in Potential Energy = 6248970000.0 J\n" - ] - } - ], - "source": [ - "# Importing module\n", - "\n", - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "m=400 # Mass of satellite in kg\n", - "Re=6.37*pow(10,6) # Radius of Earth in m\n", - "g=9.81 # Acceleration due to gravity\n", - "\n", - "# Calculation\n", - "\n", - "# Change in energy is E=Ef-Ei\n", - "ΔE=(g*m*Re)/8 # Change in Total energy\n", - "# Since Potential Energy is twice as the change in Total Energy (V = Vf - Vi)\n", - "ΔV=2*ΔE # Change in Potential Energy in J\n", - "\n", - "# Result\n", - "\n", - "print(\"Change in Kinetic Energy =\",round(ΔE,4),\"J\")\n", - "print(\"Change in Potential Energy =\",round(ΔV,4),\"J\")" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.4.3" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/AdityaR/AdityaR_version_backup/Chapter.ipynb b/sample_notebooks/AdityaR/AdityaR_version_backup/Chapter.ipynb new file mode 100755 index 00000000..a77ec491 --- /dev/null +++ b/sample_notebooks/AdityaR/AdityaR_version_backup/Chapter.ipynb @@ -0,0 +1,279 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5 General Case of Forces in a plane" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "# Example 5.2 Equations of equilibrium" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "('The reaction at P is', 5656.85424949238, 'N')\n", + "('The reaction at Q is ', 4000.0, 'N')\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "#Initialization of Variables\n", + "W=2000 #N\n", + "Lab=2 #m #length of the member from the vertical to the 1st load of 2000 N\n", + "Lac=5 #m #length of the member from the vertical to the 2nd load of 2000 N\n", + "Lpq=3.5 #m\n", + "\n", + "#Calculations\n", + "Rq=((W*Lab)+(W*Lac))/Lpq #N #take moment abt. pt P\n", + "Xp=Rq #N #sum Fx=0\n", + "Yp=2*W #N #sum Fy=0\n", + "Rp=math.sqrt(Xp**2+Yp**2) #N\n", + "\n", + "#Resuts\n", + "print('The reaction at P is' ,Rp ,'N')\n", + "print('The reaction at Q is ',Rq ,'N')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "# Example 5.3 Equations of equilibrium" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "('The reaction at A i.e Ra is ', matrix([[ 120.27406887]]), 'N')\n", + "('The reaction at B i.e Rb is ', matrix([[ 35.13703443]]), 'N')\n", + "('The required tension in the string is ', matrix([[ 40.57275258]]), 'N')\n" + ] + } + ], + "source": [ + "import math,numpy\n", + "#Initilization of vaiables\n", + "W=25 #N # self weight of the ladder\n", + "M=75 #N # weight of the man standing o the ladder\n", + "theta=63.43 #degree # angle which the ladder makes with the horizontal\n", + "alpha=30 #degree # angle made by the string with the horizontal\n", + "Loa=2 #m # spacing between the wall and the ladder\n", + "Lob=4 #m #length from the horizontal to the top of the ladder touching the wall(vertical)\n", + "\n", + "#Calculations\n", + "#Using matrix to solve the simultaneous eqn's 3 & 4\n", + "A=numpy.matrix('2 -4; 1 -0.577')\n", + "B=numpy.matrix('100;100')\n", + "C=numpy.linalg.inv(A)*B\n", + "\n", + "#Results\n", + "print('The reaction at A i.e Ra is ',C[0] ,'N')\n", + "print('The reaction at B i.e Rb is ',C[1] ,'N')\n", + "\n", + "#Calculations\n", + "T=C[1]/math.cos(math.radians(alpha)) #N # from (eqn 1)\n", + "\n", + "#Results\n", + "print('The required tension in the string is ',T, 'N')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "# Example 5.4 Equations of Equilibrium" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "('The reaction at B i.e Rb is ', 25.0, 'N')\n", + "('The horizontal reaction at A i.e Xa is ', 21.650635094610966, 'N')\n", + "('The vertical reaction at A i.e Ya is ', 112.5, 'N')\n" + ] + } + ], + "source": [ + "import math\n", + "#Initilization of variables\n", + "W=100 #N\n", + "theta=60 #degree angle made by the ladder with the horizontal\n", + "alpha=30 #degree angle made by the ladder with the vertical wall\n", + "Lob=4 #m length from the horizontal to the top of the ladder touching the wall(vertical)\n", + "Lcd=2 #m length from the horizontal to the centre of the ladder where the man stands\n", + "\n", + "#Calculations\n", + "Lab=Lob*(1/math.cos(math.radians(alpha))) #m length of the ladder\n", + "Lad=Lcd*math.tan(math.radians(alpha)) #m\n", + "Rb=(W*Lad)/Lab #N take moment at A\n", + "Xa=Rb*math.sin(math.radians(theta)) #N From eq'n 1\n", + "Ya=W+Rb*math.cos(math.radians(theta)) #N From eq'n 2\n", + "\n", + "#Results\n", + "print('The reaction at B i.e Rb is ',Rb, 'N')\n", + "print('The horizontal reaction at A i.e Xa is ',Xa, 'N')\n", + "print('The vertical reaction at A i.e Ya is ',Ya,'N')\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "# Example 5.5 Equations of Equilibrium" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "('The horizontal reaction at A i.e Xa is ', 28.867513459481287, 'N')\n", + "('The vertical reaction at A i.e Ya is ', 100, 'N')\n", + "('The reaction at B i.e Rb is ', 28.867513459481287, 'N')\n" + ] + } + ], + "source": [ + "import math\n", + "#Initilization of variables\n", + "W=100 #N self weight of the man\n", + "alpha=30 #degree angle made by the ladder with the wall\n", + "Lob=4 #m length from the horizontal to the top of the ladder touching the wall(vertical)\n", + "Lcd=2 #m\n", + "\n", + "#Calculations\n", + "# using the equiblirium equations\n", + "Ya=W #N From eq'n 2\n", + "Lad=Lcd*math.tan(math.radians(alpha)) #m Lad is the distance fom pt A to the point where the line from the cg intersects the horizontal\n", + "Rb=(W*Lad)/Lob #N Taking sum of moment abt A\n", + "Xa=Rb #N From eq'n 1\n", + "\n", + "#Results\n", + "print('The horizontal reaction at A i.e Xa is ',Xa, 'N')\n", + "print('The vertical reaction at A i.e Ya is ',Ya,'N' )\n", + "print('The reaction at B i.e Rb is ',Rb ,'N')\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "# Example 5.6 Equations of Equilibrium" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "('The horizontal reaction at A i.e Xa is ', 3.84, 'N')\n", + "('The vertical reaction at A i.e Ya is ', 7.12, 'N')\n", + "('Therefore the reaction at A i.e Ra is ', 8.089499366462674, 'N')\n", + "('The reaction at D i.e Rd is ', 4.8, 'N')\n" + ] + } + ], + "source": [ + "import math\n", + "#Initilization of variables\n", + "d=0.09 #m diametre of the right circular cylinder\n", + "h=0.12 #m height of the cyinder\n", + "W=10 #N self weight of the bar\n", + "l=0.24 #m length of the bar\n", + "\n", + "#Calculations\n", + "theta=math.degrees(math.atan(h/d)) #angle which the bar makes with the horizontal\n", + "Lad=math.sqrt(d**2+h**2) #m Lad is the length of the bar from point A to point B\n", + "Rd=(W*h*(math.cos(theta*math.pi/180)))/Lad #N Taking moment at A\n", + "Xa=Rd*(math.sin(theta*math.pi/180)) #N sum Fx=0.... From eq'n 1\n", + "Ya=W-(Rd*(math.cos(theta*math.pi/180))) #N sum Fy=0..... From eq'n 2\n", + "Ra=math.sqrt(Xa**2+Ya**2) #resultant of Xa & Ya\n", + "\n", + "#Results\n", + "print('The horizontal reaction at A i.e Xa is ',Xa, 'N')\n", + "print('The vertical reaction at A i.e Ya is ',Ya, 'N')\n", + "print('Therefore the reaction at A i.e Ra is ',Ra,'N')\n", + "print('The reaction at D i.e Rd is ',Rd,'N')" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python [Root]", + "language": "python", + "name": "Python [Root]" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.12" + }, + "widgets": { + "state": {}, + "version": "1.1.2" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/AdityaR/AdityaR_version_backup/Chapter_5-Sample.ipynb b/sample_notebooks/AdityaR/AdityaR_version_backup/Chapter_5-Sample.ipynb deleted file mode 100755 index a77ec491..00000000 --- a/sample_notebooks/AdityaR/AdityaR_version_backup/Chapter_5-Sample.ipynb +++ /dev/null @@ -1,279 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 5 General Case of Forces in a plane" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "collapsed": true - }, - "source": [ - "# Example 5.2 Equations of equilibrium" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "('The reaction at P is', 5656.85424949238, 'N')\n", - "('The reaction at Q is ', 4000.0, 'N')\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "#Initialization of Variables\n", - "W=2000 #N\n", - "Lab=2 #m #length of the member from the vertical to the 1st load of 2000 N\n", - "Lac=5 #m #length of the member from the vertical to the 2nd load of 2000 N\n", - "Lpq=3.5 #m\n", - "\n", - "#Calculations\n", - "Rq=((W*Lab)+(W*Lac))/Lpq #N #take moment abt. pt P\n", - "Xp=Rq #N #sum Fx=0\n", - "Yp=2*W #N #sum Fy=0\n", - "Rp=math.sqrt(Xp**2+Yp**2) #N\n", - "\n", - "#Resuts\n", - "print('The reaction at P is' ,Rp ,'N')\n", - "print('The reaction at Q is ',Rq ,'N')" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "collapsed": true - }, - "source": [ - "# Example 5.3 Equations of equilibrium" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "('The reaction at A i.e Ra is ', matrix([[ 120.27406887]]), 'N')\n", - "('The reaction at B i.e Rb is ', matrix([[ 35.13703443]]), 'N')\n", - "('The required tension in the string is ', matrix([[ 40.57275258]]), 'N')\n" - ] - } - ], - "source": [ - "import math,numpy\n", - "#Initilization of vaiables\n", - "W=25 #N # self weight of the ladder\n", - "M=75 #N # weight of the man standing o the ladder\n", - "theta=63.43 #degree # angle which the ladder makes with the horizontal\n", - "alpha=30 #degree # angle made by the string with the horizontal\n", - "Loa=2 #m # spacing between the wall and the ladder\n", - "Lob=4 #m #length from the horizontal to the top of the ladder touching the wall(vertical)\n", - "\n", - "#Calculations\n", - "#Using matrix to solve the simultaneous eqn's 3 & 4\n", - "A=numpy.matrix('2 -4; 1 -0.577')\n", - "B=numpy.matrix('100;100')\n", - "C=numpy.linalg.inv(A)*B\n", - "\n", - "#Results\n", - "print('The reaction at A i.e Ra is ',C[0] ,'N')\n", - "print('The reaction at B i.e Rb is ',C[1] ,'N')\n", - "\n", - "#Calculations\n", - "T=C[1]/math.cos(math.radians(alpha)) #N # from (eqn 1)\n", - "\n", - "#Results\n", - "print('The required tension in the string is ',T, 'N')" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "collapsed": true - }, - "source": [ - "# Example 5.4 Equations of Equilibrium" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "('The reaction at B i.e Rb is ', 25.0, 'N')\n", - "('The horizontal reaction at A i.e Xa is ', 21.650635094610966, 'N')\n", - "('The vertical reaction at A i.e Ya is ', 112.5, 'N')\n" - ] - } - ], - "source": [ - "import math\n", - "#Initilization of variables\n", - "W=100 #N\n", - "theta=60 #degree angle made by the ladder with the horizontal\n", - "alpha=30 #degree angle made by the ladder with the vertical wall\n", - "Lob=4 #m length from the horizontal to the top of the ladder touching the wall(vertical)\n", - "Lcd=2 #m length from the horizontal to the centre of the ladder where the man stands\n", - "\n", - "#Calculations\n", - "Lab=Lob*(1/math.cos(math.radians(alpha))) #m length of the ladder\n", - "Lad=Lcd*math.tan(math.radians(alpha)) #m\n", - "Rb=(W*Lad)/Lab #N take moment at A\n", - "Xa=Rb*math.sin(math.radians(theta)) #N From eq'n 1\n", - "Ya=W+Rb*math.cos(math.radians(theta)) #N From eq'n 2\n", - "\n", - "#Results\n", - "print('The reaction at B i.e Rb is ',Rb, 'N')\n", - "print('The horizontal reaction at A i.e Xa is ',Xa, 'N')\n", - "print('The vertical reaction at A i.e Ya is ',Ya,'N')\n" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "collapsed": true - }, - "source": [ - "# Example 5.5 Equations of Equilibrium" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "('The horizontal reaction at A i.e Xa is ', 28.867513459481287, 'N')\n", - "('The vertical reaction at A i.e Ya is ', 100, 'N')\n", - "('The reaction at B i.e Rb is ', 28.867513459481287, 'N')\n" - ] - } - ], - "source": [ - "import math\n", - "#Initilization of variables\n", - "W=100 #N self weight of the man\n", - "alpha=30 #degree angle made by the ladder with the wall\n", - "Lob=4 #m length from the horizontal to the top of the ladder touching the wall(vertical)\n", - "Lcd=2 #m\n", - "\n", - "#Calculations\n", - "# using the equiblirium equations\n", - "Ya=W #N From eq'n 2\n", - "Lad=Lcd*math.tan(math.radians(alpha)) #m Lad is the distance fom pt A to the point where the line from the cg intersects the horizontal\n", - "Rb=(W*Lad)/Lob #N Taking sum of moment abt A\n", - "Xa=Rb #N From eq'n 1\n", - "\n", - "#Results\n", - "print('The horizontal reaction at A i.e Xa is ',Xa, 'N')\n", - "print('The vertical reaction at A i.e Ya is ',Ya,'N' )\n", - "print('The reaction at B i.e Rb is ',Rb ,'N')\n" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "collapsed": true - }, - "source": [ - "# Example 5.6 Equations of Equilibrium" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "('The horizontal reaction at A i.e Xa is ', 3.84, 'N')\n", - "('The vertical reaction at A i.e Ya is ', 7.12, 'N')\n", - "('Therefore the reaction at A i.e Ra is ', 8.089499366462674, 'N')\n", - "('The reaction at D i.e Rd is ', 4.8, 'N')\n" - ] - } - ], - "source": [ - "import math\n", - "#Initilization of variables\n", - "d=0.09 #m diametre of the right circular cylinder\n", - "h=0.12 #m height of the cyinder\n", - "W=10 #N self weight of the bar\n", - "l=0.24 #m length of the bar\n", - "\n", - "#Calculations\n", - "theta=math.degrees(math.atan(h/d)) #angle which the bar makes with the horizontal\n", - "Lad=math.sqrt(d**2+h**2) #m Lad is the length of the bar from point A to point B\n", - "Rd=(W*h*(math.cos(theta*math.pi/180)))/Lad #N Taking moment at A\n", - "Xa=Rd*(math.sin(theta*math.pi/180)) #N sum Fx=0.... From eq'n 1\n", - "Ya=W-(Rd*(math.cos(theta*math.pi/180))) #N sum Fy=0..... From eq'n 2\n", - "Ra=math.sqrt(Xa**2+Ya**2) #resultant of Xa & Ya\n", - "\n", - "#Results\n", - "print('The horizontal reaction at A i.e Xa is ',Xa, 'N')\n", - "print('The vertical reaction at A i.e Ya is ',Ya, 'N')\n", - "print('Therefore the reaction at A i.e Ra is ',Ra,'N')\n", - "print('The reaction at D i.e Rd is ',Rd,'N')" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python [Root]", - "language": "python", - "name": "Python [Root]" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.12" - }, - "widgets": { - "state": {}, - "version": "1.1.2" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/Aman KumarJain/Aman KumarJain_version_backup/Chapter_6_Objects.ipynb b/sample_notebooks/Aman KumarJain/Aman KumarJain_version_backup/Chapter_6_Objects.ipynb new file mode 100755 index 00000000..89a18f99 --- /dev/null +++ b/sample_notebooks/Aman KumarJain/Aman KumarJain_version_backup/Chapter_6_Objects.ipynb @@ -0,0 +1,934 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:bd4e7931ddf89d8dc8befb681e1e57c7a9c742cd8abe8e18a494a55156d56cee" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 6: Objects and Classes" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.1, Page Number: 216" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class smallobj: #define a class\n", + " \n", + " def setdata(self,d): #member function to set class variable somdata\n", + " self.__somedata = d\n", + " \n", + " def showdata(self): #member function to display somedata \n", + " print 'Data is ' , self.__somedata\n", + "\n", + "\n", + "#define two objects of class smallobj\n", + "s1=smallobj()\n", + "s2=smallobj()\n", + "\n", + "#call member function to set data \n", + "s1.setdata(1066)\n", + "s2.setdata(1776)\n", + "\n", + "#call member function to display data \n", + "s1.showdata()\n", + "s2.showdata()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Data is 1066\n", + "Data is 1776\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.2, Page Number: 223" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class part: #define class \n", + " \n", + " def setpart(self,mn,pn,c): #set data\n", + " self.__modelnumber = mn\n", + " self.__partnumber = pn\n", + " self.__cost = c\n", + " \n", + " def showpart(self): #display data \n", + " print 'Model' , self.__modelnumber ,\n", + " print ', part' , self.__partnumber , \n", + " print ', costs $',self.__cost\n", + " \n", + "#define object of class part \n", + "part1 = part()\n", + "\n", + "#call member function setpart\n", + "part1.setpart(6244,373,217.55)\n", + "\n", + "#call member function showpart\n", + "part1.showpart()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Model 6244 , part 373 , costs $ 217.55\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.3, Page Number: 225" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from turtle import * #importing turtles library\n", + "\n", + "class circle: #defining circle class\n", + " \n", + " def set(self,x,y,r,fc): #sets circle attribute\n", + " self._xCo = x\n", + " self._yCo = y\n", + " self._radius = r\n", + " self._fillcolor = fc\n", + " \n", + " def draw(self): #draws the circle \n", + " setup() #set screen\n", + " turtle = Turtle() #object of Turtle class\n", + " turtle.begin_fill() #start filling color in circle\n", + " turtle.color(self._fillcolor) #color\n", + " turtle.up()\n", + " turtle.goto(self._xCo,self._yCo) #set center of circle\n", + " turtle.circle(self._radius) #draw circle of radius self.__radius\n", + " turtle.end_fill() #stop filling\n", + " turtle.hideturtle()\n", + " done()\n", + "\n", + "#creating objects of class circle \n", + "c1 = circle()\n", + "c2 = circle()\n", + "c3 = circle()\n", + "\n", + "#sending the value to set fnction\n", + "c1.set(15,7,5,\"blue\")\n", + "c2.set(41,12,7,\"red\")\n", + "c3.set(65,18,4,\"green\")\n", + "\n", + "#draw circle\n", + "c1.draw()\n", + "c2.draw()\n", + "c3.draw()\n", + "\n", + "#In the above example the cirlcle's in the book are constructed using 'X' and 'O' but such feature is not available in Python.\n", + "#So i have created a simple circle filled with color" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.4, Page Number: 226" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Distance: #Distance class\n", + " \n", + " def setdist(self,ft,inc): #set distance to class variables\n", + " self.__feet = ft\n", + " self.__inches = inc\n", + " \n", + " def getdist(self): #get distance from user\n", + " self.__feet = input('Enter feet:')\n", + " self.__inches = input('Enter inches:')\n", + " \n", + " def showdist(self): #display distance\n", + " print self.__feet , '\\' -' , self.__inches , '\\\"'\n", + "\n", + "#define two distance\n", + "dist1 = Distance()\n", + "dist2 = Distance()\n", + "\n", + "dist1.setdist(11,6.25) #set dist1\n", + "dist2.getdist() #set dist2 from user\n", + "\n", + "#show distances\n", + "print \"dist1 = \",\n", + "dist1.showdist()\n", + "print 'dist2 = ',\n", + "dist2.showdist()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter feet:17\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter inches:5.75\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "dist1 = 11 ' - 6.25 \"\n", + "dist2 = 17 ' - 5.75 \"\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.5, Page Number: 228" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Counter:\n", + " \n", + " def __init__(self): #constructor\n", + " self.__count = 0\n", + " \n", + " def inc_count(self): #increment count\n", + " self.__count = self.__count + 1\n", + " \n", + " def get_count(self): #return count\n", + " return self.__count\n", + "\n", + "#define and initialize class objects\n", + "c1=Counter()\n", + "c2=Counter()\n", + "\n", + "#display count for each object\n", + "print 'c1 =',c1.get_count()\n", + "print 'c2 =',c2.get_count()\n", + "\n", + "\n", + "c1.inc_count() #increment c1\n", + "c2.inc_count() #increment c2\n", + "c2.inc_count() #increment c2\n", + "\n", + "#display count again for each object\n", + "print 'c1 =',c1.get_count()\n", + "print 'c2 =',c2.get_count()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c1 = 0\n", + "c2 = 0\n", + "c1 = 1\n", + "c2 = 2\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.6, Page Number: 231" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from turtle import * #importing turtles library\n", + "\n", + "class circle: #defining circle class\n", + " \n", + " def __init__(self,x,y,r,fc): #constructor for set circle attribute\n", + " self._xCo = x\n", + " self._yCo = y\n", + " self._radius = r\n", + " self._fillcolor = fc\n", + " \n", + " def draw(self): #draws the circle\n", + " setup()\n", + " turtle = Turtle()\n", + " turtle.begin_fill()\n", + " turtle.color(self._fillcolor)\n", + " turtle.up()\n", + " turtle.goto(self._xCo,self._yCo)\n", + " turtle.down()\n", + " turtle.circle(self._radius)\n", + " turtle.end_fill()\n", + " turtle.hideturtle()\n", + " done()\n", + "\n", + "#creating objects of class circle \n", + "c1 = circle(15,7,5,\"blue\") \n", + "c2 = circle(41,12,7,\"red\")\n", + "c3 = circle(65,18,4,\"green\")\n", + "\n", + "#draw circle\n", + "c1.draw()\n", + "c2.draw()\n", + "c3.draw()" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.7, Page Number: 233" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Distance: #Distance class\n", + " \n", + " def __init__(self,ft=0,inc=0): #constructor \n", + " self.__feet = ft\n", + " self.__inches = inc\n", + " \n", + " def getdist(self): #get length from user\n", + " self.__feet = input('Enter feet:')\n", + " self.__inches = input('Enter inches:')\n", + " \n", + " def showdist(self): #display distance\n", + " print self.__feet , '\\' -' , self.__inches , '\\\"'\n", + " \n", + " def add_dist(self,d2,d3): #add length d2 and d3\n", + " self.__inches = d2.__inches + d3.__inches #add inches\n", + " self.__feet = 0\n", + " if self.__inches >= 12.0: #if total exceeds 12.0\n", + " self.__inches = self.__inches - 12.0 #then decrease inches by 12.0\n", + " self.__feet = self.__feet + 1 #and increase feet by 1\n", + " self.__feet = self.__feet + d2.__feet + d3.__feet #add the feet\n", + "\n", + "#define two length\n", + "dist1 = Distance()\n", + "dist3 = Distance()\n", + "\n", + "#define and initialize dist2\n", + "dist2 = Distance(11,6.25)\n", + "\n", + "#get dist1 from user\n", + "dist1.getdist()\n", + "\n", + "#dist3 = dist1 + dist2\n", + "dist3.add_dist(dist1,dist2)\n", + "\n", + "#display all lengths\n", + "print 'dist1 = ',\n", + "dist1.showdist()\n", + "print 'dist2 = ',\n", + "dist2.showdist()\n", + "print 'dist3 = ',\n", + "dist3.showdist()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter feet:17\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter inches:5.75\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "dist1 = 17 ' - 5.75 \"\n", + "dist2 = 11 ' - 6.25 \"\n", + "dist3 = 29 ' - 0.0 \"\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.8, Page Number: 238" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Distance: #Distance class\n", + " \n", + " def __init__(self,ft=0,inc=0): #overloaded constructor that takes no arguments or two args or one object(copy constructor)\n", + " if isinstance(ft,int):\n", + " self.__feet = ft\n", + " self.__inches = inc\n", + " else:\n", + " self.__feet = ft.__feet\n", + " self.__inches = ft.__inches\n", + " \n", + " def getdist(self): #get length from user\n", + " self.__feet = input('Enter feet:')\n", + " self.__inches = input('Enter inches:')\n", + " \n", + " def showdist(self): #display distance\n", + " print self.__feet , '\\' -' , self.__inches , '\\\"'\n", + "\n", + "#two argument constructor\n", + "dist1 = Distance(11,6.25)\n", + "\n", + "#one argument(object) constructor explicitly pass\n", + "dist2 = Distance(dist1)\n", + "\n", + "#also one argument(object) constructor implicitly pass\n", + "dist3 = dist1\n", + "\n", + "#display all lengths\n", + "print 'dist1 = ',\n", + "dist1.showdist()\n", + "print 'dist2 = ',\n", + "dist2.showdist()\n", + "print 'dist3 = ',\n", + "dist3.showdist()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "dist1 = 11 ' - 6.25 \"\n", + "dist2 = 11 ' - 6.25 \"\n", + "dist3 = 11 ' - 6.25 \"\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.9, Page Number: 240" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Distance: #Distance class\n", + " \n", + " def __init__(self,ft=0,inc=0): #constructor \n", + " self.__feet = ft\n", + " self.__inches = inc\n", + " \n", + " def getdist(self): #get length from user\n", + " self.__feet = input('Enter feet:')\n", + " self.__inches = input('Enter inches:')\n", + " \n", + " def showdist(self): #display distance\n", + " print self.__feet , '\\' -' , self.__inches , '\\\"'\n", + " \n", + " def add_dist(self,d2): #add this length to d2 and return object\n", + " temp = Distance() #temporary object\n", + " temp.__inches = self.__inches + d2.__inches\n", + " if temp.__inches >= 12.0:\n", + " temp.__inches = temp.__inches - 12.0\n", + " temp.__feet = 1\n", + " temp.__feet = temp.__feet + self.__feet + d2.__feet\n", + " return temp #return sum as object\n", + "\n", + "#define two length\n", + "dist1 = Distance()\n", + "dist3 = Distance()\n", + "\n", + "#define and initialize dist2\n", + "dist2 = Distance(11,6.25)\n", + "\n", + "#get dist1 from user\n", + "dist1.getdist()\n", + "\n", + "#dist3 = dist1 + dist2\n", + "dist3 = dist1.add_dist(dist2)\n", + "\n", + "#display all lengths\n", + "print 'dist1 = ',\n", + "dist1.showdist()\n", + "print 'dist2 = ',\n", + "dist2.showdist()\n", + "print 'dist3 = ',\n", + "dist3.showdist()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter feet:17\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter inches:5.75\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "dist1 = 17 ' - 5.75 \"\n", + "dist2 = 11 ' - 6.25 \"\n", + "dist3 = 29 ' - 0.0 \"\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.10, Page Number: 243" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Suit = [\"clubs\",\"diamonds\",\"hearts\",\"spades\"] \n", + "\n", + "(clubs,diamonds,hearts,spades) = (0,1,2,3) #Atteching the names with number \n", + "\n", + "\n", + "#from 2 to 10 are integers without names\n", + "jack = 11 \n", + "queen = 12 \n", + "king = 13\n", + "ace = 14\n", + "\n", + "\n", + "class card: \n", + " \n", + " def __init__(self,n=None,s=None): #constructor\n", + " self.__number = n #2 to 10, jack, queen, king, ace\n", + " self.__suit = s #clubs, diamonds, hearts, spades\n", + " \n", + " def display(self): #display the cards\n", + " \n", + " if self.__number >= 2 and self.__number<=10:\n", + " print self.__number , 'of',\n", + " \n", + " else:\n", + " if self.__number == jack:\n", + " print 'jack of',\n", + " elif self.__number == queen:\n", + " print 'queen of',\n", + " elif self.__number == king:\n", + " print 'king of',\n", + " else:\n", + " print 'ace of',\n", + " \n", + " if self.__suit == clubs:\n", + " print 'clubs'\n", + " elif self.__suit == diamonds:\n", + " print 'diamonds'\n", + " elif self.__suit == hearts:\n", + " print 'hearts'\n", + " else:\n", + " print 'spades'\n", + " \n", + " def isEqual(self,c2): #return 1 if cards equal\n", + " \n", + " if self.__number == c2.__number and self.__suit == c2.__suit:\n", + " return 1\n", + " else:\n", + " return 0\n", + "\n", + "\n", + "#define various cards\n", + "temp = card()\n", + "chosen = card()\n", + "prize = card()\n", + "\n", + "\n", + "#define and initialize card1\n", + "card1 = card(7,clubs)\n", + "print 'card 1 is the',\n", + "card1.display() #display card1\n", + "\n", + "#define and initialize card2\n", + "card2 = card(jack,hearts)\n", + "print 'card 2 is the',\n", + "card2.display() #display card2\n", + "\n", + "#define and initialize card3\n", + "card3 = card(ace,spades)\n", + "print 'card 3 is the',\n", + "card3.display() #display card3\n", + "\n", + "\n", + "#prize is the card to guess\n", + "prize = card3\n", + "\n", + "\n", + "#swapping cards\n", + "print 'I\\'m swapping card 1 and card 3'\n", + "temp = card3\n", + "card3 = card1\n", + "card1 = temp\n", + "\n", + "print 'I\\'m swapping card 2 and card 3'\n", + "temp = card2\n", + "card3 = card2\n", + "card2 = temp\n", + "\n", + "print 'I\\'m swapping card 1 and card 2'\n", + "temp = card2\n", + "card2 = card1\n", + "card1 = temp\n", + "\n", + "print 'Now, where (1,2, or 3) is the',\n", + "prize.display() #display prize\n", + "print '?'\n", + "\n", + "position = input() #get user's guess of position\n", + "\n", + "\n", + "#set chosen to user's choice \n", + "if position == 1:\n", + " chosen = card1\n", + "elif position == 2:\n", + " chosen = card2\n", + "else:\n", + " chosen = card3\n", + "\n", + "#is chosen card the prize?\n", + "\n", + "x=chosen.isEqual(prize)\n", + "\n", + "if x==1:\n", + " print 'That\\'s right! You win!'\n", + "else:\n", + " print 'Sorry. You lose.'\n", + "\n", + "print 'You choose the',\n", + "\n", + "#display chosen card\n", + "chosen.display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "card 1 is the 7 of clubs\n", + "card 2 is the jack of hearts\n", + "card 3 is the ace of spades\n", + "I'm swapping card 1 and card 3\n", + "I'm swapping card 2 and card 3\n", + "I'm swapping card 1 and card 2\n", + "Now, where (1,2, or 3) is the ace of spades\n", + "?\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "That's right! You win!\n", + "You choose the ace of spades\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.11, Page Number: 249" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class foo: \n", + " \n", + " __count = 0 #only one data item for all objects\n", + " \n", + " def __init__(self):\n", + " foo.__count = foo.__count + 1 #increment count when object created\n", + " \n", + " def getcount(self): #returns count\n", + " return foo.__count\n", + "\n", + "#create three objecs\n", + "f1 = foo()\n", + "f2 = foo()\n", + "f3 = foo()\n", + "\n", + "#Each object displays the same count value\n", + "print 'count is', f1.getcount()\n", + "print 'count is', f2.getcount()\n", + "print 'count is', f3.getcount()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "count is 3\n", + "count is 3\n", + "count is 3\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.12, Page Number: 253" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Distance: #Distance class\n", + " \n", + " def __init__(self,ft=0,inc=0.0): #constructor \n", + " self.__feet = ft\n", + " self.__inches = inc\n", + " \n", + " def getdist(self): #get length from user\n", + " self.__feet = input('Enter feet:')\n", + " self.__inches = input('Enter inches:')\n", + " \n", + " def showdist(self): #display distance\n", + " print self.__feet , '\\' -' , self.__inches , '\\\"'\n", + "\n", + "#There's no const keyword \n", + " \n", + " def add_dist(self,d2): #add this length to d2 and return object\n", + " \n", + " temp = Distance()\n", + " temp.__inches = self.__inches + d2.__inches\n", + " \n", + " if temp.__inches >= 12.0:\n", + " temp.__inches = temp.__inches - 12.0\n", + " temp.__feet = 1\n", + " \n", + " temp.__feet = temp.__feet + self.__feet + d2.__feet\n", + " \n", + " return temp #return sum as object\n", + " \n", + "dist1 = Distance()\n", + "dist3 = Distance()\n", + "dist2 = Distance(11,6.25)\n", + "\n", + "dist1.getdist()\n", + "\n", + "dist3 = dist1.add_dist(dist2)\n", + "\n", + "print 'dist1 = ',\n", + "dist1.showdist()\n", + "print 'dist2 = ',\n", + "dist2.showdist()\n", + "print 'dist3 = ',\n", + "dist3.showdist()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter feet:17\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter inches:5.75\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "dist1 = 17 ' - 5.75 \"\n", + "dist2 = 11 ' - 6.25 \"\n", + "dist3 = 29 ' - 0.0 \"\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.13, Page Number: 255" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Distance:\n", + " \n", + " def __init__(self,ft,inc):\n", + " self.__feet = ft\n", + " self.__inches = inc\n", + " \n", + " def getdist(self):\n", + " self.__feet = input('Enter feet:')\n", + " self.__inches = input('Enter inches:')\n", + " \n", + " def showdist(self):\n", + " print self.__feet , '\\' -' , self.__inches , '\\\"'\n", + "\n", + "football = Distance(300,0)\n", + "\n", + "print 'football = ',\n", + "football.showdist()\n", + "\n", + "#There's no const keyword in python" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "football = 300 ' - 0 \"\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/Aman KumarJain/Aman KumarJain_version_backup/Chapter_6_Objects_and.ipynb b/sample_notebooks/Aman KumarJain/Aman KumarJain_version_backup/Chapter_6_Objects_and.ipynb deleted file mode 100755 index 89a18f99..00000000 --- a/sample_notebooks/Aman KumarJain/Aman KumarJain_version_backup/Chapter_6_Objects_and.ipynb +++ /dev/null @@ -1,934 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:bd4e7931ddf89d8dc8befb681e1e57c7a9c742cd8abe8e18a494a55156d56cee" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 6: Objects and Classes" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.1, Page Number: 216" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class smallobj: #define a class\n", - " \n", - " def setdata(self,d): #member function to set class variable somdata\n", - " self.__somedata = d\n", - " \n", - " def showdata(self): #member function to display somedata \n", - " print 'Data is ' , self.__somedata\n", - "\n", - "\n", - "#define two objects of class smallobj\n", - "s1=smallobj()\n", - "s2=smallobj()\n", - "\n", - "#call member function to set data \n", - "s1.setdata(1066)\n", - "s2.setdata(1776)\n", - "\n", - "#call member function to display data \n", - "s1.showdata()\n", - "s2.showdata()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Data is 1066\n", - "Data is 1776\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.2, Page Number: 223" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class part: #define class \n", - " \n", - " def setpart(self,mn,pn,c): #set data\n", - " self.__modelnumber = mn\n", - " self.__partnumber = pn\n", - " self.__cost = c\n", - " \n", - " def showpart(self): #display data \n", - " print 'Model' , self.__modelnumber ,\n", - " print ', part' , self.__partnumber , \n", - " print ', costs $',self.__cost\n", - " \n", - "#define object of class part \n", - "part1 = part()\n", - "\n", - "#call member function setpart\n", - "part1.setpart(6244,373,217.55)\n", - "\n", - "#call member function showpart\n", - "part1.showpart()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Model 6244 , part 373 , costs $ 217.55\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.3, Page Number: 225" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from turtle import * #importing turtles library\n", - "\n", - "class circle: #defining circle class\n", - " \n", - " def set(self,x,y,r,fc): #sets circle attribute\n", - " self._xCo = x\n", - " self._yCo = y\n", - " self._radius = r\n", - " self._fillcolor = fc\n", - " \n", - " def draw(self): #draws the circle \n", - " setup() #set screen\n", - " turtle = Turtle() #object of Turtle class\n", - " turtle.begin_fill() #start filling color in circle\n", - " turtle.color(self._fillcolor) #color\n", - " turtle.up()\n", - " turtle.goto(self._xCo,self._yCo) #set center of circle\n", - " turtle.circle(self._radius) #draw circle of radius self.__radius\n", - " turtle.end_fill() #stop filling\n", - " turtle.hideturtle()\n", - " done()\n", - "\n", - "#creating objects of class circle \n", - "c1 = circle()\n", - "c2 = circle()\n", - "c3 = circle()\n", - "\n", - "#sending the value to set fnction\n", - "c1.set(15,7,5,\"blue\")\n", - "c2.set(41,12,7,\"red\")\n", - "c3.set(65,18,4,\"green\")\n", - "\n", - "#draw circle\n", - "c1.draw()\n", - "c2.draw()\n", - "c3.draw()\n", - "\n", - "#In the above example the cirlcle's in the book are constructed using 'X' and 'O' but such feature is not available in Python.\n", - "#So i have created a simple circle filled with color" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.4, Page Number: 226" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Distance: #Distance class\n", - " \n", - " def setdist(self,ft,inc): #set distance to class variables\n", - " self.__feet = ft\n", - " self.__inches = inc\n", - " \n", - " def getdist(self): #get distance from user\n", - " self.__feet = input('Enter feet:')\n", - " self.__inches = input('Enter inches:')\n", - " \n", - " def showdist(self): #display distance\n", - " print self.__feet , '\\' -' , self.__inches , '\\\"'\n", - "\n", - "#define two distance\n", - "dist1 = Distance()\n", - "dist2 = Distance()\n", - "\n", - "dist1.setdist(11,6.25) #set dist1\n", - "dist2.getdist() #set dist2 from user\n", - "\n", - "#show distances\n", - "print \"dist1 = \",\n", - "dist1.showdist()\n", - "print 'dist2 = ',\n", - "dist2.showdist()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter feet:17\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter inches:5.75\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "dist1 = 11 ' - 6.25 \"\n", - "dist2 = 17 ' - 5.75 \"\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.5, Page Number: 228" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Counter:\n", - " \n", - " def __init__(self): #constructor\n", - " self.__count = 0\n", - " \n", - " def inc_count(self): #increment count\n", - " self.__count = self.__count + 1\n", - " \n", - " def get_count(self): #return count\n", - " return self.__count\n", - "\n", - "#define and initialize class objects\n", - "c1=Counter()\n", - "c2=Counter()\n", - "\n", - "#display count for each object\n", - "print 'c1 =',c1.get_count()\n", - "print 'c2 =',c2.get_count()\n", - "\n", - "\n", - "c1.inc_count() #increment c1\n", - "c2.inc_count() #increment c2\n", - "c2.inc_count() #increment c2\n", - "\n", - "#display count again for each object\n", - "print 'c1 =',c1.get_count()\n", - "print 'c2 =',c2.get_count()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "c1 = 0\n", - "c2 = 0\n", - "c1 = 1\n", - "c2 = 2\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.6, Page Number: 231" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from turtle import * #importing turtles library\n", - "\n", - "class circle: #defining circle class\n", - " \n", - " def __init__(self,x,y,r,fc): #constructor for set circle attribute\n", - " self._xCo = x\n", - " self._yCo = y\n", - " self._radius = r\n", - " self._fillcolor = fc\n", - " \n", - " def draw(self): #draws the circle\n", - " setup()\n", - " turtle = Turtle()\n", - " turtle.begin_fill()\n", - " turtle.color(self._fillcolor)\n", - " turtle.up()\n", - " turtle.goto(self._xCo,self._yCo)\n", - " turtle.down()\n", - " turtle.circle(self._radius)\n", - " turtle.end_fill()\n", - " turtle.hideturtle()\n", - " done()\n", - "\n", - "#creating objects of class circle \n", - "c1 = circle(15,7,5,\"blue\") \n", - "c2 = circle(41,12,7,\"red\")\n", - "c3 = circle(65,18,4,\"green\")\n", - "\n", - "#draw circle\n", - "c1.draw()\n", - "c2.draw()\n", - "c3.draw()" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.7, Page Number: 233" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Distance: #Distance class\n", - " \n", - " def __init__(self,ft=0,inc=0): #constructor \n", - " self.__feet = ft\n", - " self.__inches = inc\n", - " \n", - " def getdist(self): #get length from user\n", - " self.__feet = input('Enter feet:')\n", - " self.__inches = input('Enter inches:')\n", - " \n", - " def showdist(self): #display distance\n", - " print self.__feet , '\\' -' , self.__inches , '\\\"'\n", - " \n", - " def add_dist(self,d2,d3): #add length d2 and d3\n", - " self.__inches = d2.__inches + d3.__inches #add inches\n", - " self.__feet = 0\n", - " if self.__inches >= 12.0: #if total exceeds 12.0\n", - " self.__inches = self.__inches - 12.0 #then decrease inches by 12.0\n", - " self.__feet = self.__feet + 1 #and increase feet by 1\n", - " self.__feet = self.__feet + d2.__feet + d3.__feet #add the feet\n", - "\n", - "#define two length\n", - "dist1 = Distance()\n", - "dist3 = Distance()\n", - "\n", - "#define and initialize dist2\n", - "dist2 = Distance(11,6.25)\n", - "\n", - "#get dist1 from user\n", - "dist1.getdist()\n", - "\n", - "#dist3 = dist1 + dist2\n", - "dist3.add_dist(dist1,dist2)\n", - "\n", - "#display all lengths\n", - "print 'dist1 = ',\n", - "dist1.showdist()\n", - "print 'dist2 = ',\n", - "dist2.showdist()\n", - "print 'dist3 = ',\n", - "dist3.showdist()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter feet:17\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter inches:5.75\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "dist1 = 17 ' - 5.75 \"\n", - "dist2 = 11 ' - 6.25 \"\n", - "dist3 = 29 ' - 0.0 \"\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.8, Page Number: 238" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Distance: #Distance class\n", - " \n", - " def __init__(self,ft=0,inc=0): #overloaded constructor that takes no arguments or two args or one object(copy constructor)\n", - " if isinstance(ft,int):\n", - " self.__feet = ft\n", - " self.__inches = inc\n", - " else:\n", - " self.__feet = ft.__feet\n", - " self.__inches = ft.__inches\n", - " \n", - " def getdist(self): #get length from user\n", - " self.__feet = input('Enter feet:')\n", - " self.__inches = input('Enter inches:')\n", - " \n", - " def showdist(self): #display distance\n", - " print self.__feet , '\\' -' , self.__inches , '\\\"'\n", - "\n", - "#two argument constructor\n", - "dist1 = Distance(11,6.25)\n", - "\n", - "#one argument(object) constructor explicitly pass\n", - "dist2 = Distance(dist1)\n", - "\n", - "#also one argument(object) constructor implicitly pass\n", - "dist3 = dist1\n", - "\n", - "#display all lengths\n", - "print 'dist1 = ',\n", - "dist1.showdist()\n", - "print 'dist2 = ',\n", - "dist2.showdist()\n", - "print 'dist3 = ',\n", - "dist3.showdist()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "dist1 = 11 ' - 6.25 \"\n", - "dist2 = 11 ' - 6.25 \"\n", - "dist3 = 11 ' - 6.25 \"\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.9, Page Number: 240" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Distance: #Distance class\n", - " \n", - " def __init__(self,ft=0,inc=0): #constructor \n", - " self.__feet = ft\n", - " self.__inches = inc\n", - " \n", - " def getdist(self): #get length from user\n", - " self.__feet = input('Enter feet:')\n", - " self.__inches = input('Enter inches:')\n", - " \n", - " def showdist(self): #display distance\n", - " print self.__feet , '\\' -' , self.__inches , '\\\"'\n", - " \n", - " def add_dist(self,d2): #add this length to d2 and return object\n", - " temp = Distance() #temporary object\n", - " temp.__inches = self.__inches + d2.__inches\n", - " if temp.__inches >= 12.0:\n", - " temp.__inches = temp.__inches - 12.0\n", - " temp.__feet = 1\n", - " temp.__feet = temp.__feet + self.__feet + d2.__feet\n", - " return temp #return sum as object\n", - "\n", - "#define two length\n", - "dist1 = Distance()\n", - "dist3 = Distance()\n", - "\n", - "#define and initialize dist2\n", - "dist2 = Distance(11,6.25)\n", - "\n", - "#get dist1 from user\n", - "dist1.getdist()\n", - "\n", - "#dist3 = dist1 + dist2\n", - "dist3 = dist1.add_dist(dist2)\n", - "\n", - "#display all lengths\n", - "print 'dist1 = ',\n", - "dist1.showdist()\n", - "print 'dist2 = ',\n", - "dist2.showdist()\n", - "print 'dist3 = ',\n", - "dist3.showdist()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter feet:17\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter inches:5.75\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "dist1 = 17 ' - 5.75 \"\n", - "dist2 = 11 ' - 6.25 \"\n", - "dist3 = 29 ' - 0.0 \"\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.10, Page Number: 243" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "Suit = [\"clubs\",\"diamonds\",\"hearts\",\"spades\"] \n", - "\n", - "(clubs,diamonds,hearts,spades) = (0,1,2,3) #Atteching the names with number \n", - "\n", - "\n", - "#from 2 to 10 are integers without names\n", - "jack = 11 \n", - "queen = 12 \n", - "king = 13\n", - "ace = 14\n", - "\n", - "\n", - "class card: \n", - " \n", - " def __init__(self,n=None,s=None): #constructor\n", - " self.__number = n #2 to 10, jack, queen, king, ace\n", - " self.__suit = s #clubs, diamonds, hearts, spades\n", - " \n", - " def display(self): #display the cards\n", - " \n", - " if self.__number >= 2 and self.__number<=10:\n", - " print self.__number , 'of',\n", - " \n", - " else:\n", - " if self.__number == jack:\n", - " print 'jack of',\n", - " elif self.__number == queen:\n", - " print 'queen of',\n", - " elif self.__number == king:\n", - " print 'king of',\n", - " else:\n", - " print 'ace of',\n", - " \n", - " if self.__suit == clubs:\n", - " print 'clubs'\n", - " elif self.__suit == diamonds:\n", - " print 'diamonds'\n", - " elif self.__suit == hearts:\n", - " print 'hearts'\n", - " else:\n", - " print 'spades'\n", - " \n", - " def isEqual(self,c2): #return 1 if cards equal\n", - " \n", - " if self.__number == c2.__number and self.__suit == c2.__suit:\n", - " return 1\n", - " else:\n", - " return 0\n", - "\n", - "\n", - "#define various cards\n", - "temp = card()\n", - "chosen = card()\n", - "prize = card()\n", - "\n", - "\n", - "#define and initialize card1\n", - "card1 = card(7,clubs)\n", - "print 'card 1 is the',\n", - "card1.display() #display card1\n", - "\n", - "#define and initialize card2\n", - "card2 = card(jack,hearts)\n", - "print 'card 2 is the',\n", - "card2.display() #display card2\n", - "\n", - "#define and initialize card3\n", - "card3 = card(ace,spades)\n", - "print 'card 3 is the',\n", - "card3.display() #display card3\n", - "\n", - "\n", - "#prize is the card to guess\n", - "prize = card3\n", - "\n", - "\n", - "#swapping cards\n", - "print 'I\\'m swapping card 1 and card 3'\n", - "temp = card3\n", - "card3 = card1\n", - "card1 = temp\n", - "\n", - "print 'I\\'m swapping card 2 and card 3'\n", - "temp = card2\n", - "card3 = card2\n", - "card2 = temp\n", - "\n", - "print 'I\\'m swapping card 1 and card 2'\n", - "temp = card2\n", - "card2 = card1\n", - "card1 = temp\n", - "\n", - "print 'Now, where (1,2, or 3) is the',\n", - "prize.display() #display prize\n", - "print '?'\n", - "\n", - "position = input() #get user's guess of position\n", - "\n", - "\n", - "#set chosen to user's choice \n", - "if position == 1:\n", - " chosen = card1\n", - "elif position == 2:\n", - " chosen = card2\n", - "else:\n", - " chosen = card3\n", - "\n", - "#is chosen card the prize?\n", - "\n", - "x=chosen.isEqual(prize)\n", - "\n", - "if x==1:\n", - " print 'That\\'s right! You win!'\n", - "else:\n", - " print 'Sorry. You lose.'\n", - "\n", - "print 'You choose the',\n", - "\n", - "#display chosen card\n", - "chosen.display()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "card 1 is the 7 of clubs\n", - "card 2 is the jack of hearts\n", - "card 3 is the ace of spades\n", - "I'm swapping card 1 and card 3\n", - "I'm swapping card 2 and card 3\n", - "I'm swapping card 1 and card 2\n", - "Now, where (1,2, or 3) is the ace of spades\n", - "?\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "That's right! You win!\n", - "You choose the ace of spades\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.11, Page Number: 249" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class foo: \n", - " \n", - " __count = 0 #only one data item for all objects\n", - " \n", - " def __init__(self):\n", - " foo.__count = foo.__count + 1 #increment count when object created\n", - " \n", - " def getcount(self): #returns count\n", - " return foo.__count\n", - "\n", - "#create three objecs\n", - "f1 = foo()\n", - "f2 = foo()\n", - "f3 = foo()\n", - "\n", - "#Each object displays the same count value\n", - "print 'count is', f1.getcount()\n", - "print 'count is', f2.getcount()\n", - "print 'count is', f3.getcount()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "count is 3\n", - "count is 3\n", - "count is 3\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.12, Page Number: 253" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Distance: #Distance class\n", - " \n", - " def __init__(self,ft=0,inc=0.0): #constructor \n", - " self.__feet = ft\n", - " self.__inches = inc\n", - " \n", - " def getdist(self): #get length from user\n", - " self.__feet = input('Enter feet:')\n", - " self.__inches = input('Enter inches:')\n", - " \n", - " def showdist(self): #display distance\n", - " print self.__feet , '\\' -' , self.__inches , '\\\"'\n", - "\n", - "#There's no const keyword \n", - " \n", - " def add_dist(self,d2): #add this length to d2 and return object\n", - " \n", - " temp = Distance()\n", - " temp.__inches = self.__inches + d2.__inches\n", - " \n", - " if temp.__inches >= 12.0:\n", - " temp.__inches = temp.__inches - 12.0\n", - " temp.__feet = 1\n", - " \n", - " temp.__feet = temp.__feet + self.__feet + d2.__feet\n", - " \n", - " return temp #return sum as object\n", - " \n", - "dist1 = Distance()\n", - "dist3 = Distance()\n", - "dist2 = Distance(11,6.25)\n", - "\n", - "dist1.getdist()\n", - "\n", - "dist3 = dist1.add_dist(dist2)\n", - "\n", - "print 'dist1 = ',\n", - "dist1.showdist()\n", - "print 'dist2 = ',\n", - "dist2.showdist()\n", - "print 'dist3 = ',\n", - "dist3.showdist()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter feet:17\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter inches:5.75\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "dist1 = 17 ' - 5.75 \"\n", - "dist2 = 11 ' - 6.25 \"\n", - "dist3 = 29 ' - 0.0 \"\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 6.13, Page Number: 255" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Distance:\n", - " \n", - " def __init__(self,ft,inc):\n", - " self.__feet = ft\n", - " self.__inches = inc\n", - " \n", - " def getdist(self):\n", - " self.__feet = input('Enter feet:')\n", - " self.__inches = input('Enter inches:')\n", - " \n", - " def showdist(self):\n", - " print self.__feet , '\\' -' , self.__inches , '\\\"'\n", - "\n", - "football = Distance(300,0)\n", - "\n", - "print 'football = ',\n", - "football.showdist()\n", - "\n", - "#There's no const keyword in python" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "football = 300 ' - 0 \"\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/AnaySonawane/Solid_State.ipynb b/sample_notebooks/AnaySonawane/Solid_State.ipynb new file mode 100755 index 00000000..1839cfe8 --- /dev/null +++ b/sample_notebooks/AnaySonawane/Solid_State.ipynb @@ -0,0 +1,971 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 1 : Introduction to Solid State Electronics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.1, Page No. 17" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# ne in the doped silicon\n", + "\n", + "import math\n", + "#Variable declaration\n", + "ni=1.5*10**16 # in m^-3\n", + "nh=4.5*10**22 # in m^-3\n", + "\n", + "#Calculations\n", + "ne=ni**2/nh\n", + "\n", + "#Result\n", + "print(\" ne in the doped silicon is,(m^-3) = %.f * 10^9\"%(ne/10**9))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " ne in the doped silicon is,(m^-3) = 5 * 10^9\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.2, Page No. 17" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# resistivity\n", + "\n", + "import math\n", + "#Variable declaration\n", + "\n", + "ne=8.0*10**19 # in m^-3\n", + "nh=5.0*10**18 # in m^-3\n", + "mu_e=2.3 # in m^2/V-s\n", + "mu_h=.01 # in m^2/V-s\n", + "e=1.6*10**-19 # in V\n", + "\n", + "#Calculations\n", + "p=1/(e*((ne*mu_e)+(nh*mu_h)));\n", + "\n", + "#Result\n", + "print(\"(b) the resistivity,p(ohm-m)= %.1f * 10^-2\"%(p*10**2))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(b) the resistivity,p(ohm-m)= 3.4 * 10^-2\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.3, Page No. 17" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Density\n", + "\n", + "import math\n", + "#Variable declaration\n", + "\n", + "sigma=500.0 # in ohm^-1 m^-1\n", + "mu_e=0.39 # m^2/V-s\n", + "e=1.6*10**-19 # in V\n", + "\n", + "#Calculations\n", + "ne=sigma/(e*mu_e);\n", + "\n", + "#Result\n", + "print(\"number density of donor,ne(m^-3) = %.2f * 10^21\"%(ne*10**-21))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "number density of donor,ne(m^-3) = 8.01 * 10^21\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.4, Page No. 18" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Density\n", + "\n", + "import math\n", + "#Variable declaration\n", + "\n", + "e=1.6*10**-19 # in V\n", + "Pp=10**-2 # p-type silicon in ohm-m\n", + "Pn=10**-2 # n-type silicon in ohm-m\n", + "mu_p=0.048 # holes mobilities in m^2/V-s\n", + "mu_n=0.135 # electrons mobilities in m^2/V-s\n", + "\n", + "#Calculations\n", + "Na=1/(e*mu_p*Pp);\n", + "Nd=1/(e*mu_n*Pn);\n", + "\n", + "#Result\n", + "print(\"(i). the density of impurity,Na (m^-3) = %.1f * 10^22\"%(Na*10**-22))\n", + "print(\"(ii). the density of impurity,Nd (m^-3) = %.2f * 10^21\"%(Nd*10**-21))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i). the density of impurity,Na (m^-3) = 1.3 * 10^22\n", + "(ii). the density of impurity,Nd (m^-3) = 4.63 * 10^21\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.5, Page No. 18" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Resistivity\n", + "\n", + "import math\n", + "#Variable declaration\n", + "e=1.6*10**-19 # in V\n", + "n=2.5*10**19 # m^3\n", + "p=n\n", + "ni=n\n", + "mu_p=0.17 # holes mobilities in m^2/V-s\n", + "mu_n=0.36 # electrons mobilities in m^2/V-s\n", + "\n", + "#Calculations\n", + "sgint=e*(ni*(mu_p+mu_n)) #electrical conductivity in mho/metre\n", + "pint=1/sgint #resistivity in ohm-meter\n", + "print(\"electrical conductivity is ,(mho/metre)= %.2f\"%sgint)\n", + "print(\"resistivity is ,(ohm-metre)= %.2f\"%pint)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "electrical conductivity is ,(mho/metre)= 2.12\n", + "resistivity is ,(ohm-metre)= 0.47\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.6, Page No. 18" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Conductivity\n", + "\n", + "import math\n", + "#Variable declaration\n", + "\n", + "e=1.6*10**-19 # in V\n", + "ni=1.5*10**16 # in m^3\n", + "mu_p=0.13 # holes mobilities in m^2/V-s\n", + "mu_n=0.05 # electrons mobilities in m^2/V-s\n", + "siat=10.0**8 # number of silicon atoms\n", + "ta=5.0*10**28 # silicon atoms in atoms/m^3\n", + "mu_n2=0.13 # electrons mobilities in m^2/V-s\n", + "siat2=10.0**8 # number of silicon atoms\n", + "ta2=5.0*10**28 # silicon atoms in atoms/m^3\n", + "mu_p2=0.05 # holes mobilities in m^2/V-s\n", + "\n", + "#Calculations\n", + "sgint=e*(ni*(mu_p+mu_n)) # electrical conductivity in mho/m\n", + "Nd=ta/siat # in atoms/m^3\n", + "p= ni**2/Nd # holes concentration in holes/m^3\n", + "n=Nd\n", + "sntype=e*n*mu_n2 # in mho/m\n", + "Na=ta2/siat2 # in atoms/m^3\n", + "n= ni**2/Na # holes concentration in holes/m^3\n", + "sptype=e*Na*mu_p2 # in mho/m\n", + "\n", + "#Calculations\n", + "print(\"(i) electrical conductivity is ,(mhos/m) = %.2f * 10^-4\"%(sgint*10**4))\n", + "print(\"(ii) holes concentration is, (holes/m^3) = %.1f *10^11\"%(p*10**-11))\n", + "print(\"(ii) conductivity is ,(mho/m) = %.1f\"%sntype)\n", + "print(\"(iii) electron concentration is, (holes/m^3)= %.1f * 10^11\"%(n/10**11))\n", + "print(\"(iii) conductivity is ,(mho/m) = %.1f\"%sptype)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) electrical conductivity is ,(mhos/m) = 4.32 * 10^-4\n", + "(ii) holes concentration is, (holes/m^3) = 4.5 *10^11\n", + "(ii) conductivity is ,(mho/m) = 10.4\n", + "(iii) electron concentration is, (holes/m^3)= 4.5 * 10^11\n", + "(iii) conductivity is ,(mho/m) = 4.0\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.7, Page No. 19" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Fermi Level\n", + "\n", + "import math\n", + "#Variable declaration\n", + "#Nd1=Nc*exp^-(Ec-Ef1)/kT ...Formula Used\n", + "Nc=1.0 #assume\n", + "kT=0.03 #eV\n", + "EcEf1=0.5 #position of Fermi level in V\n", + "Nd=1.0 #assume\n", + "Nd1=3*Nd #After tripling the donor concentration\n", + "\n", + "#Calculation\n", + "EcEf2=(EcEf1-(kT*(math.log(Nd1/Nd))))\n", + "print(\"new position of Fermi-level is %.3f eV below conduction band\"%(math.ceil(EcEf2*1000)/1000))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "new position of Fermi-level is 0.468 eV below conduction band\n" + ] + } + ], + "prompt_number": 37 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.8, Page No. 20" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# density\n", + "\n", + "import math\n", + "#Variable declaration\n", + "e=1.6*10**-19 # in V\n", + "Pp=10**-1 # p-type silicon in ohm-m\n", + "Pn=10**-1 # n-type silicon in ohm-m\n", + "mu_h=0.05 # holes mobilities in m^2/V-s\n", + "mu_e=0.13 # electrons mobilities in m^2/V-s\n", + "\n", + "#Calculations\n", + "Na=1/(e*mu_h*Pp);\n", + "Nd=1/(e*mu_e*Pn);\n", + "\n", + "#Result\n", + "print(\"(i). the density of impurity,Na (m^-3) = %.2f * 10^21\"%(Na/10**21))\n", + "print(\"(ii). the density of impurity,Nd (m^-3) = %.1f * 10^20\"%(Nd/10**20))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i). the density of impurity,Na (m^-3) = 1.25 * 10^21\n", + "(ii). the density of impurity,Nd (m^-3) = 4.8 * 10^20\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9, Page No. 20" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# current\n", + "\n", + "import math\n", + "#Variable declaration\n", + "e=1.6*10**-19 # in V\n", + "Pp=10**-1 # p-type silicon in ohm-m\n", + "Pn=10**-1 # n-type silicon in ohm-m\n", + "mu_hsi=0.048 # holes mobilities in m^2/V-s\n", + "mu_esi=0.135 # electrons mobilities in m^2/V-s\n", + "nisi=1.5*10**16 # in m^-3\n", + "nesi=nisi\n", + "nhsi=nisi\n", + "mu_hge=0.19 # holes mobilities in m^2/V-s\n", + "mu_ege=0.39 # electrons mobilities in m^2/V-s\n", + "A=1*10**-4 # area in m^2\n", + "nige=2.4*10**19 # in m^-3\n", + "V=2.0 # in V\n", + "l=0.1 # in m\n", + "\n", + "#Calculations\n", + "Isi= e*A*(V/l)*((nesi*mu_esi)+(nhsi*mu_hsi))\n", + "#Current for silicon is calculated wrong in the textbook\n", + "nege=nige\n", + "nhge=nige\n", + "Ige= e*A*(V/l)*((nege*mu_ege)+(nhge*mu_hge))\n", + "\n", + "#Result\n", + "print(\"Total current for silicon is,(A) = %f\"%Isi)\n", + "print(\"Total current for germanium is,(A)= %.2f * 10^-3\"%(math.ceil(Ige*10**5)/100))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total current for silicon is,(A) = 0.000001\n", + "Total current for germanium is,(A)= 4.46 * 10^-3\n" + ] + } + ], + "prompt_number": 41 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.10, Page No. 21" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# hole concentration and conductivity\n", + "\n", + "import math\n", + "#Variable declaration\n", + "nh=2*10**21 # acceptor atoms in atoms/m^3\n", + "mu_h=0.17 # mobility of holes in m^2/V-s\n", + "e=1.6*10**-19 # in C\n", + "\n", + "#Calculations\n", + "Na=nh\n", + "sigma=nh*mu_h*e;\n", + "\n", + "#Result\n", + "print(\"hole concentration,Na(atoms/m^3) = %.1f * 10^21\"%(Na/10**21))\n", + "print(\"conductivity,(ohm^-1-m^-1) = %.1f\"%sigma)\n", + "#conductivity is calculated wrong in the book" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "hole concentration,Na(atoms/m^3) = 2.0 * 10^21\n", + "conductivity,(ohm^-1-m^-1) = 54.4\n" + ] + } + ], + "prompt_number": 42 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.11, Page No. 22" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# donor concentration\n", + "\n", + "import math\n", + "#Variable declaration\n", + "p=0.15 # in ohm-m\n", + "mu_e=0.39 # mobility of electron in m^2/V-s\n", + "e=1.6*10**-19 # in C\n", + "\n", + "#Calculations\n", + "Na=1/(e*mu_e*p);\n", + "\n", + "#Result\n", + "print(\"The value of donor concentration,Na(m^-3) = %.2f * 10^20\"%(Na/10**20))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of donor concentration,Na(m^-3) = 1.07 * 10^20\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.12, Page No. 12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# resistivity\n", + "\n", + "import math\n", + "#Variable declaration\n", + "mu_n=0.13 # in m^2/V-s\n", + "mu_p=0.05 # in m^2/V-s\n", + "ni=1.5*10**16 # in m^-3\n", + "e=1.6*10**-19 # in C\n", + "\n", + "#Calculations\n", + "p=1/((e*ni)*(mu_n+mu_p));\n", + "\n", + "#Result\n", + "print(\"The resistivity,p(ohm-m) = %.1f\"%p)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The resistivity,p(ohm-m) = 2314.8\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.13, Page No. 37" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# current\n", + "\n", + "import math\n", + "#Variable declaration\n", + "e=1.6*10**-19 # electron charge in coulombs\n", + "k=1.38*10**-23 # Boltzmann constant in m^2-kg/s^2-K^-1\n", + "T=300.0 # in Kelvin\n", + "I=240.0 # in mA\n", + "eta=2.0\n", + "Ve=0.8 # in V\n", + "V=0.7 # in V\n", + "\n", + "\n", + "#Calculations\n", + "Vt=(k*T)/e # in V\n", + "Id=I*math.e**((V-Ve)/(eta*Vt)) #in mA\n", + "Ir=(I/((math.e**(Ve/(eta*Vt)))-1))*10**6\n", + "\n", + "\n", + "#Result\n", + "print(\"(i) Current is ,(mA) = %.f\"%(round(Id)))\n", + "print(\"(ii) reverse saturation current is ,(nA) = %.f\"%(round(Ir)))\n", + "#reverse saturation current is calculated wrong in the textbook" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Current is ,(mA) = 35\n", + "(ii) reverse saturation current is ,(nA) = 46\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.14, Page No. 38" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# diode current and voltage\n", + "\n", + "import math\n", + "#Variable declaration\n", + "e=1.6*10**-19 # electron charge in coulombs\n", + "k=1.38*10**-23 # Boltzmann constant in m^2-kg/s^2-K^-1\n", + "T=300.0 # in Kelvin\n", + "Ir1=10**-10 # in A\n", + "Ir2=10**-12 # in A \n", + "V211=0.5 # in V\n", + "\n", + "#Calculations\n", + "Vt=(k*T)/e\n", + "Vt = math.ceil(Vt*1000)/1000\n", + "V21=((Vt)*math.log10(Ir1/Ir2))*2.3026\n", + "V21 = math.floor(V21*10000)/10000\n", + "V2=(1.0/2)*(V21+V211)\n", + "V1=(1.0/2)*(V211-V21)\n", + "I1=Ir2*math.e**(V2/Vt)*10**6\n", + "I2=I1\n", + "\n", + "#Result\n", + "print(\"diode voltage V2 is ,(V) = %.5f\"%V2)\n", + "print(\"diode voltage V1 is ,(V) = %.5f\"%V1)\n", + "print(\"diode current is,(micro-A) = %.4f\"%I1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "diode voltage V2 is ,(V) = 0.30985\n", + "diode voltage V1 is ,(V) = 0.19015\n", + "diode current is,(micro-A) = 0.1498\n" + ] + } + ], + "prompt_number": 50 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.15, Page No. 39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# voltage\n", + "\n", + "import math\n", + "#Variable declaration\n", + "e=1.6*10**-19 # electron charge in coulombs\n", + "k=1.38*10**-23 # Boltzmann constant in m^2-kg/s^2-K^-1\n", + "T=300.0 # in Kelvin\n", + "Ir1=10**-12 # in A\n", + "Ir2=10**-10 # in A\n", + "It=2.0 # mA\n", + "\n", + "#Calculations\n", + "I21=Ir2/Ir1\n", + "Vt=(k*T)/e # in V\n", + "Vt = math.ceil(Vt*1000)/1000\n", + "I1=It/(1+I21)*10**3 # in micro-A\n", + "I2=It*10**3-I1 # in micro-A\n", + "I1=I2/I21 # in micro-A\n", + "x=((I1*10**-6)/Ir1)\n", + "V=Vt*math.log10(x)*2.3026\n", + "\n", + "#Result\n", + "print(\"diode voltage is ,(V) = %.3f\"%V)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "diode voltage is ,(V) = 0.437\n" + ] + } + ], + "prompt_number": 53 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.16, Page No. 39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# voltage\n", + "\n", + "import math\n", + "#Variable declaration\n", + "T=27.0 # degree Celsius\n", + "Tk=273+T # in Kelvin\n", + "e=1.6*10**-19 # electron charge in coulombs\n", + "k=1.38*10**-23 # Boltzmann constant in m^2-kg/s^2-K^-1\n", + "J=10**4 # in Amp/m^2\n", + "Jo=200.0 #in mA/m^2\n", + "\n", + "#Calculations\n", + "x=(J/(Jo*10**-3))\n", + "Ve=((math.log(x))*k*Tk)/e\n", + "\n", + "#Result\n", + "print(\"voltage to be applied is ,(V) = %.2f\"%Ve)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "voltage to be applied is ,(V) = 0.28\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.17, Page No. 40" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# resistance\n", + "\n", + "import math\n", + "#Variable declaration\n", + "V=3.0 # in V\n", + "I=55.0 # in mA\n", + "V2=26.0 # in mV\n", + "\n", + "\n", + "#Calculations\n", + "Rdc=V/(I*10**-3) # in ohm\n", + "Rac=V2/I # in ohm\n", + "\n", + "#Result\n", + "print(\"static resistance is ,(ohm) = %.1f\"%Rdc)\n", + "print(\"dynamic resistance is ,(ohm) = %.2f\"%Rac)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "static resistance is ,(ohm) = 54.5\n", + "dynamic resistance is ,(ohm) = 0.47\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.18, Page No. 40" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# resistance\n", + "\n", + "import math\n", + "#Variable declaration\n", + "k=1.38*10**-23 # constant\n", + "T=27+273.0 # in K\n", + "eta=2.0\n", + "e=1.6*10**-19 # in C\n", + "Vt=(k*T/e) # in V\n", + "V=0.5 # in V\n", + "Ir=10**-6 # in A\n", + "\n", + "#Calculations\n", + "I=(Ir*10**3*(math.e**(V/(eta*Vt))-1))\n", + "R_dc=V*10**3/I;\n", + "R_ac=(eta*k*T)/(e*I*10**-3);\n", + "\n", + "#Result\n", + "print(\"static resistance,R_dc(ohm) = %.1f\"%R_dc)\n", + "print(\"Dynamic resistance,R_ac(ohm) = %.1f\"%R_ac)\n", + "#answer is wrong in textbook" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "static resistance,R_dc(ohm) = 31.8\n", + "Dynamic resistance,R_ac(ohm) = 3.3\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.19, Page No. 40" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# resistance\n", + "\n", + "import math\n", + "#Variable declaration\n", + "V=1.2 # in V\n", + "Vk=0.7 # in V\n", + "I_F=100.0 # in mA\n", + "V_R=10.0 # in V\n", + "I_R=1.0 # in micro-A\n", + "I=5.0 # in mA\n", + "eta=2\n", + "\n", + "#Calculations\n", + "R_B=(V-Vk)/(I_F*10**-3)\n", + "R_R=V_R/I_R\n", + "R_ac=eta*26/I\n", + "\n", + "#Result\n", + "print(\"the bulk resistance,R_B(ohm) = %.f\"%R_B)\n", + "print(\"the reverse resistance,R_R(M-ohm) = %.f\"%R_R)\n", + "print(\"ac resistance,R_ac(ohm) = %.1f\"%R_ac)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the bulk resistance,R_B(ohm) = 5\n", + "the reverse resistance,R_R(M-ohm) = 10\n", + "ac resistance,R_ac(ohm) = 10.4\n" + ] + } + ], + "prompt_number": 54 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.20, Page No. 41" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# capacitance\n", + "\n", + "import math\n", + "#Variable declaration\n", + "epsilon_0=8.85*10**-12 # in farada/m\n", + "K=12.0 # constant for silicon\n", + "A=1*10**-8 # in m^2\n", + "W=5*10**-7 # in m\n", + "\n", + "#Calculations\n", + "epsilon=epsilon_0*K\n", + "Ct=epsilon*A*10**14/W;\n", + "\n", + "#Result\n", + "print(\"the transition capacitance,Ct(PF) = %.1f\"%Ct)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the transition capacitance,Ct(PF) = 212.4\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.21, Page No. 41" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# resistance\n", + "\n", + "import math\n", + "#Variable declaration\n", + "V=0.2 # in V\n", + "I=1.0 # in micro-A\n", + "\n", + "#Calculations\n", + "R_dc=V*10**3/I\n", + "R_ac=26/(I*10**3);\n", + "\n", + "#Result\n", + "print(\"The static resistance,R_ac(k-ohm) = %.f\"%R_dc)\n", + "print(\"the dynamic resistance,R_ac(ohm) = %.3f\"%R_ac)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The static resistance,R_ac(k-ohm) = 200\n", + "the dynamic resistance,R_ac(ohm) = 0.026\n" + ] + } + ], + "prompt_number": 55 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/AnaySonawane/Solid_State_electronics.ipynb b/sample_notebooks/AnaySonawane/Solid_State_electronics.ipynb deleted file mode 100755 index 1839cfe8..00000000 --- a/sample_notebooks/AnaySonawane/Solid_State_electronics.ipynb +++ /dev/null @@ -1,971 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 1 : Introduction to Solid State Electronics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.1, Page No. 17" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# ne in the doped silicon\n", - "\n", - "import math\n", - "#Variable declaration\n", - "ni=1.5*10**16 # in m^-3\n", - "nh=4.5*10**22 # in m^-3\n", - "\n", - "#Calculations\n", - "ne=ni**2/nh\n", - "\n", - "#Result\n", - "print(\" ne in the doped silicon is,(m^-3) = %.f * 10^9\"%(ne/10**9))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " ne in the doped silicon is,(m^-3) = 5 * 10^9\n" - ] - } - ], - "prompt_number": 24 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.2, Page No. 17" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# resistivity\n", - "\n", - "import math\n", - "#Variable declaration\n", - "\n", - "ne=8.0*10**19 # in m^-3\n", - "nh=5.0*10**18 # in m^-3\n", - "mu_e=2.3 # in m^2/V-s\n", - "mu_h=.01 # in m^2/V-s\n", - "e=1.6*10**-19 # in V\n", - "\n", - "#Calculations\n", - "p=1/(e*((ne*mu_e)+(nh*mu_h)));\n", - "\n", - "#Result\n", - "print(\"(b) the resistivity,p(ohm-m)= %.1f * 10^-2\"%(p*10**2))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(b) the resistivity,p(ohm-m)= 3.4 * 10^-2\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.3, Page No. 17" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Density\n", - "\n", - "import math\n", - "#Variable declaration\n", - "\n", - "sigma=500.0 # in ohm^-1 m^-1\n", - "mu_e=0.39 # m^2/V-s\n", - "e=1.6*10**-19 # in V\n", - "\n", - "#Calculations\n", - "ne=sigma/(e*mu_e);\n", - "\n", - "#Result\n", - "print(\"number density of donor,ne(m^-3) = %.2f * 10^21\"%(ne*10**-21))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "number density of donor,ne(m^-3) = 8.01 * 10^21\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.4, Page No. 18" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Density\n", - "\n", - "import math\n", - "#Variable declaration\n", - "\n", - "e=1.6*10**-19 # in V\n", - "Pp=10**-2 # p-type silicon in ohm-m\n", - "Pn=10**-2 # n-type silicon in ohm-m\n", - "mu_p=0.048 # holes mobilities in m^2/V-s\n", - "mu_n=0.135 # electrons mobilities in m^2/V-s\n", - "\n", - "#Calculations\n", - "Na=1/(e*mu_p*Pp);\n", - "Nd=1/(e*mu_n*Pn);\n", - "\n", - "#Result\n", - "print(\"(i). the density of impurity,Na (m^-3) = %.1f * 10^22\"%(Na*10**-22))\n", - "print(\"(ii). the density of impurity,Nd (m^-3) = %.2f * 10^21\"%(Nd*10**-21))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(i). the density of impurity,Na (m^-3) = 1.3 * 10^22\n", - "(ii). the density of impurity,Nd (m^-3) = 4.63 * 10^21\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.5, Page No. 18" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Resistivity\n", - "\n", - "import math\n", - "#Variable declaration\n", - "e=1.6*10**-19 # in V\n", - "n=2.5*10**19 # m^3\n", - "p=n\n", - "ni=n\n", - "mu_p=0.17 # holes mobilities in m^2/V-s\n", - "mu_n=0.36 # electrons mobilities in m^2/V-s\n", - "\n", - "#Calculations\n", - "sgint=e*(ni*(mu_p+mu_n)) #electrical conductivity in mho/metre\n", - "pint=1/sgint #resistivity in ohm-meter\n", - "print(\"electrical conductivity is ,(mho/metre)= %.2f\"%sgint)\n", - "print(\"resistivity is ,(ohm-metre)= %.2f\"%pint)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "electrical conductivity is ,(mho/metre)= 2.12\n", - "resistivity is ,(ohm-metre)= 0.47\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.6, Page No. 18" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Conductivity\n", - "\n", - "import math\n", - "#Variable declaration\n", - "\n", - "e=1.6*10**-19 # in V\n", - "ni=1.5*10**16 # in m^3\n", - "mu_p=0.13 # holes mobilities in m^2/V-s\n", - "mu_n=0.05 # electrons mobilities in m^2/V-s\n", - "siat=10.0**8 # number of silicon atoms\n", - "ta=5.0*10**28 # silicon atoms in atoms/m^3\n", - "mu_n2=0.13 # electrons mobilities in m^2/V-s\n", - "siat2=10.0**8 # number of silicon atoms\n", - "ta2=5.0*10**28 # silicon atoms in atoms/m^3\n", - "mu_p2=0.05 # holes mobilities in m^2/V-s\n", - "\n", - "#Calculations\n", - "sgint=e*(ni*(mu_p+mu_n)) # electrical conductivity in mho/m\n", - "Nd=ta/siat # in atoms/m^3\n", - "p= ni**2/Nd # holes concentration in holes/m^3\n", - "n=Nd\n", - "sntype=e*n*mu_n2 # in mho/m\n", - "Na=ta2/siat2 # in atoms/m^3\n", - "n= ni**2/Na # holes concentration in holes/m^3\n", - "sptype=e*Na*mu_p2 # in mho/m\n", - "\n", - "#Calculations\n", - "print(\"(i) electrical conductivity is ,(mhos/m) = %.2f * 10^-4\"%(sgint*10**4))\n", - "print(\"(ii) holes concentration is, (holes/m^3) = %.1f *10^11\"%(p*10**-11))\n", - "print(\"(ii) conductivity is ,(mho/m) = %.1f\"%sntype)\n", - "print(\"(iii) electron concentration is, (holes/m^3)= %.1f * 10^11\"%(n/10**11))\n", - "print(\"(iii) conductivity is ,(mho/m) = %.1f\"%sptype)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(i) electrical conductivity is ,(mhos/m) = 4.32 * 10^-4\n", - "(ii) holes concentration is, (holes/m^3) = 4.5 *10^11\n", - "(ii) conductivity is ,(mho/m) = 10.4\n", - "(iii) electron concentration is, (holes/m^3)= 4.5 * 10^11\n", - "(iii) conductivity is ,(mho/m) = 4.0\n" - ] - } - ], - "prompt_number": 34 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.7, Page No. 19" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Fermi Level\n", - "\n", - "import math\n", - "#Variable declaration\n", - "#Nd1=Nc*exp^-(Ec-Ef1)/kT ...Formula Used\n", - "Nc=1.0 #assume\n", - "kT=0.03 #eV\n", - "EcEf1=0.5 #position of Fermi level in V\n", - "Nd=1.0 #assume\n", - "Nd1=3*Nd #After tripling the donor concentration\n", - "\n", - "#Calculation\n", - "EcEf2=(EcEf1-(kT*(math.log(Nd1/Nd))))\n", - "print(\"new position of Fermi-level is %.3f eV below conduction band\"%(math.ceil(EcEf2*1000)/1000))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "new position of Fermi-level is 0.468 eV below conduction band\n" - ] - } - ], - "prompt_number": 37 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.8, Page No. 20" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# density\n", - "\n", - "import math\n", - "#Variable declaration\n", - "e=1.6*10**-19 # in V\n", - "Pp=10**-1 # p-type silicon in ohm-m\n", - "Pn=10**-1 # n-type silicon in ohm-m\n", - "mu_h=0.05 # holes mobilities in m^2/V-s\n", - "mu_e=0.13 # electrons mobilities in m^2/V-s\n", - "\n", - "#Calculations\n", - "Na=1/(e*mu_h*Pp);\n", - "Nd=1/(e*mu_e*Pn);\n", - "\n", - "#Result\n", - "print(\"(i). the density of impurity,Na (m^-3) = %.2f * 10^21\"%(Na/10**21))\n", - "print(\"(ii). the density of impurity,Nd (m^-3) = %.1f * 10^20\"%(Nd/10**20))\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(i). the density of impurity,Na (m^-3) = 1.25 * 10^21\n", - "(ii). the density of impurity,Nd (m^-3) = 4.8 * 10^20\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9, Page No. 20" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# current\n", - "\n", - "import math\n", - "#Variable declaration\n", - "e=1.6*10**-19 # in V\n", - "Pp=10**-1 # p-type silicon in ohm-m\n", - "Pn=10**-1 # n-type silicon in ohm-m\n", - "mu_hsi=0.048 # holes mobilities in m^2/V-s\n", - "mu_esi=0.135 # electrons mobilities in m^2/V-s\n", - "nisi=1.5*10**16 # in m^-3\n", - "nesi=nisi\n", - "nhsi=nisi\n", - "mu_hge=0.19 # holes mobilities in m^2/V-s\n", - "mu_ege=0.39 # electrons mobilities in m^2/V-s\n", - "A=1*10**-4 # area in m^2\n", - "nige=2.4*10**19 # in m^-3\n", - "V=2.0 # in V\n", - "l=0.1 # in m\n", - "\n", - "#Calculations\n", - "Isi= e*A*(V/l)*((nesi*mu_esi)+(nhsi*mu_hsi))\n", - "#Current for silicon is calculated wrong in the textbook\n", - "nege=nige\n", - "nhge=nige\n", - "Ige= e*A*(V/l)*((nege*mu_ege)+(nhge*mu_hge))\n", - "\n", - "#Result\n", - "print(\"Total current for silicon is,(A) = %f\"%Isi)\n", - "print(\"Total current for germanium is,(A)= %.2f * 10^-3\"%(math.ceil(Ige*10**5)/100))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total current for silicon is,(A) = 0.000001\n", - "Total current for germanium is,(A)= 4.46 * 10^-3\n" - ] - } - ], - "prompt_number": 41 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.10, Page No. 21" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# hole concentration and conductivity\n", - "\n", - "import math\n", - "#Variable declaration\n", - "nh=2*10**21 # acceptor atoms in atoms/m^3\n", - "mu_h=0.17 # mobility of holes in m^2/V-s\n", - "e=1.6*10**-19 # in C\n", - "\n", - "#Calculations\n", - "Na=nh\n", - "sigma=nh*mu_h*e;\n", - "\n", - "#Result\n", - "print(\"hole concentration,Na(atoms/m^3) = %.1f * 10^21\"%(Na/10**21))\n", - "print(\"conductivity,(ohm^-1-m^-1) = %.1f\"%sigma)\n", - "#conductivity is calculated wrong in the book" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "hole concentration,Na(atoms/m^3) = 2.0 * 10^21\n", - "conductivity,(ohm^-1-m^-1) = 54.4\n" - ] - } - ], - "prompt_number": 42 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.11, Page No. 22" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# donor concentration\n", - "\n", - "import math\n", - "#Variable declaration\n", - "p=0.15 # in ohm-m\n", - "mu_e=0.39 # mobility of electron in m^2/V-s\n", - "e=1.6*10**-19 # in C\n", - "\n", - "#Calculations\n", - "Na=1/(e*mu_e*p);\n", - "\n", - "#Result\n", - "print(\"The value of donor concentration,Na(m^-3) = %.2f * 10^20\"%(Na/10**20))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The value of donor concentration,Na(m^-3) = 1.07 * 10^20\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.12, Page No. 12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# resistivity\n", - "\n", - "import math\n", - "#Variable declaration\n", - "mu_n=0.13 # in m^2/V-s\n", - "mu_p=0.05 # in m^2/V-s\n", - "ni=1.5*10**16 # in m^-3\n", - "e=1.6*10**-19 # in C\n", - "\n", - "#Calculations\n", - "p=1/((e*ni)*(mu_n+mu_p));\n", - "\n", - "#Result\n", - "print(\"The resistivity,p(ohm-m) = %.1f\"%p)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The resistivity,p(ohm-m) = 2314.8\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.13, Page No. 37" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# current\n", - "\n", - "import math\n", - "#Variable declaration\n", - "e=1.6*10**-19 # electron charge in coulombs\n", - "k=1.38*10**-23 # Boltzmann constant in m^2-kg/s^2-K^-1\n", - "T=300.0 # in Kelvin\n", - "I=240.0 # in mA\n", - "eta=2.0\n", - "Ve=0.8 # in V\n", - "V=0.7 # in V\n", - "\n", - "\n", - "#Calculations\n", - "Vt=(k*T)/e # in V\n", - "Id=I*math.e**((V-Ve)/(eta*Vt)) #in mA\n", - "Ir=(I/((math.e**(Ve/(eta*Vt)))-1))*10**6\n", - "\n", - "\n", - "#Result\n", - "print(\"(i) Current is ,(mA) = %.f\"%(round(Id)))\n", - "print(\"(ii) reverse saturation current is ,(nA) = %.f\"%(round(Ir)))\n", - "#reverse saturation current is calculated wrong in the textbook" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(i) Current is ,(mA) = 35\n", - "(ii) reverse saturation current is ,(nA) = 46\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.14, Page No. 38" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# diode current and voltage\n", - "\n", - "import math\n", - "#Variable declaration\n", - "e=1.6*10**-19 # electron charge in coulombs\n", - "k=1.38*10**-23 # Boltzmann constant in m^2-kg/s^2-K^-1\n", - "T=300.0 # in Kelvin\n", - "Ir1=10**-10 # in A\n", - "Ir2=10**-12 # in A \n", - "V211=0.5 # in V\n", - "\n", - "#Calculations\n", - "Vt=(k*T)/e\n", - "Vt = math.ceil(Vt*1000)/1000\n", - "V21=((Vt)*math.log10(Ir1/Ir2))*2.3026\n", - "V21 = math.floor(V21*10000)/10000\n", - "V2=(1.0/2)*(V21+V211)\n", - "V1=(1.0/2)*(V211-V21)\n", - "I1=Ir2*math.e**(V2/Vt)*10**6\n", - "I2=I1\n", - "\n", - "#Result\n", - "print(\"diode voltage V2 is ,(V) = %.5f\"%V2)\n", - "print(\"diode voltage V1 is ,(V) = %.5f\"%V1)\n", - "print(\"diode current is,(micro-A) = %.4f\"%I1)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "diode voltage V2 is ,(V) = 0.30985\n", - "diode voltage V1 is ,(V) = 0.19015\n", - "diode current is,(micro-A) = 0.1498\n" - ] - } - ], - "prompt_number": 50 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.15, Page No. 39" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# voltage\n", - "\n", - "import math\n", - "#Variable declaration\n", - "e=1.6*10**-19 # electron charge in coulombs\n", - "k=1.38*10**-23 # Boltzmann constant in m^2-kg/s^2-K^-1\n", - "T=300.0 # in Kelvin\n", - "Ir1=10**-12 # in A\n", - "Ir2=10**-10 # in A\n", - "It=2.0 # mA\n", - "\n", - "#Calculations\n", - "I21=Ir2/Ir1\n", - "Vt=(k*T)/e # in V\n", - "Vt = math.ceil(Vt*1000)/1000\n", - "I1=It/(1+I21)*10**3 # in micro-A\n", - "I2=It*10**3-I1 # in micro-A\n", - "I1=I2/I21 # in micro-A\n", - "x=((I1*10**-6)/Ir1)\n", - "V=Vt*math.log10(x)*2.3026\n", - "\n", - "#Result\n", - "print(\"diode voltage is ,(V) = %.3f\"%V)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "diode voltage is ,(V) = 0.437\n" - ] - } - ], - "prompt_number": 53 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.16, Page No. 39" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# voltage\n", - "\n", - "import math\n", - "#Variable declaration\n", - "T=27.0 # degree Celsius\n", - "Tk=273+T # in Kelvin\n", - "e=1.6*10**-19 # electron charge in coulombs\n", - "k=1.38*10**-23 # Boltzmann constant in m^2-kg/s^2-K^-1\n", - "J=10**4 # in Amp/m^2\n", - "Jo=200.0 #in mA/m^2\n", - "\n", - "#Calculations\n", - "x=(J/(Jo*10**-3))\n", - "Ve=((math.log(x))*k*Tk)/e\n", - "\n", - "#Result\n", - "print(\"voltage to be applied is ,(V) = %.2f\"%Ve)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "voltage to be applied is ,(V) = 0.28\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.17, Page No. 40" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# resistance\n", - "\n", - "import math\n", - "#Variable declaration\n", - "V=3.0 # in V\n", - "I=55.0 # in mA\n", - "V2=26.0 # in mV\n", - "\n", - "\n", - "#Calculations\n", - "Rdc=V/(I*10**-3) # in ohm\n", - "Rac=V2/I # in ohm\n", - "\n", - "#Result\n", - "print(\"static resistance is ,(ohm) = %.1f\"%Rdc)\n", - "print(\"dynamic resistance is ,(ohm) = %.2f\"%Rac)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "static resistance is ,(ohm) = 54.5\n", - "dynamic resistance is ,(ohm) = 0.47\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.18, Page No. 40" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# resistance\n", - "\n", - "import math\n", - "#Variable declaration\n", - "k=1.38*10**-23 # constant\n", - "T=27+273.0 # in K\n", - "eta=2.0\n", - "e=1.6*10**-19 # in C\n", - "Vt=(k*T/e) # in V\n", - "V=0.5 # in V\n", - "Ir=10**-6 # in A\n", - "\n", - "#Calculations\n", - "I=(Ir*10**3*(math.e**(V/(eta*Vt))-1))\n", - "R_dc=V*10**3/I;\n", - "R_ac=(eta*k*T)/(e*I*10**-3);\n", - "\n", - "#Result\n", - "print(\"static resistance,R_dc(ohm) = %.1f\"%R_dc)\n", - "print(\"Dynamic resistance,R_ac(ohm) = %.1f\"%R_ac)\n", - "#answer is wrong in textbook" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "static resistance,R_dc(ohm) = 31.8\n", - "Dynamic resistance,R_ac(ohm) = 3.3\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.19, Page No. 40" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# resistance\n", - "\n", - "import math\n", - "#Variable declaration\n", - "V=1.2 # in V\n", - "Vk=0.7 # in V\n", - "I_F=100.0 # in mA\n", - "V_R=10.0 # in V\n", - "I_R=1.0 # in micro-A\n", - "I=5.0 # in mA\n", - "eta=2\n", - "\n", - "#Calculations\n", - "R_B=(V-Vk)/(I_F*10**-3)\n", - "R_R=V_R/I_R\n", - "R_ac=eta*26/I\n", - "\n", - "#Result\n", - "print(\"the bulk resistance,R_B(ohm) = %.f\"%R_B)\n", - "print(\"the reverse resistance,R_R(M-ohm) = %.f\"%R_R)\n", - "print(\"ac resistance,R_ac(ohm) = %.1f\"%R_ac)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the bulk resistance,R_B(ohm) = 5\n", - "the reverse resistance,R_R(M-ohm) = 10\n", - "ac resistance,R_ac(ohm) = 10.4\n" - ] - } - ], - "prompt_number": 54 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.20, Page No. 41" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# capacitance\n", - "\n", - "import math\n", - "#Variable declaration\n", - "epsilon_0=8.85*10**-12 # in farada/m\n", - "K=12.0 # constant for silicon\n", - "A=1*10**-8 # in m^2\n", - "W=5*10**-7 # in m\n", - "\n", - "#Calculations\n", - "epsilon=epsilon_0*K\n", - "Ct=epsilon*A*10**14/W;\n", - "\n", - "#Result\n", - "print(\"the transition capacitance,Ct(PF) = %.1f\"%Ct)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "the transition capacitance,Ct(PF) = 212.4\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.21, Page No. 41" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# resistance\n", - "\n", - "import math\n", - "#Variable declaration\n", - "V=0.2 # in V\n", - "I=1.0 # in micro-A\n", - "\n", - "#Calculations\n", - "R_dc=V*10**3/I\n", - "R_ac=26/(I*10**3);\n", - "\n", - "#Result\n", - "print(\"The static resistance,R_ac(k-ohm) = %.f\"%R_dc)\n", - "print(\"the dynamic resistance,R_ac(ohm) = %.3f\"%R_ac)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The static resistance,R_ac(k-ohm) = 200\n", - "the dynamic resistance,R_ac(ohm) = 0.026\n" - ] - } - ], - "prompt_number": 55 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/BhavithaInnamuri/Chapter_1.ipynb b/sample_notebooks/BhavithaInnamuri/Chapter_1.ipynb new file mode 100755 index 00000000..cd376de8 --- /dev/null +++ b/sample_notebooks/BhavithaInnamuri/Chapter_1.ipynb @@ -0,0 +1,677 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 1 CRYSTAL STRUCTURES" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1_4 pgno:10" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a= 1.0\n", + "r=a/2 = 0.5\n", + "Volume of one atom ,v=((4∗%pi∗(rˆ3))/3)= 0.523598775598\n", + "Total Volume of the cube ,V=aˆ3 = 1.0\n", + "Fp(S.C)=(v∗100/V)= 52.3598775598\n" + ] + } + ], + "source": [ + "#exa 1.4\n", + "from math import pi\n", + "a=1.\n", + "print \"a= \",a # initializing value of lattice constant(a)=1.\n", + "r=a/2.\n", + "print \"r=a/2 = \",r # initializing value of radius of atom for simple cubic .\n", + "v=((4*pi*(r**3))/3)\n", + "print \"Volume of one atom ,v=((4∗%pi∗(rˆ3))/3)= \",v # calcuation . \n", + "V=a**3\n", + "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n", + "Fp=(v*100/V)\n", + "print \"Fp(S.C)=(v∗100/V)= \",Fp,# calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1_5 pgno:11" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a= 1.0\n", + "Radius of the atoms,r=(sqrt(3)∗(aˆ2/4)) = 0.433012701892\n", + "Volume of two atom,v=((4∗pi∗(rˆ3))/3)∗2 = 0.680174761588\n", + "Total Volume of the cube ,V=aˆ3 = 1.0\n", + "Fp(B.C.C)=(v∗100/V)= 68.0174761588 %\n" + ] + } + ], + "source": [ + "#exa 1.5\n", + "from math import sqrt\n", + "a=1.\n", + "print \"a= \",a # initializing value of lattice constant(a)=1.\n", + "r=(sqrt(3)*(a**2/4))\n", + "print \"Radius of the atoms,r=(sqrt(3)∗(aˆ2/4)) = \",r # initializing value of radius of atom for BCC.\n", + "v=((4*pi*(r**3))/3)*2\n", + "print \"Volume of two atom,v=((4∗pi∗(rˆ3))/3)∗2 = \",v # calcuation \n", + "V=a**3\n", + "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n", + "Fp=(v*100/V)\n", + "print \"Fp(B.C.C)=(v∗100/V)= \",Fp,\"%\" # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_6 pgno:12" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a= 1\n", + "Radius of the atom,r=(a/(2∗sqrt(2)))= 0.353553390593\n", + "Volume of the four atom,v=(((4∗pi∗(rˆ3))/3)∗4)= 0.740480489693\n", + "Total volume of the cube ,V=aˆ3= 2\n", + "Fp(F.C.C)=(v∗100/V)= 37.0240244847 %\n" + ] + } + ], + "source": [ + "#exa 1.6\n", + "a=1\n", + "print \"a= \",a # initializing value of lattice constant(a)=1.\n", + "r=(a/(2*sqrt(2)))\n", + "print \"Radius of the atom,r=(a/(2∗sqrt(2)))= \",r # initializing value of radius of atom for FCC .\n", + "v=(((4*pi*(r**3))/3)*4)\n", + "print \"Volume of the four atom,v=(((4∗pi∗(rˆ3))/3)∗4)= \",v # calcuation \n", + "V=a^3\n", + "print \"Total volume of the cube ,V=aˆ3= \",V # calcuation .\n", + "Fp=(v*100/V)\n", + "print \"Fp(F.C.C)=(v∗100/V)= \",Fp,\"%\" # calculation\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_8 pgno:14" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a= 1\n", + "Radius of the atom , r=(sqrt (3)∗a/8))= 0.216506350946\n", + "v=(((4∗pi∗(rˆ3))/3)∗8) = 0.340087380794\n", + "V=aˆ3= 2\n", + "Fp(Diamond)=(v∗100/V) = 17.0043690397 %\n" + ] + } + ], + "source": [ + "#Exa 1.8 \n", + "a=1\n", + "print \"a= \",a # initializing value of lattice constant(a)=1.\n", + "r=((sqrt(3)*a/8))\n", + "print \"Radius of the atom , r=(sqrt (3)∗a/8))= \",r # initializing value of radius of atom for diamond .\n", + "v=(((4*pi*(r**3))/3)*8)\n", + "print \"v=(((4∗pi∗(rˆ3))/3)∗8) = \",v # calcuation .\n", + "V=a^3\n", + "print \"V=aˆ3= \",V # calcuation .\n", + "Fp=(v*100/V)\n", + "print \"Fp(Diamond)=(v∗100/V) = \",Fp,\"%\" # calculation\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_9 pgno:14" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a = 5e-08 cm\n", + "Radius of the atom,r=(sqrt(3)∗(a/4))= 2.16506350946e-08\n", + "Volume of the two atoms ,v=((4∗pi∗(rˆ3))/3)∗2= 8.50218451985e-23\n", + "Total Volume of the cube ,V=aˆ3 = 1.25e-22\n", + "Fp(B.C.C)=(v∗100/V) = 68.0174761588 %\n" + ] + } + ], + "source": [ + "#exa 1.9\n", + "a=5*10**-8\n", + "print \"a = \",a,\" cm\" # initializing value of lattice constant .\n", + "r=(sqrt(3)*(a/4))\n", + "print \"Radius of the atom,r=(sqrt(3)∗(a/4))= \",r # initializing value of radius of atom for BCC.\n", + "v=((4*pi*(r**3))/3)*2\n", + "print \"Volume of the two atoms ,v=((4∗pi∗(rˆ3))/3)∗2= \",v # calcuation .\n", + "V=a**3\n", + "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n", + "Fp=(v*100/V)\n", + "print \"Fp(B.C.C)=(v∗100/V) = \",Fp,\"%\" # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_10 pgno:" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x intercept = 1\n", + "y intercept = inf\n", + "z intercept = inf\n", + "miller indices ,h=(1/x )= [1]\n", + "k=(1/y)= [0.0]\n", + "l=(1/z) = [0.0]\n" + ] + } + ], + "source": [ + "#exa 1.10\n", + "x=1\n", + "print \"x intercept = \",x # initializing value of x intercept .\n", + "y=float('inf')\n", + "print \"y intercept = \",y # initializing value of y intercept .\n", + "z=float('inf')\n", + "print \"z intercept = \",z # initializing value of z intercept .\n", + "h=[1/x]\n", + "print \"miller indices ,h=(1/x )= \",h # calculation\n", + "k=[1/y]\n", + "print \"k=(1/y)= \",k # calculation\n", + "l=[1/z]\n", + "print \"l=(1/z) = \",l # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_11 pgno:15" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x intercept = inf\n", + "y intercept = inf\n", + "z intercept = 1\n", + "miller indices ,h=[1/x] = [0.0]\n", + "k=[1/y] = [0.0]\n", + "l=[1/z] = [1]\n" + ] + } + ], + "source": [ + "#exa 1.11\n", + "x=float('inf')\n", + "print \"x intercept = \",x # initializing of x intercept .\n", + "y=float('inf') \n", + "print\"y intercept = \",y # initializing of Y intercept .\n", + "z=1\n", + "print \"z intercept = \",z # initializing of Z intercept .\n", + "h=[1/x]\n", + "print \"miller indices ,h=[1/x] = \",h # calculation\n", + "k=[1/y]\n", + "print \"k=[1/y] = \",k # calculation \n", + "l=[1/z]\n", + "print \"l=[1/z] = \",l # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_12 pgno: 16" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x intercept = inf\n", + "y intercept = 1\n", + "z intercept = inf\n", + "miller indices ,h=[1/x] = [0.0]\n", + "k=[1/y] = [1]\n", + "l=[1/z] = [0.0]\n" + ] + } + ], + "source": [ + "#exa 1.12\n", + "x=float('inf') \n", + "print \"x intercept = \",x # initializing of X intercept .\n", + "y=1\n", + "print \"y intercept = \",y # initializing of X intercept .\n", + "z=float('inf') \n", + "print \"z intercept = \",z # initializing of X intercept .\n", + "h=[1/x]\n", + "print \"miller indices ,h=[1/x] = \",h # calculation\n", + "k=[1/y]\n", + "print \"k=[1/y] = \",k # calculation \n", + "l=[1/z]\n", + "print \"l=[1/z] = \",l #calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_13 pgno:16" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x intercept = 1\n", + "y intercept = 1\n", + "z intercept = inf\n", + "miller indices ,h=[1/x] = [1]\n", + "k=[1/y] = [1]\n", + "l=[1/z] = [0.0]\n" + ] + } + ], + "source": [ + "#exa 1.13\n", + "x=1\n", + "print \"x intercept = \",x # initializing of X intercept .\n", + "y=1\n", + "print \"y intercept = \",y # initializing of X intercept .\n", + "z=float('inf') \n", + "print \"z intercept = \",z # initializing of X intercept .\n", + "h=[1/x]\n", + "print \"miller indices ,h=[1/x] = \",h # calculation\n", + "k=[1/y]\n", + "print \"k=[1/y] = \",k # calculation \n", + "l=[1/z]\n", + "print \"l=[1/z] = \",l #calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_14 pgno:17" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x intercept = inf\n", + "y intercept = 1\n", + "z intercept = 1\n", + "miller indices ,h=[1/x] = [0.0]\n", + "k=[1/y] = [1]\n", + "l=[1/z] = [1]\n" + ] + } + ], + "source": [ + "#exa 1.14\n", + "x=float('inf') \n", + "print \"x intercept = \",x # initializing of X intercept .\n", + "y=1\n", + "print \"y intercept = \",y # initializing of X intercept .\n", + "z=1\n", + "print \"z intercept = \",z # initializing of X intercept .\n", + "h=[1/x]\n", + "print \"miller indices ,h=[1/x] = \",h # calculation\n", + "k=[1/y]\n", + "print \"k=[1/y] = \",k # calculation \n", + "l=[1/z]\n", + "print \"l=[1/z] = \",l #calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_15 pgno:18" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x intercept = 2\n", + "y intercept = 2\n", + "z intercept = 2\n", + "common factor of all the intercept= 2\n", + "miller indices ,h=[c/x] = [1]\n", + "k=[c/y] = [1]\n", + "l=[c/z] = [1]\n" + ] + } + ], + "source": [ + "x=2\n", + "print \"x intercept = \",x # initializing of X intercept .\n", + "y=2\n", + "print \"y intercept = \",y # initializing of X intercept .\n", + "z=2\n", + "print \"z intercept = \",z # initializing of X intercept .\n", + "c=2\n", + "print \"common factor of all the intercept= \",c # initializing value of common factor of all the intercepts .\n", + "h=[c/x]\n", + "print \"miller indices ,h=[c/x] = \",h # calculation\n", + "k=[c/y]\n", + "print \"k=[c/y] = \",k # calculation \n", + "l=[c/z]\n", + "print \"l=[c/z] = \",l #calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_16 pgno: 18" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Wa = 28.1\n", + "D = 2.33 ram/cmˆ3\n", + "Na = 6.02e+23 atoms/mole\n", + "na =(Na∗D)/(Wa)= 4.99167259786e+22 atoms/cmˆ3\n" + ] + } + ], + "source": [ + "#exa 1.16\n", + "Wa =28.1\n", + "print \"Wa = \",Wa # initializing value of atomic weight .\n", + "D=2.33\n", + "print \"D = \",D,\"ram/cmˆ3\" # initializing value of density .\n", + "Na=6.02*10**23\n", + "print \"Na = \",Na,\"atoms/mole\" # initializing value of avagadro number .\n", + "na =(Na*D)/(Wa)\n", + "print \"na =(Na∗D)/(Wa)= \",na,\" atoms/cmˆ3\" # calculation\n", + "# the value of na (number of atoms in 1 cmˆ3 of silicon ) , provided after calculation in the book is wrong." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_17 pgno: 18" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a= 5e-08 cm\n", + "N= 2\n", + "V=aˆ3 = 1.25e-22 cmˆ3\n", + "na=(no.of atoms in unit cell/Volume of theunit cell) =(N/(V))= 1.6e+22\n" + ] + } + ], + "source": [ + "#exa 1.17\n", + "a=5*10**-8\n", + "print \"a= \",a,\"cm\" # initializing value of lattice constant .\n", + "N=2\n", + "print \"N= \",N # initializing value of no. of atoms in unit cell .\n", + "V=a**3\n", + "print \"V=aˆ3 = \",V,\"cmˆ3\" # initializing value of total Volume of the unit cell.\n", + "na =(N/(V))\n", + "print \"na=(no.of atoms in unit cell/Volume of theunit cell) =(N/(V))= \",na # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_18 pgno: 18" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a = 5.43e-08 cm\n", + "N = 8\n", + "Number of atom in the cmˆ3,ns =(N/(aˆ3))= 4.99678310227e+22\n" + ] + } + ], + "source": [ + "#exa 1.18\n", + "a=5.43*10**-8\n", + "print \"a = \",a,\"cm\" # initializing value of lattice constant .\n", + "N=8\n", + "print \"N = \",N # initializing value of no. of atoms in a unit cell .\n", + "ns =(N/(a**3))\n", + "print \"Number of atom in the cmˆ3,ns =(N/(aˆ3))= \",ns # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_19 pgno: 18" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a = 5.43e-08 cm\n", + "Wa = 28.1\n", + "Na = 6.02e+23\n", + "ns = 50000000000000000000000 atoms/cmˆ3\n", + "Density of silicon ,D =(ns∗Wa)/(Na)= 2.33388704319 gm/cmˆ2\n" + ] + } + ], + "source": [ + "#exa 1.19\n", + "a=5.43*10**-8\n", + "print \"a = \",a,\"cm\" # initializing value of lattice constant .\n", + "Wa =28.1\n", + "print \"Wa = \",Wa # initializing value of atomic weight .\n", + "Na=6.02*10**23\n", + "print \"Na = \",Na # initializing value of avagdro number .\n", + "ns =5*10**22\n", + "print \"ns = \",ns,\"atoms/cmˆ3\" # initializing value of atoms/cmˆ3.\n", + "D =(ns*Wa)/(Na)\n", + "print \"Density of silicon ,D =(ns∗Wa)/(Na)= \",D,\" gm/cmˆ2\" # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_20 pgno: 19" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a = 4.75e-08 cm\n", + "N = 4\n", + "na =(N/(aˆ3))= 3.73232249599e+22\n" + ] + } + ], + "source": [ + "#exa 1.20\n", + "a=4.75*10**-8\n", + "print \"a = \",a,\"cm\" # initializing value of lattice constant .\n", + "N=4\n", + "print \"N = \",N # initializing value of number of atoms in the unit cell .\n", + "na =(N/(a**3))\n", + "print \"na =(N/(aˆ3))=\",na # calculation" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/BhavithaInnamuri/Chapter_1_CRYSTAL.ipynb b/sample_notebooks/BhavithaInnamuri/Chapter_1_CRYSTAL.ipynb deleted file mode 100755 index cd376de8..00000000 --- a/sample_notebooks/BhavithaInnamuri/Chapter_1_CRYSTAL.ipynb +++ /dev/null @@ -1,677 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 1 CRYSTAL STRUCTURES" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 1_4 pgno:10" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a= 1.0\n", - "r=a/2 = 0.5\n", - "Volume of one atom ,v=((4∗%pi∗(rˆ3))/3)= 0.523598775598\n", - "Total Volume of the cube ,V=aˆ3 = 1.0\n", - "Fp(S.C)=(v∗100/V)= 52.3598775598\n" - ] - } - ], - "source": [ - "#exa 1.4\n", - "from math import pi\n", - "a=1.\n", - "print \"a= \",a # initializing value of lattice constant(a)=1.\n", - "r=a/2.\n", - "print \"r=a/2 = \",r # initializing value of radius of atom for simple cubic .\n", - "v=((4*pi*(r**3))/3)\n", - "print \"Volume of one atom ,v=((4∗%pi∗(rˆ3))/3)= \",v # calcuation . \n", - "V=a**3\n", - "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n", - "Fp=(v*100/V)\n", - "print \"Fp(S.C)=(v∗100/V)= \",Fp,# calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 1_5 pgno:11" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a= 1.0\n", - "Radius of the atoms,r=(sqrt(3)∗(aˆ2/4)) = 0.433012701892\n", - "Volume of two atom,v=((4∗pi∗(rˆ3))/3)∗2 = 0.680174761588\n", - "Total Volume of the cube ,V=aˆ3 = 1.0\n", - "Fp(B.C.C)=(v∗100/V)= 68.0174761588 %\n" - ] - } - ], - "source": [ - "#exa 1.5\n", - "from math import sqrt\n", - "a=1.\n", - "print \"a= \",a # initializing value of lattice constant(a)=1.\n", - "r=(sqrt(3)*(a**2/4))\n", - "print \"Radius of the atoms,r=(sqrt(3)∗(aˆ2/4)) = \",r # initializing value of radius of atom for BCC.\n", - "v=((4*pi*(r**3))/3)*2\n", - "print \"Volume of two atom,v=((4∗pi∗(rˆ3))/3)∗2 = \",v # calcuation \n", - "V=a**3\n", - "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n", - "Fp=(v*100/V)\n", - "print \"Fp(B.C.C)=(v∗100/V)= \",Fp,\"%\" # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_6 pgno:12" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a= 1\n", - "Radius of the atom,r=(a/(2∗sqrt(2)))= 0.353553390593\n", - "Volume of the four atom,v=(((4∗pi∗(rˆ3))/3)∗4)= 0.740480489693\n", - "Total volume of the cube ,V=aˆ3= 2\n", - "Fp(F.C.C)=(v∗100/V)= 37.0240244847 %\n" - ] - } - ], - "source": [ - "#exa 1.6\n", - "a=1\n", - "print \"a= \",a # initializing value of lattice constant(a)=1.\n", - "r=(a/(2*sqrt(2)))\n", - "print \"Radius of the atom,r=(a/(2∗sqrt(2)))= \",r # initializing value of radius of atom for FCC .\n", - "v=(((4*pi*(r**3))/3)*4)\n", - "print \"Volume of the four atom,v=(((4∗pi∗(rˆ3))/3)∗4)= \",v # calcuation \n", - "V=a^3\n", - "print \"Total volume of the cube ,V=aˆ3= \",V # calcuation .\n", - "Fp=(v*100/V)\n", - "print \"Fp(F.C.C)=(v∗100/V)= \",Fp,\"%\" # calculation\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_8 pgno:14" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a= 1\n", - "Radius of the atom , r=(sqrt (3)∗a/8))= 0.216506350946\n", - "v=(((4∗pi∗(rˆ3))/3)∗8) = 0.340087380794\n", - "V=aˆ3= 2\n", - "Fp(Diamond)=(v∗100/V) = 17.0043690397 %\n" - ] - } - ], - "source": [ - "#Exa 1.8 \n", - "a=1\n", - "print \"a= \",a # initializing value of lattice constant(a)=1.\n", - "r=((sqrt(3)*a/8))\n", - "print \"Radius of the atom , r=(sqrt (3)∗a/8))= \",r # initializing value of radius of atom for diamond .\n", - "v=(((4*pi*(r**3))/3)*8)\n", - "print \"v=(((4∗pi∗(rˆ3))/3)∗8) = \",v # calcuation .\n", - "V=a^3\n", - "print \"V=aˆ3= \",V # calcuation .\n", - "Fp=(v*100/V)\n", - "print \"Fp(Diamond)=(v∗100/V) = \",Fp,\"%\" # calculation\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_9 pgno:14" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a = 5e-08 cm\n", - "Radius of the atom,r=(sqrt(3)∗(a/4))= 2.16506350946e-08\n", - "Volume of the two atoms ,v=((4∗pi∗(rˆ3))/3)∗2= 8.50218451985e-23\n", - "Total Volume of the cube ,V=aˆ3 = 1.25e-22\n", - "Fp(B.C.C)=(v∗100/V) = 68.0174761588 %\n" - ] - } - ], - "source": [ - "#exa 1.9\n", - "a=5*10**-8\n", - "print \"a = \",a,\" cm\" # initializing value of lattice constant .\n", - "r=(sqrt(3)*(a/4))\n", - "print \"Radius of the atom,r=(sqrt(3)∗(a/4))= \",r # initializing value of radius of atom for BCC.\n", - "v=((4*pi*(r**3))/3)*2\n", - "print \"Volume of the two atoms ,v=((4∗pi∗(rˆ3))/3)∗2= \",v # calcuation .\n", - "V=a**3\n", - "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n", - "Fp=(v*100/V)\n", - "print \"Fp(B.C.C)=(v∗100/V) = \",Fp,\"%\" # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_10 pgno:" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "x intercept = 1\n", - "y intercept = inf\n", - "z intercept = inf\n", - "miller indices ,h=(1/x )= [1]\n", - "k=(1/y)= [0.0]\n", - "l=(1/z) = [0.0]\n" - ] - } - ], - "source": [ - "#exa 1.10\n", - "x=1\n", - "print \"x intercept = \",x # initializing value of x intercept .\n", - "y=float('inf')\n", - "print \"y intercept = \",y # initializing value of y intercept .\n", - "z=float('inf')\n", - "print \"z intercept = \",z # initializing value of z intercept .\n", - "h=[1/x]\n", - "print \"miller indices ,h=(1/x )= \",h # calculation\n", - "k=[1/y]\n", - "print \"k=(1/y)= \",k # calculation\n", - "l=[1/z]\n", - "print \"l=(1/z) = \",l # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_11 pgno:15" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "x intercept = inf\n", - "y intercept = inf\n", - "z intercept = 1\n", - "miller indices ,h=[1/x] = [0.0]\n", - "k=[1/y] = [0.0]\n", - "l=[1/z] = [1]\n" - ] - } - ], - "source": [ - "#exa 1.11\n", - "x=float('inf')\n", - "print \"x intercept = \",x # initializing of x intercept .\n", - "y=float('inf') \n", - "print\"y intercept = \",y # initializing of Y intercept .\n", - "z=1\n", - "print \"z intercept = \",z # initializing of Z intercept .\n", - "h=[1/x]\n", - "print \"miller indices ,h=[1/x] = \",h # calculation\n", - "k=[1/y]\n", - "print \"k=[1/y] = \",k # calculation \n", - "l=[1/z]\n", - "print \"l=[1/z] = \",l # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_12 pgno: 16" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "x intercept = inf\n", - "y intercept = 1\n", - "z intercept = inf\n", - "miller indices ,h=[1/x] = [0.0]\n", - "k=[1/y] = [1]\n", - "l=[1/z] = [0.0]\n" - ] - } - ], - "source": [ - "#exa 1.12\n", - "x=float('inf') \n", - "print \"x intercept = \",x # initializing of X intercept .\n", - "y=1\n", - "print \"y intercept = \",y # initializing of X intercept .\n", - "z=float('inf') \n", - "print \"z intercept = \",z # initializing of X intercept .\n", - "h=[1/x]\n", - "print \"miller indices ,h=[1/x] = \",h # calculation\n", - "k=[1/y]\n", - "print \"k=[1/y] = \",k # calculation \n", - "l=[1/z]\n", - "print \"l=[1/z] = \",l #calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_13 pgno:16" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "x intercept = 1\n", - "y intercept = 1\n", - "z intercept = inf\n", - "miller indices ,h=[1/x] = [1]\n", - "k=[1/y] = [1]\n", - "l=[1/z] = [0.0]\n" - ] - } - ], - "source": [ - "#exa 1.13\n", - "x=1\n", - "print \"x intercept = \",x # initializing of X intercept .\n", - "y=1\n", - "print \"y intercept = \",y # initializing of X intercept .\n", - "z=float('inf') \n", - "print \"z intercept = \",z # initializing of X intercept .\n", - "h=[1/x]\n", - "print \"miller indices ,h=[1/x] = \",h # calculation\n", - "k=[1/y]\n", - "print \"k=[1/y] = \",k # calculation \n", - "l=[1/z]\n", - "print \"l=[1/z] = \",l #calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_14 pgno:17" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "x intercept = inf\n", - "y intercept = 1\n", - "z intercept = 1\n", - "miller indices ,h=[1/x] = [0.0]\n", - "k=[1/y] = [1]\n", - "l=[1/z] = [1]\n" - ] - } - ], - "source": [ - "#exa 1.14\n", - "x=float('inf') \n", - "print \"x intercept = \",x # initializing of X intercept .\n", - "y=1\n", - "print \"y intercept = \",y # initializing of X intercept .\n", - "z=1\n", - "print \"z intercept = \",z # initializing of X intercept .\n", - "h=[1/x]\n", - "print \"miller indices ,h=[1/x] = \",h # calculation\n", - "k=[1/y]\n", - "print \"k=[1/y] = \",k # calculation \n", - "l=[1/z]\n", - "print \"l=[1/z] = \",l #calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_15 pgno:18" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "x intercept = 2\n", - "y intercept = 2\n", - "z intercept = 2\n", - "common factor of all the intercept= 2\n", - "miller indices ,h=[c/x] = [1]\n", - "k=[c/y] = [1]\n", - "l=[c/z] = [1]\n" - ] - } - ], - "source": [ - "x=2\n", - "print \"x intercept = \",x # initializing of X intercept .\n", - "y=2\n", - "print \"y intercept = \",y # initializing of X intercept .\n", - "z=2\n", - "print \"z intercept = \",z # initializing of X intercept .\n", - "c=2\n", - "print \"common factor of all the intercept= \",c # initializing value of common factor of all the intercepts .\n", - "h=[c/x]\n", - "print \"miller indices ,h=[c/x] = \",h # calculation\n", - "k=[c/y]\n", - "print \"k=[c/y] = \",k # calculation \n", - "l=[c/z]\n", - "print \"l=[c/z] = \",l #calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_16 pgno: 18" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Wa = 28.1\n", - "D = 2.33 ram/cmˆ3\n", - "Na = 6.02e+23 atoms/mole\n", - "na =(Na∗D)/(Wa)= 4.99167259786e+22 atoms/cmˆ3\n" - ] - } - ], - "source": [ - "#exa 1.16\n", - "Wa =28.1\n", - "print \"Wa = \",Wa # initializing value of atomic weight .\n", - "D=2.33\n", - "print \"D = \",D,\"ram/cmˆ3\" # initializing value of density .\n", - "Na=6.02*10**23\n", - "print \"Na = \",Na,\"atoms/mole\" # initializing value of avagadro number .\n", - "na =(Na*D)/(Wa)\n", - "print \"na =(Na∗D)/(Wa)= \",na,\" atoms/cmˆ3\" # calculation\n", - "# the value of na (number of atoms in 1 cmˆ3 of silicon ) , provided after calculation in the book is wrong." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_17 pgno: 18" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a= 5e-08 cm\n", - "N= 2\n", - "V=aˆ3 = 1.25e-22 cmˆ3\n", - "na=(no.of atoms in unit cell/Volume of theunit cell) =(N/(V))= 1.6e+22\n" - ] - } - ], - "source": [ - "#exa 1.17\n", - "a=5*10**-8\n", - "print \"a= \",a,\"cm\" # initializing value of lattice constant .\n", - "N=2\n", - "print \"N= \",N # initializing value of no. of atoms in unit cell .\n", - "V=a**3\n", - "print \"V=aˆ3 = \",V,\"cmˆ3\" # initializing value of total Volume of the unit cell.\n", - "na =(N/(V))\n", - "print \"na=(no.of atoms in unit cell/Volume of theunit cell) =(N/(V))= \",na # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_18 pgno: 18" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a = 5.43e-08 cm\n", - "N = 8\n", - "Number of atom in the cmˆ3,ns =(N/(aˆ3))= 4.99678310227e+22\n" - ] - } - ], - "source": [ - "#exa 1.18\n", - "a=5.43*10**-8\n", - "print \"a = \",a,\"cm\" # initializing value of lattice constant .\n", - "N=8\n", - "print \"N = \",N # initializing value of no. of atoms in a unit cell .\n", - "ns =(N/(a**3))\n", - "print \"Number of atom in the cmˆ3,ns =(N/(aˆ3))= \",ns # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_19 pgno: 18" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a = 5.43e-08 cm\n", - "Wa = 28.1\n", - "Na = 6.02e+23\n", - "ns = 50000000000000000000000 atoms/cmˆ3\n", - "Density of silicon ,D =(ns∗Wa)/(Na)= 2.33388704319 gm/cmˆ2\n" - ] - } - ], - "source": [ - "#exa 1.19\n", - "a=5.43*10**-8\n", - "print \"a = \",a,\"cm\" # initializing value of lattice constant .\n", - "Wa =28.1\n", - "print \"Wa = \",Wa # initializing value of atomic weight .\n", - "Na=6.02*10**23\n", - "print \"Na = \",Na # initializing value of avagdro number .\n", - "ns =5*10**22\n", - "print \"ns = \",ns,\"atoms/cmˆ3\" # initializing value of atoms/cmˆ3.\n", - "D =(ns*Wa)/(Na)\n", - "print \"Density of silicon ,D =(ns∗Wa)/(Na)= \",D,\" gm/cmˆ2\" # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_20 pgno: 19" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a = 4.75e-08 cm\n", - "N = 4\n", - "na =(N/(aˆ3))= 3.73232249599e+22\n" - ] - } - ], - "source": [ - "#exa 1.20\n", - "a=4.75*10**-8\n", - "print \"a = \",a,\"cm\" # initializing value of lattice constant .\n", - "N=4\n", - "print \"N = \",N # initializing value of number of atoms in the unit cell .\n", - "na =(N/(a**3))\n", - "print \"na =(N/(aˆ3))=\",na # calculation" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/DesuSandeep Kumar/Chapter_1_Introduction_to_Radio.ipynb b/sample_notebooks/DesuSandeep Kumar/Chapter_1_Introduction_to_Radio.ipynb new file mode 100755 index 00000000..42a985ca --- /dev/null +++ b/sample_notebooks/DesuSandeep Kumar/Chapter_1_Introduction_to_Radio.ipynb @@ -0,0 +1,102 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 1 Introduction to Radio Communication Systems" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1_3 pgno:3" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The transfer function has no finite zeros \n", + "The poles \n", + "[-0.25+0.96824584j -0.25-0.96824584j]\n" + ] + } + ], + "source": [ + "\n", + "#Chapter 1:Introduction to Radio Communication\n", + "#example 1.3 page no 3\n", + "#given\n", + "import numpy\n", + "print('The transfer function has no finite zeros ')\n", + "p=numpy.array([1, 0.5, 1])\n", + "x=numpy.roots(p)\n", + "print('The poles ')\n", + "print(x)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1_4 pgno:8" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the image frequency is MHz 1.91\n" + ] + } + ], + "source": [ + "\n", + "#Chapter 1:Introduction to Radio Communication Systems\n", + "#example 1.4 page no 8\n", + "#given\n", + "fIF=455*10**3#intermediate frequency\n", + "fO=1.455*10**6#oscillator frequency\n", + "fIM=fIF+fO#image frequency\n", + "print'the image frequency is MHz',fIM*1e-6\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/DesuSandeep Kumar/Chapter_1_Introduction_to_Radio_Communication.ipynb b/sample_notebooks/DesuSandeep Kumar/Chapter_1_Introduction_to_Radio_Communication.ipynb deleted file mode 100755 index 42a985ca..00000000 --- a/sample_notebooks/DesuSandeep Kumar/Chapter_1_Introduction_to_Radio_Communication.ipynb +++ /dev/null @@ -1,102 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 1 Introduction to Radio Communication Systems" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 1_3 pgno:3" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The transfer function has no finite zeros \n", - "The poles \n", - "[-0.25+0.96824584j -0.25-0.96824584j]\n" - ] - } - ], - "source": [ - "\n", - "#Chapter 1:Introduction to Radio Communication\n", - "#example 1.3 page no 3\n", - "#given\n", - "import numpy\n", - "print('The transfer function has no finite zeros ')\n", - "p=numpy.array([1, 0.5, 1])\n", - "x=numpy.roots(p)\n", - "print('The poles ')\n", - "print(x)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 1_4 pgno:8" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the image frequency is MHz 1.91\n" - ] - } - ], - "source": [ - "\n", - "#Chapter 1:Introduction to Radio Communication Systems\n", - "#example 1.4 page no 8\n", - "#given\n", - "fIF=455*10**3#intermediate frequency\n", - "fO=1.455*10**6#oscillator frequency\n", - "fIM=fIF+fO#image frequency\n", - "print'the image frequency is MHz',fIM*1e-6\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/DurgasriInnamuri/Chapter_3_Semoconductor.ipynb b/sample_notebooks/DurgasriInnamuri/Chapter_3_Semoconductor.ipynb new file mode 100755 index 00000000..ade5b7fd --- /dev/null +++ b/sample_notebooks/DurgasriInnamuri/Chapter_3_Semoconductor.ipynb @@ -0,0 +1,223 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 3 Semoconductor Devices Fundamentals" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 3.2 page no:35" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "resistivity of the si doped with n−dopant is : \n", + "0.089 ohm−cm \n" + ] + } + ], + "source": [ + "def resistivity(u,n): #n:doped concentration =10**17 atoms/cubic cm, u: mobility of electrons =700square cm/v−sec .\n", + " q=1.6*10**-19 #q: charge\n", + " Res=1/(q*u*n)# since P is neglegible . \n", + " print \"resistivity of the si doped with n−dopant is : \"\n", + " print \"%0.3f ohm−cm \"%Res \n", + "resistivity(10**17,700)\n", + "# after executing calling resitivity ( u=700 and n =10ˆ17)i .e. , resistivity (10ˆ17 ,700) ;" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 3.3 page no:35" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "resistivity of intrinsic Ge is : \n", + "2595245510.225 ohm−cm \n" + ] + } + ], + "source": [ + "def resistivity(un,np): # un: electron concentration , up: hole concentration\n", + " q=1.6*10**-19 #in coulumb \n", + " ni=2.5*10*13 # concentration in cmˆ−3 \n", + " Res=1/(q*ni*un*np) # since n=p=ni \n", + " print \"resistivity of intrinsic Ge is : \"\n", + " print \"%0.3f ohm−cm \"%Res \n", + "resistivity(3900,1900)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 3.4 page no:37" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "hole concentrartion at 300K is : \n", + "2250.000000 per cubic cm \n" + ] + } + ], + "source": [ + "def holeconcentration(ni,Nd): # Nd: donar concentration ; since , Nd>>ni , so Nd=n=10ˆ17 atoms/cmˆ3.\n", + " p=ni**2/Nd\n", + " print \"hole concentrartion at 300K is : \"\n", + " print \"%f per cubic cm \"%p\n", + "holeconcentration(1.5*10**10,10**17);" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 3.5 page no:39" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "resistivity of the copper is : \n", + "2.29779411765e-08 ohm−meter\n" + ] + } + ], + "source": [ + "q=1.6*10**-19;\n", + "n=8.5*10**28;\n", + "u=3.2*10**-3;\n", + "p=1/(n*q*u);\n", + "print \"resistivity of the copper is : \"\n", + "print p,\" ohm−meter\"\n", + "# 2.298D−08 means 2.298∗10ˆ −8" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 3.6 page no:41" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Cu is: 0.0570814666846 pF\n", + "Ccs is: 0.282102806737 pF\n", + "gm is : 7.7519379845 mA/V\n", + "C1 is: 3.32558139535 pF\n", + "R1 is: 25.8 kilo ohm\n", + "R0 is 645.0 kilo Ohm \n", + "Ru is: 1290.0 Mega Ohm \n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "\n", + "Cuo=0.25; # collector −base depletion region capacitance in pico Farad(pF) for zero bias\n", + "Ccso=1.5 ; # collector −substrate junction capacitance in pico Farad(pF) for zero bias\n", + "q=1.6*10**-19 ; # electron charge in coulomb\n", + "Ic=0.2 ; #collector current in ampere(A)\n", + "k=8.6*10**-5; #in eV/K, where 1eV=1.6∗10ˆ−19\n", + "T=300; # absolute temperature in kelvin (K)\n", + "Vcb=10 ; #forward bias on the junction in volt(v)\n", + "Vcs=15 ; # collector −substrate bias in volt (V)\n", + "Cje=1 ; #depletion region capacitance in pico Farad(pF)\n", + "Bo=200; #small signal current gain\n", + "Tf=0.3; #transit time in forward direction in nano seconds (nS)\n", + "n=2*10**-4; # proportionality constant for Ro and gm\n", + "Vo=0.55; # bias voltage in volt (V)\n", + "Cu=Cuo/sqrt(1+(Vcb/Vo));# collector −base capacitance\n", + "print \"Cu is: \",Cu,\" pF\"\n", + "Ccs=Ccso/sqrt(1+(Vcs/Vo)); # capacitance collector −substrate\n", + "print \"Ccs is: \",Ccs,\"pF\"\n", + "gm=q*Ic/(k*T*1.6*10**-19);# since k is in eV so converting it in Coulomb/Kelvin\n", + "print \"gm is :\",gm,\"mA/V\"# transconductance of the bipolar transistor here\n", + "Cb=Tf*gm;# diffusion capacitance in pico Farad(pF)\n", + "C1=Cb+Cje;#small signal capacitance of bipolar transistor\n", + "print \"C1 is: \",C1,\"pF\"\n", + "R1=Bo/gm;# small signal input resistance of bipolar transistor\n", + "print \"R1 is: \",R1,\" kilo ohm\"\n", + "Ro=1/(n*gm);#small signal output resistance\n", + "print \"R0 is \",Ro,\" kilo Ohm \"\n", + "Ru=10*Bo*Ro/10**3;# collector −base resistance\n", + "print \"Ru is: \",Ru,\"Mega Ohm \"" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/DurgasriInnamuri/Chapter_3_Semoconductor_Devices.ipynb b/sample_notebooks/DurgasriInnamuri/Chapter_3_Semoconductor_Devices.ipynb deleted file mode 100755 index ade5b7fd..00000000 --- a/sample_notebooks/DurgasriInnamuri/Chapter_3_Semoconductor_Devices.ipynb +++ /dev/null @@ -1,223 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 3 Semoconductor Devices Fundamentals" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 3.2 page no:35" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "resistivity of the si doped with n−dopant is : \n", - "0.089 ohm−cm \n" - ] - } - ], - "source": [ - "def resistivity(u,n): #n:doped concentration =10**17 atoms/cubic cm, u: mobility of electrons =700square cm/v−sec .\n", - " q=1.6*10**-19 #q: charge\n", - " Res=1/(q*u*n)# since P is neglegible . \n", - " print \"resistivity of the si doped with n−dopant is : \"\n", - " print \"%0.3f ohm−cm \"%Res \n", - "resistivity(10**17,700)\n", - "# after executing calling resitivity ( u=700 and n =10ˆ17)i .e. , resistivity (10ˆ17 ,700) ;" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 3.3 page no:35" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "resistivity of intrinsic Ge is : \n", - "2595245510.225 ohm−cm \n" - ] - } - ], - "source": [ - "def resistivity(un,np): # un: electron concentration , up: hole concentration\n", - " q=1.6*10**-19 #in coulumb \n", - " ni=2.5*10*13 # concentration in cmˆ−3 \n", - " Res=1/(q*ni*un*np) # since n=p=ni \n", - " print \"resistivity of intrinsic Ge is : \"\n", - " print \"%0.3f ohm−cm \"%Res \n", - "resistivity(3900,1900)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 3.4 page no:37" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "hole concentrartion at 300K is : \n", - "2250.000000 per cubic cm \n" - ] - } - ], - "source": [ - "def holeconcentration(ni,Nd): # Nd: donar concentration ; since , Nd>>ni , so Nd=n=10ˆ17 atoms/cmˆ3.\n", - " p=ni**2/Nd\n", - " print \"hole concentrartion at 300K is : \"\n", - " print \"%f per cubic cm \"%p\n", - "holeconcentration(1.5*10**10,10**17);" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 3.5 page no:39" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "resistivity of the copper is : \n", - "2.29779411765e-08 ohm−meter\n" - ] - } - ], - "source": [ - "q=1.6*10**-19;\n", - "n=8.5*10**28;\n", - "u=3.2*10**-3;\n", - "p=1/(n*q*u);\n", - "print \"resistivity of the copper is : \"\n", - "print p,\" ohm−meter\"\n", - "# 2.298D−08 means 2.298∗10ˆ −8" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 3.6 page no:41" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Cu is: 0.0570814666846 pF\n", - "Ccs is: 0.282102806737 pF\n", - "gm is : 7.7519379845 mA/V\n", - "C1 is: 3.32558139535 pF\n", - "R1 is: 25.8 kilo ohm\n", - "R0 is 645.0 kilo Ohm \n", - "Ru is: 1290.0 Mega Ohm \n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "\n", - "Cuo=0.25; # collector −base depletion region capacitance in pico Farad(pF) for zero bias\n", - "Ccso=1.5 ; # collector −substrate junction capacitance in pico Farad(pF) for zero bias\n", - "q=1.6*10**-19 ; # electron charge in coulomb\n", - "Ic=0.2 ; #collector current in ampere(A)\n", - "k=8.6*10**-5; #in eV/K, where 1eV=1.6∗10ˆ−19\n", - "T=300; # absolute temperature in kelvin (K)\n", - "Vcb=10 ; #forward bias on the junction in volt(v)\n", - "Vcs=15 ; # collector −substrate bias in volt (V)\n", - "Cje=1 ; #depletion region capacitance in pico Farad(pF)\n", - "Bo=200; #small signal current gain\n", - "Tf=0.3; #transit time in forward direction in nano seconds (nS)\n", - "n=2*10**-4; # proportionality constant for Ro and gm\n", - "Vo=0.55; # bias voltage in volt (V)\n", - "Cu=Cuo/sqrt(1+(Vcb/Vo));# collector −base capacitance\n", - "print \"Cu is: \",Cu,\" pF\"\n", - "Ccs=Ccso/sqrt(1+(Vcs/Vo)); # capacitance collector −substrate\n", - "print \"Ccs is: \",Ccs,\"pF\"\n", - "gm=q*Ic/(k*T*1.6*10**-19);# since k is in eV so converting it in Coulomb/Kelvin\n", - "print \"gm is :\",gm,\"mA/V\"# transconductance of the bipolar transistor here\n", - "Cb=Tf*gm;# diffusion capacitance in pico Farad(pF)\n", - "C1=Cb+Cje;#small signal capacitance of bipolar transistor\n", - "print \"C1 is: \",C1,\"pF\"\n", - "R1=Bo/gm;# small signal input resistance of bipolar transistor\n", - "print \"R1 is: \",R1,\" kilo ohm\"\n", - "Ro=1/(n*gm);#small signal output resistance\n", - "print \"R0 is \",Ro,\" kilo Ohm \"\n", - "Ru=10*Bo*Ro/10**3;# collector −base resistance\n", - "print \"Ru is: \",Ru,\"Mega Ohm \"" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/GundaChaitnaya rani/GundaChaitnaya rani_version_backup/Chapter_3_Ionization_and_Deionization_Processes.ipynb b/sample_notebooks/GundaChaitnaya rani/GundaChaitnaya rani_version_backup/Chapter_3_Ionization_and_Deionization_Processes.ipynb new file mode 100755 index 00000000..4ab6ea93 --- /dev/null +++ b/sample_notebooks/GundaChaitnaya rani/GundaChaitnaya rani_version_backup/Chapter_3_Ionization_and_Deionization_Processes.ipynb @@ -0,0 +1,656 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 3.7.1 pg.no:85" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "speed of oxygen molecule 473.791093 m/s\n" + ] + } + ], + "source": [ + "#Exa 3.7.1 speed of air molecules\n", + "# Example 1# Ch 3\n", + "from math import sqrt\n", + "# given data\n", + "R=8314; # gas constant in J/kg . mol .K\n", + "T=300; # temperature 27 deg C, 27+293=300K\n", + "M=32; # oxygen is diatomic\n", + "v = sqrt(3*R*(T/M));\n", + "print \"speed of oxygen molecule %f m/s\" %v\n", + "# Note: Value of R is given wrong in book\n", + "# So answer in the book is wrong" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 3.7.1 pg.no:87" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "volume of gas 1.533151e-03 mˆ3 \n", + "\n", + "total translational kinetic energy is 154.848250 J \n", + "\n" + ] + } + ], + "source": [ + "#Exa 3.7.2 total translational KE\n", + "# Example 2# Ch 3\n", + "# given data\n", + "R=8314; # gas constant in J/kg . mol .K\n", + "T=298;#in kelvin\n", + "M=32; # oxygen is diatomic\n", + "m=2*10**-3; # in kg\n", + "p=1.01*10**5; # 1 atm=1.01∗10ˆ5 N/m2\n", + "G = (m*R*T)/(M*p);#volume of gas\n", + "x=(3/2)*p;#no. of molecules per unit volume where x=N∗0.5∗m∗vˆ2 is given as (3/2)∗p)\n", + "print\"volume of gas %e mˆ3 \\n\"%G\n", + "KE = x*G;#total translational kinetic energy\n", + "print\"total translational kinetic energy is %f J \\n\"%KE\n", + "# Note: Value of G is calculated in book is wrong" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 3.7.3 pg.no:88" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "no . of molecules 2.753546e+19\n", + "max pressure in chamber 0.117735 N/m2\n" + ] + } + ], + "source": [ + "#Exa 3.7.3 max pressure in chamber\n", + "# Example 3# Ch 3\n", + "from math import pi\n", + "# given data\n", + "R=8314; # gas constant in J/kg . mol .K\n", + "T=300; # temperature 27 deg C, 27+293=300K\n", + "me=0.10; #mean free path in meters\n", + "rm=1.7*10**-10 #molecular radius in angstrom\n", + "M=28 #im moleˆ−1\n", + "m0=4.8*10**-26 #mass of nitrogen molecule\n", + "N = 1/(4*pi*((rm)**2)*me); # no. of molecules in gas\n", + "print\"no . of molecules %e\"%N \n", + "p = ((N*m0)/M)*R*T; # max pressure in chamber in N/ m2\n", + "print\"max pressure in chamber %f N/m2\"%p\n", + "# Note: Calculation in the book is wrong So answer in the book is wrong" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 3.7.4 pg.no:88" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "temperature 7.729469e+03 K\n" + ] + } + ], + "source": [ + "#Exa 3.7.4 temperature at which avg KE of He atoms in gas become 1 eV\n", + "# Example 4# Ch 3\n", + "# given data\n", + "v = 1.6*10**-19; # avg kinetic energy in j\n", + "k = 1.38*10**-23 #boltzmann constant in J/K\n", + "T = (2*v)/(3*k);\n", + "print \"temperature %e K\"%T" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 3.7.5 pg.no:89" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "volume of 1kg of helium is 11.147071 mˆ3\n" + ] + } + ], + "source": [ + "#Exa 3.7.5 volume of 1 kg of He\n", + "# Example 6# Ch 3\n", + "# given data\n", + "m = 1;#in kg\n", + "M=2.016;#molecular weight of helium\n", + "k =8314# gas constant in J/kg \n", + "p = 1.01*10**5;\n", + "T = 273; # in kelvin\n", + "G = m*k*T/(M*p);#volume of 1kg of helium in mˆ3\n", + "print\"volume of 1kg of helium is %f mˆ3\"%G" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 3.7.6 pg.no:92" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "density of ions at distance equal to the mean free path 0.367879n0\n", + "density of ions at distance equal to five times the mean free path 0.006738n0\n" + ] + } + ], + "source": [ + "#Exa 3.7.6 density of ions at dist equal to mfp and five times mfp\n", + "# Example 6# Ch 3\n", + "from math import exp\n", + "# given data\n", + "z1=-1;#ion at a distance equal to mean free path , −x=mfp\n", + "z2=-5;#ion at a distance equal to five times the mean f r e e path , −x=5mfp\n", + "#n0 is the density of ions at the origin\n", + "n1 = exp(z1);#density of ions at distance equal to the mean free path\n", + "n2 = exp(z2);#density of ions at distance equal to five times the mean free path\n", + "print\"density of ions at distance equal to the mean free path %fn0\"%n1\n", + "print\"density of ions at distance equal to five times the mean free path %fn0\"%n2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 3.7.7 pg.no:93" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "mean square velosity of helium atoms 1304.701955 m/s\n" + ] + } + ], + "source": [ + "#Exa 3.7.7 mean square velocity of He atoms\n", + "# Example 7# Ch 3\n", + "from math import sqrt\n", + "# given data\n", + "N = 178*10**-3 #gas density in kg/mˆ3\n", + "p = 1.01*10**5 # pressure\n", + "v = sqrt((3*p)/N); #mean square velosity of helium atoms\n", + "print\"mean square velosity of helium atoms %f m/s\"%v" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 3.7.1 pg.no:93" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "energy of free electron 3.790687 eV\n" + ] + } + ], + "source": [ + "#Exa 3.7.8 energy of free electrons\n", + "#Example 8# Ch 3\n", + "# given data\n", + "k =1.38e-21; #boltzmanns constant\n", + "T = 293; # temperature in K\n", + "e = 1.6*10** -19;\n", + "E =(1.5*k*T)/e;\n", + "print\"energy of free electron %f eV\"%E" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 3.7.9 pg.no:95" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "no . of atoms/cmˆ3 4.5168e+22\n", + "avg vokume occupied by one atom 2.213957e-23 cmˆ3\n", + "avg seperation between atoms 1.000000e+00 cm\n" + ] + } + ], + "source": [ + "#Exa 3.7.9 avg separation of atoms and avg vol occupied by one atom\n", + "#Example 9# Ch 3\n", + "# given data\n", + "d = 0.075; #density of solid atomic hydrogen in g/cmˆ3\n", + "N_A = 6.0224*10**23; #1g of H consists of NA atoms\n", + "N = N_A*d; # number of atoms/cmˆ3\n", + "print \"no . of atoms/cmˆ3 \",N\n", + "x = 1/N;#avg volume occupied by one atom in cmˆ3\n", + "y = (x)**(1/3);#avg seperation between atoms in cm\n", + "print \"avg vokume occupied by one atom %e cmˆ3\"%x\n", + "print \"avg seperation between atoms %e cm\"%y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 3.7.10 pg.no:96" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "photon enegy 62.250000 eV\n", + "kinetic energy of photoelectron 48.650000 ev\n", + " velosity of photoelectron 4.133874e+06 m/s\n" + ] + } + ], + "source": [ + "#Exa 3.7.10 KE in eV and velocity of phototelectron\n", + "#Example 10# Ch 3\n", + "from math import sqrt\n", + "# given data\n", + "l=200*10**-10;# wavelength in angstrom\n", + "h=4.15*10**-15;#planks constant\n", + "c=3*10**8;#speed of light\n", + "me=9.11*10**-31;\n", + "BE=13.6;#binding energy in eV\n", + "PE=(h*c)/l;# in eV\n", + "print\"photon enegy %f eV\"%PE\n", + "KE = PE-BE;#in eV\n", + "print\"kinetic energy of photoelectron %f ev\"%KE\n", + "ve=sqrt((2*KE*1.6*10**-19)/me);\n", + "print\" velosity of photoelectron %e m/s\"%ve" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 3.7.11 pg.no:98" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "absorption coefficient -0.000000 cmˆ−1\n" + ] + } + ], + "source": [ + "#Exa 3.7.11 liquid photon absorption coefficient\n", + "#Example 11# Ch 3\n", + "from math import log\n", + "# given data\n", + "I = 1.;\n", + "I0 = 6.;\n", + "x=20;#in cm\n", + "u = -(1/x)*log(I/I0);\n", + "print\"absorption coefficient %f cmˆ−1\"%u" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 3.7.12 pg.no:98" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "binding energy of gas 12.450000 eV\n" + ] + } + ], + "source": [ + "#Exa 3.7.12 binding energy of the gas\n", + "#Example 12# Ch 3\n", + "# given data\n", + "c=3*10**8;\n", + "h=4.15*10**-15;\n", + "lmax =1000*10** -10;\n", + "We=(c*h)/lmax;\n", + "print\"binding energy of gas %f eV\"%We" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 3.7.14 pg.no:105" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "no of gas molecules 3.527492e+22 atoms/mˆ3\n", + "diameter of argon atom 2.769501e-10 m\n" + ] + } + ], + "source": [ + "#Exa 3.7.14 diameter of the argon atom\n", + "#Example 14# Ch 3\n", + "from math import sqrt,pi\n", + "# given data\n", + "p=1.01*10**5/760;# 1 torr in N/m2\n", + "k=1.38*10**-23;\n", + "T=273; # in Kelvin\n", + "n=85*10**2;#no of collisions per meter\n", + "N=p/(k*T);\n", + "print \"no of gas molecules %e atoms/mˆ3\"%N\n", + "r_a=sqrt(n/(pi*N*1));\n", + "print \"diameter of argon atom %e m\"%r_a" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 3.7.15 pg.no:106" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "mobility of electrons 9375.000000 mˆ2/sV\n" + ] + } + ], + "source": [ + "#Exa 3.7.15 mobility of electrons\n", + "#Example 15# Ch 3\n", + "# given data\n", + "Ie=3;# current flow in amperes\n", + "A=8*10**-4;#area of the electrodes in mˆ2\n", + "V=20;#voltage across the electrodes\n", + "d=0.8;#spacing between the electrodes in meters\n", + "n_e=1*10**17;#electron density in mˆ−3\n", + "e=1.6*10**-19;\n", + "ke=(Ie*d)/(A*V*n_e*e);\n", + "print\"mobility of electrons %f mˆ2/sV\"%ke" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 3.7.17 pg.no:108" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ion density 0.02m away 1.911913e+09 ions/mˆ3 \n", + "\n", + "ion density −0.02m away 5.230363e+12 ions/mˆ3 \n", + "\n" + ] + } + ], + "source": [ + "#Exa 3.7.17 ion density point 02 m away in both directions at 25 deg C amperes\n", + "#Example 17# Ch 3\n", + "from math import exp\n", + "# given data\n", + "E = 5; #electric field in V/m\n", + "n_o = 10**11; #ion density in ions/m3\n", + "T = 293; # in kelvin\n", + "z = 0.02; #distance in meters\n", + "e = 1.6*10**-19; #in couloumb\n", + "k = 1.38*10**-23; # in m2 kg s−2 K−1\n", + "n1 = n_o*exp((-e*E*z)/(k*T));# ion density away \n", + "n2 = n_o*exp((e*E*z)/(k*T));# ion density away −0.02m\n", + "print\"ion density 0.02m away %e ions/mˆ3 \\n\"%n1\n", + "print\"ion density −0.02m away %e ions/mˆ3 \\n\"%n2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 3.7.18 pg.no:109" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "diameter before drift 3.032550e-05 m \n", + "\n", + "diameter after drift 5.515025e-03 m \n", + "\n" + ] + } + ], + "source": [ + "#Exa 3.7.18 diameter of cloud after drifting a distance of point 05\n", + "#Example 18# Ch 3 2 clc;\n", + "from math import sqrt\n", + "# given data\n", + "E = 250; #electric field in V/m\n", + "r1 = 0.3*10**-3#intial diameter of cloud in meters \n", + "k = 1.38*10**-23;#in m2 kg s−2 K−1\n", + "T = 293; #in kelvin\n", + "e = 1.6*10**-19;# in couloumb\n", + "z = 0.05;#drift distance in meters\n", + "r = (6*k*T*z)/(e*E);#diameter before drift\n", + "print\"diameter before drift %e m \\n\"%r\n", + "r2 = sqrt (r1**2 + r );#diamter after drifting a distance\n", + "print\"diameter after drift %e m \\n\"%r2 \n", + "# round off value calculated for r and r2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 3.7.19 pg.no:111" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "mean free path of electron in nitrogen 2.221482e-04 m\n", + "ionization potential of nitrogen 28.000000 V\n" + ] + } + ], + "source": [ + "#Exa 3.7.19 a mean free path of electrons in nitrogen and b ionization potential of nitrogen\n", + "#Example 19# Ch 3 \n", + "# given data\n", + "a = 9003;#constant in m−1kPa−1 \n", + "B = 256584;#in V/m.kPa\n", + "p = 0.5;#in kPa\n", + "M = 1/(a*p);#mean free path in meters\n", + "print\"mean free path of electron in nitrogen %e m\"%M\n", + "Vi = B/a; #ionization potential of nitrogen\n", + "print\"ionization potential of nitrogen %f V\"%Vi" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/GundaChaitnaya rani/GundaChaitnaya rani_version_backup/Chapter_3_Ionization_and_Deionization_Processes_in.ipynb b/sample_notebooks/GundaChaitnaya rani/GundaChaitnaya rani_version_backup/Chapter_3_Ionization_and_Deionization_Processes_in.ipynb deleted file mode 100755 index 4ab6ea93..00000000 --- a/sample_notebooks/GundaChaitnaya rani/GundaChaitnaya rani_version_backup/Chapter_3_Ionization_and_Deionization_Processes_in.ipynb +++ /dev/null @@ -1,656 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 3.7.1 pg.no:85" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "speed of oxygen molecule 473.791093 m/s\n" - ] - } - ], - "source": [ - "#Exa 3.7.1 speed of air molecules\n", - "# Example 1# Ch 3\n", - "from math import sqrt\n", - "# given data\n", - "R=8314; # gas constant in J/kg . mol .K\n", - "T=300; # temperature 27 deg C, 27+293=300K\n", - "M=32; # oxygen is diatomic\n", - "v = sqrt(3*R*(T/M));\n", - "print \"speed of oxygen molecule %f m/s\" %v\n", - "# Note: Value of R is given wrong in book\n", - "# So answer in the book is wrong" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 3.7.1 pg.no:87" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "volume of gas 1.533151e-03 mˆ3 \n", - "\n", - "total translational kinetic energy is 154.848250 J \n", - "\n" - ] - } - ], - "source": [ - "#Exa 3.7.2 total translational KE\n", - "# Example 2# Ch 3\n", - "# given data\n", - "R=8314; # gas constant in J/kg . mol .K\n", - "T=298;#in kelvin\n", - "M=32; # oxygen is diatomic\n", - "m=2*10**-3; # in kg\n", - "p=1.01*10**5; # 1 atm=1.01∗10ˆ5 N/m2\n", - "G = (m*R*T)/(M*p);#volume of gas\n", - "x=(3/2)*p;#no. of molecules per unit volume where x=N∗0.5∗m∗vˆ2 is given as (3/2)∗p)\n", - "print\"volume of gas %e mˆ3 \\n\"%G\n", - "KE = x*G;#total translational kinetic energy\n", - "print\"total translational kinetic energy is %f J \\n\"%KE\n", - "# Note: Value of G is calculated in book is wrong" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 3.7.3 pg.no:88" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "no . of molecules 2.753546e+19\n", - "max pressure in chamber 0.117735 N/m2\n" - ] - } - ], - "source": [ - "#Exa 3.7.3 max pressure in chamber\n", - "# Example 3# Ch 3\n", - "from math import pi\n", - "# given data\n", - "R=8314; # gas constant in J/kg . mol .K\n", - "T=300; # temperature 27 deg C, 27+293=300K\n", - "me=0.10; #mean free path in meters\n", - "rm=1.7*10**-10 #molecular radius in angstrom\n", - "M=28 #im moleˆ−1\n", - "m0=4.8*10**-26 #mass of nitrogen molecule\n", - "N = 1/(4*pi*((rm)**2)*me); # no. of molecules in gas\n", - "print\"no . of molecules %e\"%N \n", - "p = ((N*m0)/M)*R*T; # max pressure in chamber in N/ m2\n", - "print\"max pressure in chamber %f N/m2\"%p\n", - "# Note: Calculation in the book is wrong So answer in the book is wrong" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 3.7.4 pg.no:88" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "temperature 7.729469e+03 K\n" - ] - } - ], - "source": [ - "#Exa 3.7.4 temperature at which avg KE of He atoms in gas become 1 eV\n", - "# Example 4# Ch 3\n", - "# given data\n", - "v = 1.6*10**-19; # avg kinetic energy in j\n", - "k = 1.38*10**-23 #boltzmann constant in J/K\n", - "T = (2*v)/(3*k);\n", - "print \"temperature %e K\"%T" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 3.7.5 pg.no:89" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "volume of 1kg of helium is 11.147071 mˆ3\n" - ] - } - ], - "source": [ - "#Exa 3.7.5 volume of 1 kg of He\n", - "# Example 6# Ch 3\n", - "# given data\n", - "m = 1;#in kg\n", - "M=2.016;#molecular weight of helium\n", - "k =8314# gas constant in J/kg \n", - "p = 1.01*10**5;\n", - "T = 273; # in kelvin\n", - "G = m*k*T/(M*p);#volume of 1kg of helium in mˆ3\n", - "print\"volume of 1kg of helium is %f mˆ3\"%G" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 3.7.6 pg.no:92" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "density of ions at distance equal to the mean free path 0.367879n0\n", - "density of ions at distance equal to five times the mean free path 0.006738n0\n" - ] - } - ], - "source": [ - "#Exa 3.7.6 density of ions at dist equal to mfp and five times mfp\n", - "# Example 6# Ch 3\n", - "from math import exp\n", - "# given data\n", - "z1=-1;#ion at a distance equal to mean free path , −x=mfp\n", - "z2=-5;#ion at a distance equal to five times the mean f r e e path , −x=5mfp\n", - "#n0 is the density of ions at the origin\n", - "n1 = exp(z1);#density of ions at distance equal to the mean free path\n", - "n2 = exp(z2);#density of ions at distance equal to five times the mean free path\n", - "print\"density of ions at distance equal to the mean free path %fn0\"%n1\n", - "print\"density of ions at distance equal to five times the mean free path %fn0\"%n2" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 3.7.7 pg.no:93" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "mean square velosity of helium atoms 1304.701955 m/s\n" - ] - } - ], - "source": [ - "#Exa 3.7.7 mean square velocity of He atoms\n", - "# Example 7# Ch 3\n", - "from math import sqrt\n", - "# given data\n", - "N = 178*10**-3 #gas density in kg/mˆ3\n", - "p = 1.01*10**5 # pressure\n", - "v = sqrt((3*p)/N); #mean square velosity of helium atoms\n", - "print\"mean square velosity of helium atoms %f m/s\"%v" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 3.7.1 pg.no:93" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "energy of free electron 3.790687 eV\n" - ] - } - ], - "source": [ - "#Exa 3.7.8 energy of free electrons\n", - "#Example 8# Ch 3\n", - "# given data\n", - "k =1.38e-21; #boltzmanns constant\n", - "T = 293; # temperature in K\n", - "e = 1.6*10** -19;\n", - "E =(1.5*k*T)/e;\n", - "print\"energy of free electron %f eV\"%E" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 3.7.9 pg.no:95" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "no . of atoms/cmˆ3 4.5168e+22\n", - "avg vokume occupied by one atom 2.213957e-23 cmˆ3\n", - "avg seperation between atoms 1.000000e+00 cm\n" - ] - } - ], - "source": [ - "#Exa 3.7.9 avg separation of atoms and avg vol occupied by one atom\n", - "#Example 9# Ch 3\n", - "# given data\n", - "d = 0.075; #density of solid atomic hydrogen in g/cmˆ3\n", - "N_A = 6.0224*10**23; #1g of H consists of NA atoms\n", - "N = N_A*d; # number of atoms/cmˆ3\n", - "print \"no . of atoms/cmˆ3 \",N\n", - "x = 1/N;#avg volume occupied by one atom in cmˆ3\n", - "y = (x)**(1/3);#avg seperation between atoms in cm\n", - "print \"avg vokume occupied by one atom %e cmˆ3\"%x\n", - "print \"avg seperation between atoms %e cm\"%y" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 3.7.10 pg.no:96" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "photon enegy 62.250000 eV\n", - "kinetic energy of photoelectron 48.650000 ev\n", - " velosity of photoelectron 4.133874e+06 m/s\n" - ] - } - ], - "source": [ - "#Exa 3.7.10 KE in eV and velocity of phototelectron\n", - "#Example 10# Ch 3\n", - "from math import sqrt\n", - "# given data\n", - "l=200*10**-10;# wavelength in angstrom\n", - "h=4.15*10**-15;#planks constant\n", - "c=3*10**8;#speed of light\n", - "me=9.11*10**-31;\n", - "BE=13.6;#binding energy in eV\n", - "PE=(h*c)/l;# in eV\n", - "print\"photon enegy %f eV\"%PE\n", - "KE = PE-BE;#in eV\n", - "print\"kinetic energy of photoelectron %f ev\"%KE\n", - "ve=sqrt((2*KE*1.6*10**-19)/me);\n", - "print\" velosity of photoelectron %e m/s\"%ve" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 3.7.11 pg.no:98" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "absorption coefficient -0.000000 cmˆ−1\n" - ] - } - ], - "source": [ - "#Exa 3.7.11 liquid photon absorption coefficient\n", - "#Example 11# Ch 3\n", - "from math import log\n", - "# given data\n", - "I = 1.;\n", - "I0 = 6.;\n", - "x=20;#in cm\n", - "u = -(1/x)*log(I/I0);\n", - "print\"absorption coefficient %f cmˆ−1\"%u" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 3.7.12 pg.no:98" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "binding energy of gas 12.450000 eV\n" - ] - } - ], - "source": [ - "#Exa 3.7.12 binding energy of the gas\n", - "#Example 12# Ch 3\n", - "# given data\n", - "c=3*10**8;\n", - "h=4.15*10**-15;\n", - "lmax =1000*10** -10;\n", - "We=(c*h)/lmax;\n", - "print\"binding energy of gas %f eV\"%We" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 3.7.14 pg.no:105" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "no of gas molecules 3.527492e+22 atoms/mˆ3\n", - "diameter of argon atom 2.769501e-10 m\n" - ] - } - ], - "source": [ - "#Exa 3.7.14 diameter of the argon atom\n", - "#Example 14# Ch 3\n", - "from math import sqrt,pi\n", - "# given data\n", - "p=1.01*10**5/760;# 1 torr in N/m2\n", - "k=1.38*10**-23;\n", - "T=273; # in Kelvin\n", - "n=85*10**2;#no of collisions per meter\n", - "N=p/(k*T);\n", - "print \"no of gas molecules %e atoms/mˆ3\"%N\n", - "r_a=sqrt(n/(pi*N*1));\n", - "print \"diameter of argon atom %e m\"%r_a" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 3.7.15 pg.no:106" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "mobility of electrons 9375.000000 mˆ2/sV\n" - ] - } - ], - "source": [ - "#Exa 3.7.15 mobility of electrons\n", - "#Example 15# Ch 3\n", - "# given data\n", - "Ie=3;# current flow in amperes\n", - "A=8*10**-4;#area of the electrodes in mˆ2\n", - "V=20;#voltage across the electrodes\n", - "d=0.8;#spacing between the electrodes in meters\n", - "n_e=1*10**17;#electron density in mˆ−3\n", - "e=1.6*10**-19;\n", - "ke=(Ie*d)/(A*V*n_e*e);\n", - "print\"mobility of electrons %f mˆ2/sV\"%ke" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 3.7.17 pg.no:108" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "ion density 0.02m away 1.911913e+09 ions/mˆ3 \n", - "\n", - "ion density −0.02m away 5.230363e+12 ions/mˆ3 \n", - "\n" - ] - } - ], - "source": [ - "#Exa 3.7.17 ion density point 02 m away in both directions at 25 deg C amperes\n", - "#Example 17# Ch 3\n", - "from math import exp\n", - "# given data\n", - "E = 5; #electric field in V/m\n", - "n_o = 10**11; #ion density in ions/m3\n", - "T = 293; # in kelvin\n", - "z = 0.02; #distance in meters\n", - "e = 1.6*10**-19; #in couloumb\n", - "k = 1.38*10**-23; # in m2 kg s−2 K−1\n", - "n1 = n_o*exp((-e*E*z)/(k*T));# ion density away \n", - "n2 = n_o*exp((e*E*z)/(k*T));# ion density away −0.02m\n", - "print\"ion density 0.02m away %e ions/mˆ3 \\n\"%n1\n", - "print\"ion density −0.02m away %e ions/mˆ3 \\n\"%n2" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 3.7.18 pg.no:109" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "diameter before drift 3.032550e-05 m \n", - "\n", - "diameter after drift 5.515025e-03 m \n", - "\n" - ] - } - ], - "source": [ - "#Exa 3.7.18 diameter of cloud after drifting a distance of point 05\n", - "#Example 18# Ch 3 2 clc;\n", - "from math import sqrt\n", - "# given data\n", - "E = 250; #electric field in V/m\n", - "r1 = 0.3*10**-3#intial diameter of cloud in meters \n", - "k = 1.38*10**-23;#in m2 kg s−2 K−1\n", - "T = 293; #in kelvin\n", - "e = 1.6*10**-19;# in couloumb\n", - "z = 0.05;#drift distance in meters\n", - "r = (6*k*T*z)/(e*E);#diameter before drift\n", - "print\"diameter before drift %e m \\n\"%r\n", - "r2 = sqrt (r1**2 + r );#diamter after drifting a distance\n", - "print\"diameter after drift %e m \\n\"%r2 \n", - "# round off value calculated for r and r2" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 3.7.19 pg.no:111" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "mean free path of electron in nitrogen 2.221482e-04 m\n", - "ionization potential of nitrogen 28.000000 V\n" - ] - } - ], - "source": [ - "#Exa 3.7.19 a mean free path of electrons in nitrogen and b ionization potential of nitrogen\n", - "#Example 19# Ch 3 \n", - "# given data\n", - "a = 9003;#constant in m−1kPa−1 \n", - "B = 256584;#in V/m.kPa\n", - "p = 0.5;#in kPa\n", - "M = 1/(a*p);#mean free path in meters\n", - "print\"mean free path of electron in nitrogen %e m\"%M\n", - "Vi = B/a; #ionization potential of nitrogen\n", - "print\"ionization potential of nitrogen %f V\"%Vi" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/Hrituraj/Various_types.ipynb b/sample_notebooks/Hrituraj/Various_types.ipynb new file mode 100755 index 00000000..d2ca1e19 --- /dev/null +++ b/sample_notebooks/Hrituraj/Various_types.ipynb @@ -0,0 +1,318 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:0f69a839d3ec8a6e20f49cef0966e931497f52ea6c7ffcec43b822cf678199cf" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Various types of tarrifs" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Exa 11.1 page 290" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "#Given Data :\n", + "E=438000.0 #in kWh(Energy consumed per year)\n", + "pf=0.8 #unitless\n", + "cosfi=pf #unitless\n", + "LoadFactor=40.0 #in %\n", + "#tarrif=Rs. 75/year/kw of max demand plus 3 paise per unit per reactive KVA\n", + "h=8760.0 #no. of years in a year\n", + "AvgLoad=E/h #kw\n", + "MaxLoad=AvgLoad/(LoadFactor/100) #in kw\n", + "MaxLoad_KVA=MaxLoad/pf #in KVA\n", + "tanfi=math.tan(math.acos(cosfi)) #unitless\n", + "ReactiveKVAR=h*tanfi*AvgLoad #in KVA\n", + "AnnualBill=75*MaxLoad+(3/100)*E+(1.5/100)*ReactiveKVAR #in Rs.\n", + "CostPerUnit=AnnualBill/E #in Rs.\n", + "CostPerUnit=CostPerUnit*100 #in Paisa\n", + "print \"Cost per unit is %0.2f Paisa\" %CostPerUnit" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Cost per unit is 3.27 Paisa\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Exa 11.2 page 291" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given Data :\n", + "#tarrif=Rs. 275/year/KVA of max demand plus 35 paise per unit\n", + "C1=275.0 #in Rs.year/KVA\n", + "C2=35.0 #in paisa/unit\n", + "LoadFactor=30.0 #in %/year\n", + "LoadFactor=30.0/100 #in fraction\n", + "#Let MaxDemand = x KW\n", + "#Case (i) PF=1\n", + "cosfi=1 #unitless\n", + "AnnualBillBYx=C1/cosfi+(C2/100)*LoadFactor*24*365 #in Rs.(Here 24*365 is for No. of hours in a year)\n", + "AnnualBill=AnnualBillBYx*100/(LoadFactor*24*365) #in paisa/unit\n", + "print \"Cost per unit(at unity power factor) is %0.2f paisa/unit\" %AnnualBill \n", + "#Case (i) PF=0.8\n", + "cosfi=0.8 #unitless\n", + "AnnualBillBYx=C1/cosfi+(C2/100)*LoadFactor*24*365 #in Rs.(Here 24*365 is for No. of hours in a year)\n", + "AnnualBill=AnnualBillBYx*100/(LoadFactor*24*365) #in paisa/unit\n", + "print \"Cost per unit(at 0.8 power factor) is %0.2f paisa/unit\" %AnnualBill" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Cost per unit(at unity power factor) is 45.46 paisa/unit\n", + "Cost per unit(at 0.8 power factor) is 48.08 paisa/unit\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Exa 11.3 page 292" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "#Given Data :\n", + "FixedLoad=200.0 #in kW\n", + "PF=0.8 #unitless\n", + "cosfi=PF #unitless\n", + "h=10.0 #in hours/day\n", + "d=300.0 #in days\n", + "Time=h*d #in hours\n", + "Energy=FixedLoad*Time #in kwh/year\n", + "# (i) tarrif=Rs. 100/KVA/Annum plus 20 paise per kwh\n", + "C1=100.0 #in Rs.year/KVA\n", + "C2=20.0 #in paisa/kwh\n", + "KVA=FixedLoad/cosfi #in KVA\n", + "AnnualBill=KVA*C1+(C2/100)*Energy #in Rs.\n", + "print \" Case (i) Annual Payment is %0.2f Rs.\" %AnnualBill \n", + "# (ii) tarrif=Rs. 100/KW/Annum plus 20 paise per kwh plus 2 paise/KVARH\n", + "C1=100.0 #in Rs./year/KW\n", + "C2=20.0 #in paisa/kwh\n", + "C3=2.0 #in paisa/KVARH\n", + "tanfi=math.tan(math.acos(cosfi)) #unitless\n", + "ReactiveKVARH=FixedLoad*tanfi*Time #in KVARH\n", + "AnnualBill=C1*FixedLoad+(C2/100)*Energy+(C3/100)*ReactiveKVARH #in Rs.\n", + "print \" Case (ii) Annual Payment is %0.2f Rs.\" %AnnualBill " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Case (i) Annual Payment is 145000.00 Rs.\n", + " Case (ii) Annual Payment is 149000.00 Rs.\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Exa 11.4 page 292" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given Data :\n", + "Energy=180000.0 #in kwh\n", + "LoadFactor=45.0 #in %/year\n", + "LoadFactor=45.0/100 #in fraction\n", + "#Charges=Rs. 50/KW/Annum plus 8 paise per unit\n", + "C1=50 #in Rs.year/KW\n", + "C2=8 #in paisa/unit\n", + "h=365*24 #no. of hours per year\n", + "AvgLoad=Energy/h #in KW\n", + "MaxLoad=AvgLoad/LoadFactor #in KW\n", + "FixCharges=MaxLoad*C1 #in Rs.\n", + "PlusCharges=(C2/100)*Energy #in rs.\n", + "TotalTarrif=FixCharges+PlusCharges #in Rs.\n", + "print \"Total Annual electricity charges is %0.2f Rs.\" %TotalTarrif" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total Annual electricity charges is 2283.11 Rs.\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Exa 11.5 page 293" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given Data :\n", + "Energy=25.0*10**6 #in kwh\n", + "MaxDemand=1600.0 #in KW\n", + "#(i) Rs. 70/KW max demand plus 2 paise per kwh\n", + "C1=70.0 #in Rs.year/KW\n", + "C2=2 #in paisa/unit\n", + "AnnualCost=MaxDemand*C1+(C2/100)*Energy #in Rs.\n", + "print \"Case (i) Annual cost of energy is %0.2f Rs.\" %AnnualCost \n", + "#(ii) Annual cost at a flat rate of 5p/kwh\n", + "C=5.0 #in paisa/kwh\n", + "AnnualCost=(C/100)*Energy #in Rs.\n", + "print \"Case (ii) Annual cost of energy is %0.2f Rs.\" %AnnualCost \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Case (i) Annual cost of energy is 112000.00 Rs.\n", + "Case (ii) Annual cost of energy is 1250000.00 Rs.\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Exa 11.6 page 293" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given Data :\n", + "MaxDemand=20 #in KW\n", + "#(i) Rs. 180/KW/annum max demand plus 15 paise per unit\n", + "#(ii) Flat rate tarrif 40 paise/unit\n", + "C1=180.0 #in Rs.year/KW\n", + "C2=15.0 #in paisa/unit\n", + "#AnnualBill1=C1*MaxDemand+(C2/100)*x x is the energy consumed\n", + "C=40.0 #in paisa/unit\n", + "#AnnualBill2=(C/100)*x x is the energy consumed\n", + "#Puting two bills equal gives :\n", + "x=C1*MaxDemand/((C/100)-(C2/100)) #in kwh\n", + "print \"No. of units to be consumed is %0.2f or in %0.2f kwh \" %(x,x)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No. of units to be consumed is 14400.00 or in 14400.00 kwh \n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Exa 11.7 page 294" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given Data :\n", + "MaxDemand=500.0 #in KW\n", + "LoadFactor=70.0 #in %/year\n", + "LoadFactor=70.0/100 #in fraction\n", + "cosfi=0.8 #unitless\n", + "#(i) Rs. 80/KVA of max demand\n", + "#(ii) Running chargeare 5 paise/kwh\n", + "C1=80.0 #in Rs./KVA\n", + "C2=5.0 #in paisa/kwh\n", + "AvgLoad=MaxDemand*LoadFactor #in KW\n", + "h=365.0*24 #no. of hours per year\n", + "Energy=AvgLoad*h #in kwh\n", + "MaxDemandKVA=MaxDemand/cosfi #in KVA\n", + "AnnualBill=MaxDemandKVA*C1+(C2/100)*Energy #in RS\n", + "print \"Annual bill of consumer is %0.2f Rs.\" %AnnualBill " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Annual bill of consumer is 203300.00 Rs.\n" + ] + } + ], + "prompt_number": 27 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/Hrituraj/Various_types_of.ipynb b/sample_notebooks/Hrituraj/Various_types_of.ipynb deleted file mode 100755 index d2ca1e19..00000000 --- a/sample_notebooks/Hrituraj/Various_types_of.ipynb +++ /dev/null @@ -1,318 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:0f69a839d3ec8a6e20f49cef0966e931497f52ea6c7ffcec43b822cf678199cf" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Various types of tarrifs" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Exa 11.1 page 290" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#Given Data :\n", - "E=438000.0 #in kWh(Energy consumed per year)\n", - "pf=0.8 #unitless\n", - "cosfi=pf #unitless\n", - "LoadFactor=40.0 #in %\n", - "#tarrif=Rs. 75/year/kw of max demand plus 3 paise per unit per reactive KVA\n", - "h=8760.0 #no. of years in a year\n", - "AvgLoad=E/h #kw\n", - "MaxLoad=AvgLoad/(LoadFactor/100) #in kw\n", - "MaxLoad_KVA=MaxLoad/pf #in KVA\n", - "tanfi=math.tan(math.acos(cosfi)) #unitless\n", - "ReactiveKVAR=h*tanfi*AvgLoad #in KVA\n", - "AnnualBill=75*MaxLoad+(3/100)*E+(1.5/100)*ReactiveKVAR #in Rs.\n", - "CostPerUnit=AnnualBill/E #in Rs.\n", - "CostPerUnit=CostPerUnit*100 #in Paisa\n", - "print \"Cost per unit is %0.2f Paisa\" %CostPerUnit" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Cost per unit is 3.27 Paisa\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Exa 11.2 page 291" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given Data :\n", - "#tarrif=Rs. 275/year/KVA of max demand plus 35 paise per unit\n", - "C1=275.0 #in Rs.year/KVA\n", - "C2=35.0 #in paisa/unit\n", - "LoadFactor=30.0 #in %/year\n", - "LoadFactor=30.0/100 #in fraction\n", - "#Let MaxDemand = x KW\n", - "#Case (i) PF=1\n", - "cosfi=1 #unitless\n", - "AnnualBillBYx=C1/cosfi+(C2/100)*LoadFactor*24*365 #in Rs.(Here 24*365 is for No. of hours in a year)\n", - "AnnualBill=AnnualBillBYx*100/(LoadFactor*24*365) #in paisa/unit\n", - "print \"Cost per unit(at unity power factor) is %0.2f paisa/unit\" %AnnualBill \n", - "#Case (i) PF=0.8\n", - "cosfi=0.8 #unitless\n", - "AnnualBillBYx=C1/cosfi+(C2/100)*LoadFactor*24*365 #in Rs.(Here 24*365 is for No. of hours in a year)\n", - "AnnualBill=AnnualBillBYx*100/(LoadFactor*24*365) #in paisa/unit\n", - "print \"Cost per unit(at 0.8 power factor) is %0.2f paisa/unit\" %AnnualBill" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Cost per unit(at unity power factor) is 45.46 paisa/unit\n", - "Cost per unit(at 0.8 power factor) is 48.08 paisa/unit\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Exa 11.3 page 292" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#Given Data :\n", - "FixedLoad=200.0 #in kW\n", - "PF=0.8 #unitless\n", - "cosfi=PF #unitless\n", - "h=10.0 #in hours/day\n", - "d=300.0 #in days\n", - "Time=h*d #in hours\n", - "Energy=FixedLoad*Time #in kwh/year\n", - "# (i) tarrif=Rs. 100/KVA/Annum plus 20 paise per kwh\n", - "C1=100.0 #in Rs.year/KVA\n", - "C2=20.0 #in paisa/kwh\n", - "KVA=FixedLoad/cosfi #in KVA\n", - "AnnualBill=KVA*C1+(C2/100)*Energy #in Rs.\n", - "print \" Case (i) Annual Payment is %0.2f Rs.\" %AnnualBill \n", - "# (ii) tarrif=Rs. 100/KW/Annum plus 20 paise per kwh plus 2 paise/KVARH\n", - "C1=100.0 #in Rs./year/KW\n", - "C2=20.0 #in paisa/kwh\n", - "C3=2.0 #in paisa/KVARH\n", - "tanfi=math.tan(math.acos(cosfi)) #unitless\n", - "ReactiveKVARH=FixedLoad*tanfi*Time #in KVARH\n", - "AnnualBill=C1*FixedLoad+(C2/100)*Energy+(C3/100)*ReactiveKVARH #in Rs.\n", - "print \" Case (ii) Annual Payment is %0.2f Rs.\" %AnnualBill " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Case (i) Annual Payment is 145000.00 Rs.\n", - " Case (ii) Annual Payment is 149000.00 Rs.\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Exa 11.4 page 292" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given Data :\n", - "Energy=180000.0 #in kwh\n", - "LoadFactor=45.0 #in %/year\n", - "LoadFactor=45.0/100 #in fraction\n", - "#Charges=Rs. 50/KW/Annum plus 8 paise per unit\n", - "C1=50 #in Rs.year/KW\n", - "C2=8 #in paisa/unit\n", - "h=365*24 #no. of hours per year\n", - "AvgLoad=Energy/h #in KW\n", - "MaxLoad=AvgLoad/LoadFactor #in KW\n", - "FixCharges=MaxLoad*C1 #in Rs.\n", - "PlusCharges=(C2/100)*Energy #in rs.\n", - "TotalTarrif=FixCharges+PlusCharges #in Rs.\n", - "print \"Total Annual electricity charges is %0.2f Rs.\" %TotalTarrif" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total Annual electricity charges is 2283.11 Rs.\n" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Exa 11.5 page 293" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given Data :\n", - "Energy=25.0*10**6 #in kwh\n", - "MaxDemand=1600.0 #in KW\n", - "#(i) Rs. 70/KW max demand plus 2 paise per kwh\n", - "C1=70.0 #in Rs.year/KW\n", - "C2=2 #in paisa/unit\n", - "AnnualCost=MaxDemand*C1+(C2/100)*Energy #in Rs.\n", - "print \"Case (i) Annual cost of energy is %0.2f Rs.\" %AnnualCost \n", - "#(ii) Annual cost at a flat rate of 5p/kwh\n", - "C=5.0 #in paisa/kwh\n", - "AnnualCost=(C/100)*Energy #in Rs.\n", - "print \"Case (ii) Annual cost of energy is %0.2f Rs.\" %AnnualCost \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Case (i) Annual cost of energy is 112000.00 Rs.\n", - "Case (ii) Annual cost of energy is 1250000.00 Rs.\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Exa 11.6 page 293" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given Data :\n", - "MaxDemand=20 #in KW\n", - "#(i) Rs. 180/KW/annum max demand plus 15 paise per unit\n", - "#(ii) Flat rate tarrif 40 paise/unit\n", - "C1=180.0 #in Rs.year/KW\n", - "C2=15.0 #in paisa/unit\n", - "#AnnualBill1=C1*MaxDemand+(C2/100)*x x is the energy consumed\n", - "C=40.0 #in paisa/unit\n", - "#AnnualBill2=(C/100)*x x is the energy consumed\n", - "#Puting two bills equal gives :\n", - "x=C1*MaxDemand/((C/100)-(C2/100)) #in kwh\n", - "print \"No. of units to be consumed is %0.2f or in %0.2f kwh \" %(x,x)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No. of units to be consumed is 14400.00 or in 14400.00 kwh \n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Exa 11.7 page 294" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given Data :\n", - "MaxDemand=500.0 #in KW\n", - "LoadFactor=70.0 #in %/year\n", - "LoadFactor=70.0/100 #in fraction\n", - "cosfi=0.8 #unitless\n", - "#(i) Rs. 80/KVA of max demand\n", - "#(ii) Running chargeare 5 paise/kwh\n", - "C1=80.0 #in Rs./KVA\n", - "C2=5.0 #in paisa/kwh\n", - "AvgLoad=MaxDemand*LoadFactor #in KW\n", - "h=365.0*24 #no. of hours per year\n", - "Energy=AvgLoad*h #in kwh\n", - "MaxDemandKVA=MaxDemand/cosfi #in KVA\n", - "AnnualBill=MaxDemandKVA*C1+(C2/100)*Energy #in RS\n", - "print \"Annual bill of consumer is %0.2f Rs.\" %AnnualBill " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Annual bill of consumer is 203300.00 Rs.\n" - ] - } - ], - "prompt_number": 27 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/InnamuriBhavitha/Chapter_1.ipynb b/sample_notebooks/InnamuriBhavitha/Chapter_1.ipynb new file mode 100755 index 00000000..3369137f --- /dev/null +++ b/sample_notebooks/InnamuriBhavitha/Chapter_1.ipynb @@ -0,0 +1,234 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 1 CRYSTAL STRUCTURES" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1_4 pgno:22" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a= 1.0\n", + "r=a/2 = 0.5\n", + "Volume of one atom ,v=((4∗%pi∗(rˆ3))/3)= 0.523598775598\n", + "Total Volume of the cube ,V=aˆ3 = 1.0\n", + "Fp(S.C)=(v∗100/V)= 52.3598775598\n" + ] + } + ], + "source": [ + "#exa 1.4\n", + "from math import pi\n", + "a=1.\n", + "print \"a= \",a # initializing value of lattice constant(a)=1.\n", + "r=a/2.\n", + "print \"r=a/2 = \",r # initializing value of radius of atom for simple cubic .\n", + "v=((4*pi*(r**3))/3)\n", + "print \"Volume of one atom ,v=((4∗%pi∗(rˆ3))/3)= \",v # calcuation . \n", + "V=a**3\n", + "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n", + "Fp=(v*100/V)\n", + "print \"Fp(S.C)=(v∗100/V)= \",Fp,# calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1_5 pgno:24" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a= 1.0\n", + "Radius of the atoms,r=(sqrt(3)∗(aˆ2/4)) = 0.433012701892\n", + "Volume of two atom,v=((4∗pi∗(rˆ3))/3)∗2 = 0.680174761588\n", + "Total Volume of the cube ,V=aˆ3 = 1.0\n", + "Fp(B.C.C)=(v∗100/V)= 68.0174761588 %\n" + ] + } + ], + "source": [ + "#exa 1.5\n", + "from math import sqrt\n", + "a=1.\n", + "print \"a= \",a # initializing value of lattice constant(a)=1.\n", + "r=(sqrt(3)*(a**2/4))\n", + "print \"Radius of the atoms,r=(sqrt(3)∗(aˆ2/4)) = \",r # initializing value of radius of atom for BCC.\n", + "v=((4*pi*(r**3))/3)*2\n", + "print \"Volume of two atom,v=((4∗pi∗(rˆ3))/3)∗2 = \",v # calcuation \n", + "V=a**3\n", + "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n", + "Fp=(v*100/V)\n", + "print \"Fp(B.C.C)=(v∗100/V)= \",Fp,\"%\" # calculation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_6 pgno:25" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a= 1\n", + "Radius of the atom,r=(a/(2∗sqrt(2)))= 0.353553390593\n", + "Volume of the four atom,v=(((4∗pi∗(rˆ3))/3)∗4)= 0.740480489693\n", + "Total volume of the cube ,V=aˆ3= 2\n", + "Fp(F.C.C)=(v∗100/V)= 37.0240244847 %\n" + ] + } + ], + "source": [ + "#exa 1.6\n", + "a=1\n", + "print \"a= \",a # initializing value of lattice constant(a)=1.\n", + "r=(a/(2*sqrt(2)))\n", + "print \"Radius of the atom,r=(a/(2∗sqrt(2)))= \",r # initializing value of radius of atom for FCC .\n", + "v=(((4*pi*(r**3))/3)*4)\n", + "print \"Volume of the four atom,v=(((4∗pi∗(rˆ3))/3)∗4)= \",v # calcuation \n", + "V=a^3\n", + "print \"Total volume of the cube ,V=aˆ3= \",V # calcuation .\n", + "Fp=(v*100/V)\n", + "print \"Fp(F.C.C)=(v∗100/V)= \",Fp,\"%\" # calculation\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_8 pgno:26" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a= 1\n", + "Radius of the atom , r=(sqrt (3)∗a/8))= 0.216506350946\n", + "v=(((4∗pi∗(rˆ3))/3)∗8) = 0.340087380794\n", + "V=aˆ3= 2\n", + "Fp(Diamond)=(v∗100/V) = 17.0043690397 %\n" + ] + } + ], + "source": [ + "#Exa 1.8 \n", + "a=1\n", + "print \"a= \",a # initializing value of lattice constant(a)=1.\n", + "r=((sqrt(3)*a/8))\n", + "print \"Radius of the atom , r=(sqrt (3)∗a/8))= \",r # initializing value of radius of atom for diamond .\n", + "v=(((4*pi*(r**3))/3)*8)\n", + "print \"v=(((4∗pi∗(rˆ3))/3)∗8) = \",v # calcuation .\n", + "V=a^3\n", + "print \"V=aˆ3= \",V # calcuation .\n", + "Fp=(v*100/V)\n", + "print \"Fp(Diamond)=(v∗100/V) = \",Fp,\"%\" # calculation\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## example 1_9 pgno:28" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a = 5e-08 cm\n", + "Radius of the atom,r=(sqrt(3)∗(a/4))= 2.16506350946e-08\n", + "Volume of the two atoms ,v=((4∗pi∗(rˆ3))/3)∗2= 8.50218451985e-23\n", + "Total Volume of the cube ,V=aˆ3 = 1.25e-22\n", + "Fp(B.C.C)=(v∗100/V) = 68.0174761588 %\n" + ] + } + ], + "source": [ + "#exa 1.9\n", + "a=5*10**-8\n", + "print \"a = \",a,\" cm\" # initializing value of lattice constant .\n", + "r=(sqrt(3)*(a/4))\n", + "print \"Radius of the atom,r=(sqrt(3)∗(a/4))= \",r # initializing value of radius of atom for BCC.\n", + "v=((4*pi*(r**3))/3)*2\n", + "print \"Volume of the two atoms ,v=((4∗pi∗(rˆ3))/3)∗2= \",v # calcuation .\n", + "V=a**3\n", + "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n", + "Fp=(v*100/V)\n", + "print \"Fp(B.C.C)=(v∗100/V) = \",Fp,\"%\" # calculation" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/InnamuriBhavitha/Chapter_1_CRYSTAL.ipynb b/sample_notebooks/InnamuriBhavitha/Chapter_1_CRYSTAL.ipynb deleted file mode 100755 index 3369137f..00000000 --- a/sample_notebooks/InnamuriBhavitha/Chapter_1_CRYSTAL.ipynb +++ /dev/null @@ -1,234 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 1 CRYSTAL STRUCTURES" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 1_4 pgno:22" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a= 1.0\n", - "r=a/2 = 0.5\n", - "Volume of one atom ,v=((4∗%pi∗(rˆ3))/3)= 0.523598775598\n", - "Total Volume of the cube ,V=aˆ3 = 1.0\n", - "Fp(S.C)=(v∗100/V)= 52.3598775598\n" - ] - } - ], - "source": [ - "#exa 1.4\n", - "from math import pi\n", - "a=1.\n", - "print \"a= \",a # initializing value of lattice constant(a)=1.\n", - "r=a/2.\n", - "print \"r=a/2 = \",r # initializing value of radius of atom for simple cubic .\n", - "v=((4*pi*(r**3))/3)\n", - "print \"Volume of one atom ,v=((4∗%pi∗(rˆ3))/3)= \",v # calcuation . \n", - "V=a**3\n", - "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n", - "Fp=(v*100/V)\n", - "print \"Fp(S.C)=(v∗100/V)= \",Fp,# calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 1_5 pgno:24" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a= 1.0\n", - "Radius of the atoms,r=(sqrt(3)∗(aˆ2/4)) = 0.433012701892\n", - "Volume of two atom,v=((4∗pi∗(rˆ3))/3)∗2 = 0.680174761588\n", - "Total Volume of the cube ,V=aˆ3 = 1.0\n", - "Fp(B.C.C)=(v∗100/V)= 68.0174761588 %\n" - ] - } - ], - "source": [ - "#exa 1.5\n", - "from math import sqrt\n", - "a=1.\n", - "print \"a= \",a # initializing value of lattice constant(a)=1.\n", - "r=(sqrt(3)*(a**2/4))\n", - "print \"Radius of the atoms,r=(sqrt(3)∗(aˆ2/4)) = \",r # initializing value of radius of atom for BCC.\n", - "v=((4*pi*(r**3))/3)*2\n", - "print \"Volume of two atom,v=((4∗pi∗(rˆ3))/3)∗2 = \",v # calcuation \n", - "V=a**3\n", - "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n", - "Fp=(v*100/V)\n", - "print \"Fp(B.C.C)=(v∗100/V)= \",Fp,\"%\" # calculation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_6 pgno:25" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a= 1\n", - "Radius of the atom,r=(a/(2∗sqrt(2)))= 0.353553390593\n", - "Volume of the four atom,v=(((4∗pi∗(rˆ3))/3)∗4)= 0.740480489693\n", - "Total volume of the cube ,V=aˆ3= 2\n", - "Fp(F.C.C)=(v∗100/V)= 37.0240244847 %\n" - ] - } - ], - "source": [ - "#exa 1.6\n", - "a=1\n", - "print \"a= \",a # initializing value of lattice constant(a)=1.\n", - "r=(a/(2*sqrt(2)))\n", - "print \"Radius of the atom,r=(a/(2∗sqrt(2)))= \",r # initializing value of radius of atom for FCC .\n", - "v=(((4*pi*(r**3))/3)*4)\n", - "print \"Volume of the four atom,v=(((4∗pi∗(rˆ3))/3)∗4)= \",v # calcuation \n", - "V=a^3\n", - "print \"Total volume of the cube ,V=aˆ3= \",V # calcuation .\n", - "Fp=(v*100/V)\n", - "print \"Fp(F.C.C)=(v∗100/V)= \",Fp,\"%\" # calculation\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_8 pgno:26" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a= 1\n", - "Radius of the atom , r=(sqrt (3)∗a/8))= 0.216506350946\n", - "v=(((4∗pi∗(rˆ3))/3)∗8) = 0.340087380794\n", - "V=aˆ3= 2\n", - "Fp(Diamond)=(v∗100/V) = 17.0043690397 %\n" - ] - } - ], - "source": [ - "#Exa 1.8 \n", - "a=1\n", - "print \"a= \",a # initializing value of lattice constant(a)=1.\n", - "r=((sqrt(3)*a/8))\n", - "print \"Radius of the atom , r=(sqrt (3)∗a/8))= \",r # initializing value of radius of atom for diamond .\n", - "v=(((4*pi*(r**3))/3)*8)\n", - "print \"v=(((4∗pi∗(rˆ3))/3)∗8) = \",v # calcuation .\n", - "V=a^3\n", - "print \"V=aˆ3= \",V # calcuation .\n", - "Fp=(v*100/V)\n", - "print \"Fp(Diamond)=(v∗100/V) = \",Fp,\"%\" # calculation\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## example 1_9 pgno:28" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a = 5e-08 cm\n", - "Radius of the atom,r=(sqrt(3)∗(a/4))= 2.16506350946e-08\n", - "Volume of the two atoms ,v=((4∗pi∗(rˆ3))/3)∗2= 8.50218451985e-23\n", - "Total Volume of the cube ,V=aˆ3 = 1.25e-22\n", - "Fp(B.C.C)=(v∗100/V) = 68.0174761588 %\n" - ] - } - ], - "source": [ - "#exa 1.9\n", - "a=5*10**-8\n", - "print \"a = \",a,\" cm\" # initializing value of lattice constant .\n", - "r=(sqrt(3)*(a/4))\n", - "print \"Radius of the atom,r=(sqrt(3)∗(a/4))= \",r # initializing value of radius of atom for BCC.\n", - "v=((4*pi*(r**3))/3)*2\n", - "print \"Volume of the two atoms ,v=((4∗pi∗(rˆ3))/3)∗2= \",v # calcuation .\n", - "V=a**3\n", - "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n", - "Fp=(v*100/V)\n", - "print \"Fp(B.C.C)=(v∗100/V) = \",Fp,\"%\" # calculation" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/JayDadlani/SAMPLE_NB.ipynb b/sample_notebooks/JayDadlani/SAMPLE_NB.ipynb new file mode 100755 index 00000000..7ccc9697 --- /dev/null +++ b/sample_notebooks/JayDadlani/SAMPLE_NB.ipynb @@ -0,0 +1,220 @@ +{ + "metadata": { + "celltoolbar": "Raw Cell Format", + "name": "", + "signature": "sha256:58e66a1486b17622aacd34bb93b225c18134442ddc1f2fbedecd0abdd0c9b88e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "A TEXTBOOK OF PHYSICAL CHEMISTRY BY K.I. KAPOOR" + ] + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "CHAPTER NUMBER 1 : EQUILIBRIUM BETWEEN PHASES" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE NUMBER 1.5.1 : PAGE NUMBER 10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "T1 = 234.5 # Temperature in K\n", + "P = 1 # Pressure in atm\n", + "rho1 = 14.19 # Density of solid Hg in g/(cm**3)\n", + "rho2 = 13.70 # Density of liquid Hg in g/(cm**3)\n", + "V = 200.59 # volume of liquid and solid in g/mol\n", + "delV = ((V/rho2)-(V/rho1))*(10**-3)# in dm**3/mol\n", + "delTdelP = 0.0051 # K/atm\n", + "R1 = 8.314 # in J\n", + "R2 = 0.082 # in (dm)**3/atm\n", + "delH = ((delV*T1)/(delTdelP))*(R1/R2)*10**-3;#molar heat of fusion in kJ/mol\n", + "print \" delH = \",round(delH,4),\"(KJ)/mol \"\n", + "T2 = 273# in K\n", + "delP = (delH*(R2/R1)*(T2-T1))/(delV*T1)*10**3;#pressure required to raise melting point to T2 in atm\n", + "print \" delP = \",round(delP,4),\"atm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " delH = 2.3571 (KJ)/mol \n", + " delP = 7549.0196 atm\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE NUMBER 1.5.2 : PAGE NUMBER 15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math;\n", + "T1=373.15;#in K\n", + "P=1;#atm\n", + "Vv=1674;#in cm**3/gm\n", + "delPdelT=27.12;#in torr/K\n", + "R1=8.314;#in J\n", + "R2=0.082;#in atm/(dm)**3\n", + "delH=((delPdelT)/760)*T1*((Vv*10**-3)*18)*(R1/R2)\n", + "print \" delH = \",round(delH,4),\" J/mol \"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " delH = 40680.2549 J/mol \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE NUMBER 1.5.3 : PAGE NUMBER 16" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math;\n", + "T1=313.75;#in K\n", + "P1=59.1;#in torr\n", + "T2=353.15;#in K\n", + "P2=298.7;#in torr\n", + "R=2.303*8.314;#in J/(K*mol)\n", + "delH=R*math.log10(P2/P1)*((T2*T1)/(T2-T1))\n", + "print \" delH= \",round(delH,4),\" J/mol \"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " delH= 37888.375 J/mol \n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE NUMBER 1.5.4 : PAGE NUMBER 16" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "T1=325.15;#in K\n", + "T2=338.15;#in K\n", + "P2=760;#in torr\n", + "DelHm_v=10.5;#\n", + "P1=P2/(10**((DelHm_v/2.303)*((T2/T1)-1)));#in torr\n", + "print \" P1= \",round(P1,4),\"torr \"\n", + "P=200;#in torr\n", + "T=T2/(1+((2.303/10.5)*math.log10(P2/P)));#in K\n", + "print \" T =\",round(T,4),\" K \"\n", + "I=math.log10(P2)-(((DelHm_v*T2)/2.303)*(-1/T2));#\n", + "print \" I = \",round(I,4)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " P1= 499.4901 torr \n", + " T = 306.1154 K \n", + " I = 7.4401\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE NUMBER 1.5.5 : PAGE NUMBER 17" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math;\n", + "P=760;#in torr\n", + "dP=52;#in torr\n", + "dT=2;#in K\n", + "DelH_RTb=10.5;#Trouton rule\n", + "Tb=(DelH_RTb*P)/(dP/dT)\n", + "print \" Tb = \",round(Tb,4),\" K\"\n", + "R=8.314;#in J/Kmol\n", + "DelH_v=(DelH_RTb*R*Tb)\n", + "print \" DelH_v = \",round(DelH_v,4),\"J/mol \"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Tb = 306.9231 K\n", + " DelH_v = 26793.4638 J/mol \n" + ] + } + ], + "prompt_number": 16 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/JayDadlani/SAMPLE_NB_KI.ipynb b/sample_notebooks/JayDadlani/SAMPLE_NB_KI.ipynb deleted file mode 100755 index 7ccc9697..00000000 --- a/sample_notebooks/JayDadlani/SAMPLE_NB_KI.ipynb +++ /dev/null @@ -1,220 +0,0 @@ -{ - "metadata": { - "celltoolbar": "Raw Cell Format", - "name": "", - "signature": "sha256:58e66a1486b17622aacd34bb93b225c18134442ddc1f2fbedecd0abdd0c9b88e" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "A TEXTBOOK OF PHYSICAL CHEMISTRY BY K.I. KAPOOR" - ] - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "CHAPTER NUMBER 1 : EQUILIBRIUM BETWEEN PHASES" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE NUMBER 1.5.1 : PAGE NUMBER 10" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math \n", - "T1 = 234.5 # Temperature in K\n", - "P = 1 # Pressure in atm\n", - "rho1 = 14.19 # Density of solid Hg in g/(cm**3)\n", - "rho2 = 13.70 # Density of liquid Hg in g/(cm**3)\n", - "V = 200.59 # volume of liquid and solid in g/mol\n", - "delV = ((V/rho2)-(V/rho1))*(10**-3)# in dm**3/mol\n", - "delTdelP = 0.0051 # K/atm\n", - "R1 = 8.314 # in J\n", - "R2 = 0.082 # in (dm)**3/atm\n", - "delH = ((delV*T1)/(delTdelP))*(R1/R2)*10**-3;#molar heat of fusion in kJ/mol\n", - "print \" delH = \",round(delH,4),\"(KJ)/mol \"\n", - "T2 = 273# in K\n", - "delP = (delH*(R2/R1)*(T2-T1))/(delV*T1)*10**3;#pressure required to raise melting point to T2 in atm\n", - "print \" delP = \",round(delP,4),\"atm\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " delH = 2.3571 (KJ)/mol \n", - " delP = 7549.0196 atm\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE NUMBER 1.5.2 : PAGE NUMBER 15" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math;\n", - "T1=373.15;#in K\n", - "P=1;#atm\n", - "Vv=1674;#in cm**3/gm\n", - "delPdelT=27.12;#in torr/K\n", - "R1=8.314;#in J\n", - "R2=0.082;#in atm/(dm)**3\n", - "delH=((delPdelT)/760)*T1*((Vv*10**-3)*18)*(R1/R2)\n", - "print \" delH = \",round(delH,4),\" J/mol \"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " delH = 40680.2549 J/mol \n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE NUMBER 1.5.3 : PAGE NUMBER 16" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math;\n", - "T1=313.75;#in K\n", - "P1=59.1;#in torr\n", - "T2=353.15;#in K\n", - "P2=298.7;#in torr\n", - "R=2.303*8.314;#in J/(K*mol)\n", - "delH=R*math.log10(P2/P1)*((T2*T1)/(T2-T1))\n", - "print \" delH= \",round(delH,4),\" J/mol \"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " delH= 37888.375 J/mol \n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE NUMBER 1.5.4 : PAGE NUMBER 16" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "T1=325.15;#in K\n", - "T2=338.15;#in K\n", - "P2=760;#in torr\n", - "DelHm_v=10.5;#\n", - "P1=P2/(10**((DelHm_v/2.303)*((T2/T1)-1)));#in torr\n", - "print \" P1= \",round(P1,4),\"torr \"\n", - "P=200;#in torr\n", - "T=T2/(1+((2.303/10.5)*math.log10(P2/P)));#in K\n", - "print \" T =\",round(T,4),\" K \"\n", - "I=math.log10(P2)-(((DelHm_v*T2)/2.303)*(-1/T2));#\n", - "print \" I = \",round(I,4)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " P1= 499.4901 torr \n", - " T = 306.1154 K \n", - " I = 7.4401\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "EXAMPLE NUMBER 1.5.5 : PAGE NUMBER 17" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math;\n", - "P=760;#in torr\n", - "dP=52;#in torr\n", - "dT=2;#in K\n", - "DelH_RTb=10.5;#Trouton rule\n", - "Tb=(DelH_RTb*P)/(dP/dT)\n", - "print \" Tb = \",round(Tb,4),\" K\"\n", - "R=8.314;#in J/Kmol\n", - "DelH_v=(DelH_RTb*R*Tb)\n", - "print \" DelH_v = \",round(DelH_v,4),\"J/mol \"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Tb = 306.9231 K\n", - " DelH_v = 26793.4638 J/mol \n" - ] - } - ], - "prompt_number": 16 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/KavinkumarD/Chapter_11__Impulse_and.ipynb b/sample_notebooks/KavinkumarD/Chapter_11__Impulse_and.ipynb new file mode 100755 index 00000000..5415ad01 --- /dev/null +++ b/sample_notebooks/KavinkumarD/Chapter_11__Impulse_and.ipynb @@ -0,0 +1,345 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:38f9fe4fd8a5c174c9e1dd9b5dc21976f4cdd814f7eb8fcfe0c266e278f9a77b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 11 : Impulse and Reaction Turbines" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.1 and Page No:454" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "p02=6; # Inlet pressure in bar\n", + "T02=900; # Inlet temperature in kelvin\n", + "p0fs=1; # Outlet pressure in bar\n", + "eff_isenT=0.85; # insentropic efficiency of turbine\n", + "alpha_2=math.radians(75); # Nozzle outlet angle in degree and conversion to radians\n", + "u=250; # Mean blade velocity in m/s\n", + "Cp=1.15*10**3; # Specific heat in J/ kg K\n", + "r=1.333; # Specific heat ratio\n", + "\n", + "#Calculations\n", + "T0fs=T02/(p02/p0fs)**((r-1)/r); # Isentropic temperature at the exit of the final stage\n", + "Del_Toverall=eff_isenT*(T02-T0fs); # Actual overall temperature drop\n", + "c2=2*u/math.sin (alpha_2); # absolute velocity\n", + "c3= c2*math.cos (alpha_2);# absolute velocity\n", + "c1=c3; # From velocity triangles\n", + "Del_Tstage=(c2**2-c1**2)/(2*Cp); # Stage temperature drop\n", + "n=Del_Toverall/Del_Tstage; # Number of stages\n", + "\n", + "#Results\n", + "print \"Number of stages n =\",round (n,0);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of stages n = 3.0\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.2 and Page No:455" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "N=10000; # Speed of gas turbine in rpm\n", + "T01=700+273.15; # Total head temperature at nozzle entry in kelvin\n", + "P01=4.5; #Total head pressure at nozzle entry in bar\n", + "P02=2.6; # Outlet pressure from nozzle in bar\n", + "p3=1.5;# Pressure at trbine outlet annulus in bar\n", + "M=0.5; # Mach number at outlet\n", + "alpha_2=math.radians(70); # outlet nozzle angle in degrees and conversion to radians\n", + "D=64; # Blade mean diameter in cm\n", + "m=22.5; # Mass flow rate in kg/s\n", + "eff_T=0.99; # turbine mechanical efficiency\n", + "Cp=1.147; # Specific heat in kJ/kg K\n", + "r=1.33; # Specific heat ratio\n", + "fl=0.03; # frictional loss\n", + "R=284.6; # characteristic gas constant in J/kg K\n", + "\n", + "#Calculations\n", + "eff_N=1-fl; # Nozzle efficiency\n", + "T_02=(P02/P01)**((r-1)/r)*T01; # Isentropic temperature after expansion\n", + "T02=T01-eff_N*(T01-T_02); # Actual temperature after expansion\n", + "c2=math.sqrt (2*Cp*10**3*(T01-T02)); # Absolute velocity\n", + "u=(3.14*D*10**-2*N)/60; # Mean blade velocity\n", + "# From velocity triangles\n", + "wt2=c2*math.sin( (alpha_2))-u;\n", + "ca=c2*math.cos( (alpha_2));\n", + "beta_2=(math.atan((wt2)/ca));\n", + "T3=T02/(P02/p3)**((r-1)/r); # Assuming rotor losses are negligible\n", + "c3=M*math.sqrt (r*R*T3); # Absolute velocity\n", + "beta_3=(math.atan(u/c3));\n", + "ct2=c2*math.sin((alpha_2));\n", + "P=eff_T*m*(ct2)*u/1000; # Power developed\n", + "\n", + "#Results\n", + "print \"(i).\"\n", + "print \"\\tGas angle at entry = \",round (math.degrees(beta_2),3),\"degree\"\n", + "print \"\\tGas angle at exit = \",round (math.degrees(beta_3),3),\"degree\"\n", + "print \"(ii).\"\n", + "print \"\\tPower developed = \",round(P,3),\"kW (roundoff error)\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i).\n", + "\tGas angle at entry = 41.411 degree\n", + "\tGas angle at exit = 51.609 degree\n", + "(ii).\n", + "\tPower developed = 3680.184 kW (roundoff error)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.3 and Page No:457" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "alpha_2=math.radians(65); # Nozzle discharge angle in degree and conversion to radians\n", + "c3=300; # Absolute velocity in m/s\n", + "alpha_3=math.radians(30); # in degrees and conversion to radians\n", + "\n", + "#Calculations\n", + "ca2=c3*math.cos (alpha_3); # Axial velocity\n", + "c2=ca2/math.cos(alpha_2); # Absolute velocity\n", + "# ca3=ca2=ca and equal blade angles then\n", + "ca=ca2;\n", + "beta_2=math.atan((c2*math.sin(alpha_2)+c3*math.sin(alpha_3))/(2*ca)); # Blade angle\n", + "beta_3=beta_2; # equal blade angles\n", + "u=c2*math.sin(alpha_2)-ca2*math.tan(beta_2); # Mean blade velocity\n", + "# From velocity triangles\n", + "ct2=c2*math.sin(alpha_2);\n", + "ct3=c3*math.sin(alpha_3);\n", + "WT=u*(ct2+ct3)/1000; # Work done\n", + "sigma=u/c2; # optimum speed ratio\n", + "eff_B=4*(sigma*math.sin(alpha_2)-sigma**2);\n", + "\n", + "#Results\n", + "print \"Blade angle = beta_2= beta_3 = \",round (math.degrees(beta_2),3),\"degree\"\n", + "print \"Power Produced = \",round(WT,3),\"kJ/kg (roundoff error)\"\n", + "print \"Blade efficiency = \",round(eff_B*100,2),\"%\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Blade angle = beta_2= beta_3 = 53.692 degree\n", + "Power Produced = 143.963 kJ/kg (roundoff error)\n", + "Blade efficiency = 76.19 %\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.4 and Page No:458" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "P01=7; # Pressure at inlet in bar\n", + "T01=300+273.15; # Temperature at inlet in kelvin\n", + "P02=3; # Pressure at outlet in bar\n", + "alpha_2=math.radians(70); # Nozzle angle in degree and conversion to radians\n", + "eff_N=0.9; # Isentropic efficiency of nozzle\n", + "WT=75; # Power Produced in kW\n", + "Cp=1.15; # Specific heat in kJ/kg K\n", + "r=1.33; # Specific heat ratio\n", + "\n", + "#Calculations\n", + "T_02=T01*(P02/P01)**((r-1)/r); # Isentropic temperature after expansion\n", + "T02=T01-eff_N*(T01-T_02); # Actual temperature after expansion\n", + "c2=math.sqrt (2*Cp*10**3*(T01-T02)); # Absolute velocity\n", + "# For optimum blade speed ratio\n", + "u=(c2*math.sin (alpha_2)/2); # Mean blade velocity\n", + "beta_2=math.atan((c2*math.sin(alpha_2)-u)/(c2*math.cos(alpha_2))); # Blade angle\n", + "# From velocity triangles\n", + "ct2=c2*math.sin(alpha_2);\n", + "w2=c2*math.cos(alpha_2)/math.cos(beta_2);\n", + "w3=w2; # Equal inlet and outlet angles\n", + "beta_3=54; # in degrees\n", + "ct3=w3*math.sin(beta_3)-u;\n", + "m=(WT*10**3)/(u*(ct2+ct3)); # Gas mass flow rate\n", + "\n", + "#Results\n", + "print \"Blade angle = \",round(math.degrees(beta_2),3),\"degree\"\n", + "print \"Gas Mass Flow Rate = \",round(m,3),\"kg/s\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Blade angle = 53.948 degree\n", + "Gas Mass Flow Rate = 4.89 kg/s\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.5 and Page No:460" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "P01=4.6; # Total head inlet pressure in bar\n", + "T01=700+273.15; # Total head inlet temperature in kelvin\n", + "P2=1.6; # Static head pressure at mean radius in bar\n", + "Dm_h=10; # Mean blade diameter/blade height\n", + "lc=0.1; # Nozzle losses coefficient\n", + "alpha_2=math.radians(60); # Nozzle outlet angle in degree and conversion to radians\n", + "Cp=1.147; # Specific heat in kJ/kg K\n", + "r=1.33; # Specific heat ratio\n", + "m=20; # Mass flow rate in kg/s\n", + "R=284.6; # characteristic gas constant in J/kg K\n", + "\n", + "#Calculations\n", + "T_2=T01*(P2/P01)**((r-1)/r); # Isentropic temperature after expansion\n", + "T2=(lc*T01+T_2)/(1+lc); # Actual temperature after expansion\n", + "c2=math.sqrt(2*Cp*10**3*(T01-T2)); # Absolute velocity\n", + "# From velocity triangles\n", + "ca=c2*math.cos(alpha_2);\n", + "row=P2*10**5/(R*T2); # Density of gas\n", + "A=m/(ca*row); # Area\n", + "Dm=math.sqrt (A*Dm_h/3.14); # Mean Diameter\n", + "h=Dm/10; # Blade height\n", + "rm=Dm/2; # Mean radius\n", + "# At root\n", + "r_root=(Dm-h)/2;\n", + "#At the tip\n", + "r_tip=(Dm+h)/2;\n", + "# Free vorte flow\n", + "ct_mean=c2*math.sin (alpha_2);\n", + "# At the root\n", + "ct2_root=(ct_mean*rm)/r_root;\n", + "alpha2_root=math.atan(ct2_root/ca);\n", + "c2_root=ct2_root/math.sin (alpha2_root);\n", + "T2_root=T01-c2_root**2/(2*Cp*10**3);\n", + "# At the tip\n", + "ct2_tip=ct_mean*rm/r_tip;\n", + "alpha2_tip = math.atan (ct2_tip/ca);\n", + "c2_tip=ct2_tip/math.sin(alpha2_tip);\n", + "T2_tip=T01-c2_tip**2/(2*Cp*10**3);\n", + "\n", + "#Results\n", + "print \"A the Root\"\n", + "print \"\\tGas Temperature at the root = \",round(T2_root,3),\"K\"\n", + "print \"\\tGas velocity at the root = \",round(c2_root,3),\"m/s\"\n", + "print \"\\tDischarge angle at the root = \",round(math.degrees(alpha2_root),3),\"degree\"\n", + "print \"\\nA the Tip\"\n", + "print \"\\tGas Temperature at the tip = \",round(T2_tip,3),\"K\"\n", + "print \"\\tGas velocity at the tip = \",round(c2_tip,3),\"m/s\"\n", + "print \"\\tDischarge angle at the tip = \",round(math.degrees(alpha2_tip),3),\"degree\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "A the Root\n", + "\tGas Temperature at the root = 733.345 K\n", + "\tGas velocity at the root = 741.696 m/s\n", + "\tDischarge angle at the root = 62.543 degree\n", + "\n", + "A the Tip\n", + "\tGas Temperature at the tip = 795.766 K\n", + "\tGas velocity at the tip = 637.902 m/s\n", + "\tDischarge angle at the tip = 57.581 degree\n" + ] + } + ], + "prompt_number": 5 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/KavinkumarD/Chapter_11__Impulse_and_Reaction.ipynb b/sample_notebooks/KavinkumarD/Chapter_11__Impulse_and_Reaction.ipynb deleted file mode 100755 index 5415ad01..00000000 --- a/sample_notebooks/KavinkumarD/Chapter_11__Impulse_and_Reaction.ipynb +++ /dev/null @@ -1,345 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:38f9fe4fd8a5c174c9e1dd9b5dc21976f4cdd814f7eb8fcfe0c266e278f9a77b" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 11 : Impulse and Reaction Turbines" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.1 and Page No:454" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#Variable declaration\n", - "p02=6; # Inlet pressure in bar\n", - "T02=900; # Inlet temperature in kelvin\n", - "p0fs=1; # Outlet pressure in bar\n", - "eff_isenT=0.85; # insentropic efficiency of turbine\n", - "alpha_2=math.radians(75); # Nozzle outlet angle in degree and conversion to radians\n", - "u=250; # Mean blade velocity in m/s\n", - "Cp=1.15*10**3; # Specific heat in J/ kg K\n", - "r=1.333; # Specific heat ratio\n", - "\n", - "#Calculations\n", - "T0fs=T02/(p02/p0fs)**((r-1)/r); # Isentropic temperature at the exit of the final stage\n", - "Del_Toverall=eff_isenT*(T02-T0fs); # Actual overall temperature drop\n", - "c2=2*u/math.sin (alpha_2); # absolute velocity\n", - "c3= c2*math.cos (alpha_2);# absolute velocity\n", - "c1=c3; # From velocity triangles\n", - "Del_Tstage=(c2**2-c1**2)/(2*Cp); # Stage temperature drop\n", - "n=Del_Toverall/Del_Tstage; # Number of stages\n", - "\n", - "#Results\n", - "print \"Number of stages n =\",round (n,0);\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number of stages n = 3.0\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.2 and Page No:455" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#Variable declaration\n", - "N=10000; # Speed of gas turbine in rpm\n", - "T01=700+273.15; # Total head temperature at nozzle entry in kelvin\n", - "P01=4.5; #Total head pressure at nozzle entry in bar\n", - "P02=2.6; # Outlet pressure from nozzle in bar\n", - "p3=1.5;# Pressure at trbine outlet annulus in bar\n", - "M=0.5; # Mach number at outlet\n", - "alpha_2=math.radians(70); # outlet nozzle angle in degrees and conversion to radians\n", - "D=64; # Blade mean diameter in cm\n", - "m=22.5; # Mass flow rate in kg/s\n", - "eff_T=0.99; # turbine mechanical efficiency\n", - "Cp=1.147; # Specific heat in kJ/kg K\n", - "r=1.33; # Specific heat ratio\n", - "fl=0.03; # frictional loss\n", - "R=284.6; # characteristic gas constant in J/kg K\n", - "\n", - "#Calculations\n", - "eff_N=1-fl; # Nozzle efficiency\n", - "T_02=(P02/P01)**((r-1)/r)*T01; # Isentropic temperature after expansion\n", - "T02=T01-eff_N*(T01-T_02); # Actual temperature after expansion\n", - "c2=math.sqrt (2*Cp*10**3*(T01-T02)); # Absolute velocity\n", - "u=(3.14*D*10**-2*N)/60; # Mean blade velocity\n", - "# From velocity triangles\n", - "wt2=c2*math.sin( (alpha_2))-u;\n", - "ca=c2*math.cos( (alpha_2));\n", - "beta_2=(math.atan((wt2)/ca));\n", - "T3=T02/(P02/p3)**((r-1)/r); # Assuming rotor losses are negligible\n", - "c3=M*math.sqrt (r*R*T3); # Absolute velocity\n", - "beta_3=(math.atan(u/c3));\n", - "ct2=c2*math.sin((alpha_2));\n", - "P=eff_T*m*(ct2)*u/1000; # Power developed\n", - "\n", - "#Results\n", - "print \"(i).\"\n", - "print \"\\tGas angle at entry = \",round (math.degrees(beta_2),3),\"degree\"\n", - "print \"\\tGas angle at exit = \",round (math.degrees(beta_3),3),\"degree\"\n", - "print \"(ii).\"\n", - "print \"\\tPower developed = \",round(P,3),\"kW (roundoff error)\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(i).\n", - "\tGas angle at entry = 41.411 degree\n", - "\tGas angle at exit = 51.609 degree\n", - "(ii).\n", - "\tPower developed = 3680.184 kW (roundoff error)\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.3 and Page No:457" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#Variable declaration\n", - "alpha_2=math.radians(65); # Nozzle discharge angle in degree and conversion to radians\n", - "c3=300; # Absolute velocity in m/s\n", - "alpha_3=math.radians(30); # in degrees and conversion to radians\n", - "\n", - "#Calculations\n", - "ca2=c3*math.cos (alpha_3); # Axial velocity\n", - "c2=ca2/math.cos(alpha_2); # Absolute velocity\n", - "# ca3=ca2=ca and equal blade angles then\n", - "ca=ca2;\n", - "beta_2=math.atan((c2*math.sin(alpha_2)+c3*math.sin(alpha_3))/(2*ca)); # Blade angle\n", - "beta_3=beta_2; # equal blade angles\n", - "u=c2*math.sin(alpha_2)-ca2*math.tan(beta_2); # Mean blade velocity\n", - "# From velocity triangles\n", - "ct2=c2*math.sin(alpha_2);\n", - "ct3=c3*math.sin(alpha_3);\n", - "WT=u*(ct2+ct3)/1000; # Work done\n", - "sigma=u/c2; # optimum speed ratio\n", - "eff_B=4*(sigma*math.sin(alpha_2)-sigma**2);\n", - "\n", - "#Results\n", - "print \"Blade angle = beta_2= beta_3 = \",round (math.degrees(beta_2),3),\"degree\"\n", - "print \"Power Produced = \",round(WT,3),\"kJ/kg (roundoff error)\"\n", - "print \"Blade efficiency = \",round(eff_B*100,2),\"%\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Blade angle = beta_2= beta_3 = 53.692 degree\n", - "Power Produced = 143.963 kJ/kg (roundoff error)\n", - "Blade efficiency = 76.19 %\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.4 and Page No:458" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#Variable declaration\n", - "P01=7; # Pressure at inlet in bar\n", - "T01=300+273.15; # Temperature at inlet in kelvin\n", - "P02=3; # Pressure at outlet in bar\n", - "alpha_2=math.radians(70); # Nozzle angle in degree and conversion to radians\n", - "eff_N=0.9; # Isentropic efficiency of nozzle\n", - "WT=75; # Power Produced in kW\n", - "Cp=1.15; # Specific heat in kJ/kg K\n", - "r=1.33; # Specific heat ratio\n", - "\n", - "#Calculations\n", - "T_02=T01*(P02/P01)**((r-1)/r); # Isentropic temperature after expansion\n", - "T02=T01-eff_N*(T01-T_02); # Actual temperature after expansion\n", - "c2=math.sqrt (2*Cp*10**3*(T01-T02)); # Absolute velocity\n", - "# For optimum blade speed ratio\n", - "u=(c2*math.sin (alpha_2)/2); # Mean blade velocity\n", - "beta_2=math.atan((c2*math.sin(alpha_2)-u)/(c2*math.cos(alpha_2))); # Blade angle\n", - "# From velocity triangles\n", - "ct2=c2*math.sin(alpha_2);\n", - "w2=c2*math.cos(alpha_2)/math.cos(beta_2);\n", - "w3=w2; # Equal inlet and outlet angles\n", - "beta_3=54; # in degrees\n", - "ct3=w3*math.sin(beta_3)-u;\n", - "m=(WT*10**3)/(u*(ct2+ct3)); # Gas mass flow rate\n", - "\n", - "#Results\n", - "print \"Blade angle = \",round(math.degrees(beta_2),3),\"degree\"\n", - "print \"Gas Mass Flow Rate = \",round(m,3),\"kg/s\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Blade angle = 53.948 degree\n", - "Gas Mass Flow Rate = 4.89 kg/s\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 11.5 and Page No:460" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#Variable declaration\n", - "P01=4.6; # Total head inlet pressure in bar\n", - "T01=700+273.15; # Total head inlet temperature in kelvin\n", - "P2=1.6; # Static head pressure at mean radius in bar\n", - "Dm_h=10; # Mean blade diameter/blade height\n", - "lc=0.1; # Nozzle losses coefficient\n", - "alpha_2=math.radians(60); # Nozzle outlet angle in degree and conversion to radians\n", - "Cp=1.147; # Specific heat in kJ/kg K\n", - "r=1.33; # Specific heat ratio\n", - "m=20; # Mass flow rate in kg/s\n", - "R=284.6; # characteristic gas constant in J/kg K\n", - "\n", - "#Calculations\n", - "T_2=T01*(P2/P01)**((r-1)/r); # Isentropic temperature after expansion\n", - "T2=(lc*T01+T_2)/(1+lc); # Actual temperature after expansion\n", - "c2=math.sqrt(2*Cp*10**3*(T01-T2)); # Absolute velocity\n", - "# From velocity triangles\n", - "ca=c2*math.cos(alpha_2);\n", - "row=P2*10**5/(R*T2); # Density of gas\n", - "A=m/(ca*row); # Area\n", - "Dm=math.sqrt (A*Dm_h/3.14); # Mean Diameter\n", - "h=Dm/10; # Blade height\n", - "rm=Dm/2; # Mean radius\n", - "# At root\n", - "r_root=(Dm-h)/2;\n", - "#At the tip\n", - "r_tip=(Dm+h)/2;\n", - "# Free vorte flow\n", - "ct_mean=c2*math.sin (alpha_2);\n", - "# At the root\n", - "ct2_root=(ct_mean*rm)/r_root;\n", - "alpha2_root=math.atan(ct2_root/ca);\n", - "c2_root=ct2_root/math.sin (alpha2_root);\n", - "T2_root=T01-c2_root**2/(2*Cp*10**3);\n", - "# At the tip\n", - "ct2_tip=ct_mean*rm/r_tip;\n", - "alpha2_tip = math.atan (ct2_tip/ca);\n", - "c2_tip=ct2_tip/math.sin(alpha2_tip);\n", - "T2_tip=T01-c2_tip**2/(2*Cp*10**3);\n", - "\n", - "#Results\n", - "print \"A the Root\"\n", - "print \"\\tGas Temperature at the root = \",round(T2_root,3),\"K\"\n", - "print \"\\tGas velocity at the root = \",round(c2_root,3),\"m/s\"\n", - "print \"\\tDischarge angle at the root = \",round(math.degrees(alpha2_root),3),\"degree\"\n", - "print \"\\nA the Tip\"\n", - "print \"\\tGas Temperature at the tip = \",round(T2_tip,3),\"K\"\n", - "print \"\\tGas velocity at the tip = \",round(c2_tip,3),\"m/s\"\n", - "print \"\\tDischarge angle at the tip = \",round(math.degrees(alpha2_tip),3),\"degree\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "A the Root\n", - "\tGas Temperature at the root = 733.345 K\n", - "\tGas velocity at the root = 741.696 m/s\n", - "\tDischarge angle at the root = 62.543 degree\n", - "\n", - "A the Tip\n", - "\tGas Temperature at the tip = 795.766 K\n", - "\tGas velocity at the tip = 637.902 m/s\n", - "\tDischarge angle at the tip = 57.581 degree\n" - ] - } - ], - "prompt_number": 5 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/KavinkumarD/KavinkumarD_version_backup/Chapter_8_FREQUENCY_EFFECTS.ipynb b/sample_notebooks/KavinkumarD/KavinkumarD_version_backup/Chapter_8_FREQUENCY_EFFECTS.ipynb new file mode 100755 index 00000000..60448e3c --- /dev/null +++ b/sample_notebooks/KavinkumarD/KavinkumarD_version_backup/Chapter_8_FREQUENCY_EFFECTS.ipynb @@ -0,0 +1,120 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:8ef023228932ba7c44f0f72b79793f31a32f8ea67eae875510cf71ee015fc22c" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8 FREQUENCY EFFECTS IN AMPLIFIERS" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.6 , Page no:242" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "hie=1000 #\u2126\n", + "hfe=75 #\u2126\n", + "Av=50\n", + "Rl=10000 #k\u2126\n", + "hie2=300 #\u2126\n", + "hfe2=100 #\u2126\n", + "Re=1000 #k\u2126\n", + "\n", + "#CALCULATIONS\n", + "Req=Av*(hie/hfe) #\u2126\n", + "Rc=Req*Rl/(Rl-Req) #k\u2126\n", + "wL=2*3.14*200\n", + "Ce=(hie2+(hfe2+1)*Re)/(wL*Re*hie2)*10**6\n", + "Av1=(hfe*Req)/(hie+(hfe+1)*Re)\n", + "\n", + "#RESULTS\n", + "print\"The value of Req=\",round(Req,3),\"Ohm\";\n", + "print\"The value of Rc=\",round(Rc,3),\"Ohm\";\n", + "print\"The value of Ce=\",round(Ce,3),\"mF\";\n", + "print\"The value of Av=\",round(Av1,3);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of Req= 666.667 Ohm\n", + "The value of Rc= 714.286 Ohm\n", + "The value of Ce= 268.843 mF\n", + "The value of Av= 0.649\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.8 , Page no:244" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "hie2=1500 #\u2126\n", + "Rb2=5000 #k\u2126\n", + "Z01=10\n", + "Av=7881.3\n", + "\n", + "#CALCULATIONS\n", + "C2=1*10**-6 \n", + "Zin2=(hie2*Rb2/(hie2+Rb2))\n", + "fl=1/(2*3.14*C2*(Zin2+Z01*10**3))\n", + "\n", + "#RESULTS\n", + "print\"The value of Zin2=\",round(Zin2,3),\"Ohm\";\n", + "print\"The value of fl=\",round(fl,3),\"Hz\";" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of Zin2= 1153.846 Ohm\n", + "The value of fl= 14.276 Hz\n" + ] + } + ], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/KavinkumarD/KavinkumarD_version_backup/Chapter_8_FREQUENCY_EFFECTS_IN.ipynb b/sample_notebooks/KavinkumarD/KavinkumarD_version_backup/Chapter_8_FREQUENCY_EFFECTS_IN.ipynb deleted file mode 100755 index 60448e3c..00000000 --- a/sample_notebooks/KavinkumarD/KavinkumarD_version_backup/Chapter_8_FREQUENCY_EFFECTS_IN.ipynb +++ /dev/null @@ -1,120 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:8ef023228932ba7c44f0f72b79793f31a32f8ea67eae875510cf71ee015fc22c" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 8 FREQUENCY EFFECTS IN AMPLIFIERS" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.6 , Page no:242" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "hie=1000 #\u2126\n", - "hfe=75 #\u2126\n", - "Av=50\n", - "Rl=10000 #k\u2126\n", - "hie2=300 #\u2126\n", - "hfe2=100 #\u2126\n", - "Re=1000 #k\u2126\n", - "\n", - "#CALCULATIONS\n", - "Req=Av*(hie/hfe) #\u2126\n", - "Rc=Req*Rl/(Rl-Req) #k\u2126\n", - "wL=2*3.14*200\n", - "Ce=(hie2+(hfe2+1)*Re)/(wL*Re*hie2)*10**6\n", - "Av1=(hfe*Req)/(hie+(hfe+1)*Re)\n", - "\n", - "#RESULTS\n", - "print\"The value of Req=\",round(Req,3),\"Ohm\";\n", - "print\"The value of Rc=\",round(Rc,3),\"Ohm\";\n", - "print\"The value of Ce=\",round(Ce,3),\"mF\";\n", - "print\"The value of Av=\",round(Av1,3);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The value of Req= 666.667 Ohm\n", - "The value of Rc= 714.286 Ohm\n", - "The value of Ce= 268.843 mF\n", - "The value of Av= 0.649\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 8.8 , Page no:244" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "hie2=1500 #\u2126\n", - "Rb2=5000 #k\u2126\n", - "Z01=10\n", - "Av=7881.3\n", - "\n", - "#CALCULATIONS\n", - "C2=1*10**-6 \n", - "Zin2=(hie2*Rb2/(hie2+Rb2))\n", - "fl=1/(2*3.14*C2*(Zin2+Z01*10**3))\n", - "\n", - "#RESULTS\n", - "print\"The value of Zin2=\",round(Zin2,3),\"Ohm\";\n", - "print\"The value of fl=\",round(fl,3),\"Hz\";" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The value of Zin2= 1153.846 Ohm\n", - "The value of fl= 14.276 Hz\n" - ] - } - ], - "prompt_number": 2 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/KonasaniSai Dheeraj/sample.ipynb b/sample_notebooks/KonasaniSai Dheeraj/sample.ipynb new file mode 100755 index 00000000..58372eed --- /dev/null +++ b/sample_notebooks/KonasaniSai Dheeraj/sample.ipynb @@ -0,0 +1,256 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 6 : FORMULAE" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_1 pgno:69" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "expr=8*i-5\n", + "the number is 16\n" + ] + } + ], + "source": [ + " #8 times a number is decreased by 5 the result is 123\n", + "#let x be the number\n", + "\n", + "print'expr=8*i-5'\n", + "x=0;\n", + "for x in range(0,100):\n", + " if((8*x-5)==123):\n", + " print\"the number is \",x\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_2 pgno:71" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "expr=(2*n+1)+(2*n+3)+(2*n+5)\n", + "n=%i \n", + "12\n", + "\n", + " the numbers are 199 201 203\n" + ] + } + ], + "source": [ + "#sum of 3 consecutive odd no.'s is 81\n", + "\n", + "#let the 3 consecutive odd numbers be 2n+1,2n+3,2n+5\n", + "\n", + "print\"expr=(2*n+1)+(2*n+3)+(2*n+5)\"\n", + "n=0;\n", + "for n in range(0,100):\n", + " if((2*n+1)+(2*n+3)+(2*n+5)==81):\n", + " print\"n=%i \\n\",n \n", + "\n", + "n1=2*n+1;\n", + "n2=2*n+3;\n", + "n3=2*n+5;\n", + "print\"\\n the numbers are \",n1,n2,n3\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_3 pgno:72" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "p1=(6*x-5)\n", + "p2=(2*x+9)\n", + "p3=p1-p2\n", + "satisfies the equation \n" + ] + } + ], + "source": [ + "import numpy\n", + "print\"p1=(6*x-5)\"\n", + "p1=numpy.array([6, -5])\n", + "print\"p2=(2*x+9)\"\n", + "p2=numpy.array([2, 9])\n", + "print\"p3=p1-p2\"\n", + "p3=p1-p2\n", + "\n", + "x1=numpy.roots(p3)\n", + "left=6*x1-5; #check by substituion \n", + "right=2*x1+9;\n", + "if(left==right):\n", + "\tprint'satisfies the equation '\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_4 pgno:73" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x is a polynomial function\n", + "by the law of sighs roots are [ 3.]\n" + ] + } + ], + "source": [ + "print\"x is a polynomial function\"\n", + "import numpy\n", + "p1=numpy.array([3/5+1/2, 0])\n", + "p2=numpy.array([5/4, -3])\n", + "#p1=3*x/5+x/2;\n", + "#p2=5*x/4-3;\n", + "p3=p1-p2;\n", + "x=numpy.roots(p3) #by the law of signs\n", + "print\"by the law of sighs roots are\",x\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6_5 pgno:75" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "p1=4*x-(x-2)/3\n", + "p2=5+(2*x+1)/4\n", + "p3=p1-p2\n", + "satisfies the equation \n" + ] + } + ], + "source": [ + "import numpy\n", + "print\"p1=4*x-(x-2)/3\"\n", + "p1=numpy.array([11/3, 2/3])\n", + "print\"p2=5+(2*x+1)/4\"\n", + "p2=numpy.array([1/2, 21/4])\n", + "print\"p3=p1-p2\"\n", + "p3=p1-p2\n", + "\n", + "x=numpy.roots(p3)\n", + "left=4*x-(x-2)/3; #check by substituion \n", + "right=5+(2*x+1)/4;\n", + "if(left != right):\n", + "\tprint'satisfies the equation '\n", + "\n", + "\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/KonasaniSai Dheeraj/sample_(chapter.ipynb b/sample_notebooks/KonasaniSai Dheeraj/sample_(chapter.ipynb deleted file mode 100755 index 58372eed..00000000 --- a/sample_notebooks/KonasaniSai Dheeraj/sample_(chapter.ipynb +++ /dev/null @@ -1,256 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 6 : FORMULAE" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_1 pgno:69" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "expr=8*i-5\n", - "the number is 16\n" - ] - } - ], - "source": [ - " #8 times a number is decreased by 5 the result is 123\n", - "#let x be the number\n", - "\n", - "print'expr=8*i-5'\n", - "x=0;\n", - "for x in range(0,100):\n", - " if((8*x-5)==123):\n", - " print\"the number is \",x\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_2 pgno:71" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "expr=(2*n+1)+(2*n+3)+(2*n+5)\n", - "n=%i \n", - "12\n", - "\n", - " the numbers are 199 201 203\n" - ] - } - ], - "source": [ - "#sum of 3 consecutive odd no.'s is 81\n", - "\n", - "#let the 3 consecutive odd numbers be 2n+1,2n+3,2n+5\n", - "\n", - "print\"expr=(2*n+1)+(2*n+3)+(2*n+5)\"\n", - "n=0;\n", - "for n in range(0,100):\n", - " if((2*n+1)+(2*n+3)+(2*n+5)==81):\n", - " print\"n=%i \\n\",n \n", - "\n", - "n1=2*n+1;\n", - "n2=2*n+3;\n", - "n3=2*n+5;\n", - "print\"\\n the numbers are \",n1,n2,n3\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_3 pgno:72" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "p1=(6*x-5)\n", - "p2=(2*x+9)\n", - "p3=p1-p2\n", - "satisfies the equation \n" - ] - } - ], - "source": [ - "import numpy\n", - "print\"p1=(6*x-5)\"\n", - "p1=numpy.array([6, -5])\n", - "print\"p2=(2*x+9)\"\n", - "p2=numpy.array([2, 9])\n", - "print\"p3=p1-p2\"\n", - "p3=p1-p2\n", - "\n", - "x1=numpy.roots(p3)\n", - "left=6*x1-5; #check by substituion \n", - "right=2*x1+9;\n", - "if(left==right):\n", - "\tprint'satisfies the equation '\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_4 pgno:73" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "x is a polynomial function\n", - "by the law of sighs roots are [ 3.]\n" - ] - } - ], - "source": [ - "print\"x is a polynomial function\"\n", - "import numpy\n", - "p1=numpy.array([3/5+1/2, 0])\n", - "p2=numpy.array([5/4, -3])\n", - "#p1=3*x/5+x/2;\n", - "#p2=5*x/4-3;\n", - "p3=p1-p2;\n", - "x=numpy.roots(p3) #by the law of signs\n", - "print\"by the law of sighs roots are\",x\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 6_5 pgno:75" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "p1=4*x-(x-2)/3\n", - "p2=5+(2*x+1)/4\n", - "p3=p1-p2\n", - "satisfies the equation \n" - ] - } - ], - "source": [ - "import numpy\n", - "print\"p1=4*x-(x-2)/3\"\n", - "p1=numpy.array([11/3, 2/3])\n", - "print\"p2=5+(2*x+1)/4\"\n", - "p2=numpy.array([1/2, 21/4])\n", - "print\"p3=p1-p2\"\n", - "p3=p1-p2\n", - "\n", - "x=numpy.roots(p3)\n", - "left=4*x-(x-2)/3; #check by substituion \n", - "right=5+(2*x+1)/4;\n", - "if(left != right):\n", - "\tprint'satisfies the equation '\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/LaxmanSole/LaxmanSole_version_backup/Pinciples_of_electronic.ipynb b/sample_notebooks/LaxmanSole/LaxmanSole_version_backup/Pinciples_of_electronic.ipynb new file mode 100755 index 00000000..229d9b52 --- /dev/null +++ b/sample_notebooks/LaxmanSole/LaxmanSole_version_backup/Pinciples_of_electronic.ipynb @@ -0,0 +1,406 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 1 : Basic Concepts" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example1_1,pg 481" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# unknown resistance\n", + "\n", + "import math\n", + "#VAriable declaration\n", + "Ir=10*10**-3 #current drawn by resistor\n", + "Vr=100.0 #voltage across resistor\n", + "Rv=40*10**3 #voltmeter resistance\n", + "\n", + "#Calcualtions\n", + "Ru=(Vr/Ir)*(1/(1-(Vr/(Ir*Rv)))) \n", + "\n", + "#Result\n", + "print(\"output resistance:\")\n", + "print(\"Ru=%.2f ohm\"%Ru)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "output resistance:\n", + "Ru=13333.33 ohm\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example1_2,pg 481" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# unknown resistance\n", + "\n", + "import math\n", + "#Variable declaration\n", + "Ir=10*10**-3 #current drawn by resistor\n", + "Vr=100.0 #voltage across resistor\n", + "Rv=40*10**3 #voltmeter resistance\n", + "Ra=1.0 #ammeter resistance\n", + "\n", + "#Calculations\n", + "Ru=(Rv/Ir)-Ra\n", + "\n", + "#Result\n", + "print(\"output resistance:\")\n", + "print(\"Ru=%.2f ohm\"%Ru)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "output resistance:\n", + "Ru=3999999.00 ohm\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example1_3,pg 481" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# find ammeter reading\n", + "\n", + "import math\n", + "#Variable declaration\n", + "Rv=40*10**3 #voltmeter resistance\n", + "Ra=1.0 #ammeter resistance\n", + "Vr=40.0 #voltmeter reading\n", + "Ru=10*10**3 #unknown resistance\n", + "\n", + "#Calculations\n", + "Ir=(Vr*(Rv+Ru))/(Ru*Rv)\n", + "Ir1=(Vr/(Ru+Ra))\n", + "\n", + "#Result\n", + "print(\"ammeter reading case1:\")\n", + "print(\"Ir=%.4f A\"%Ir)\n", + "print(\"\\nammeter reading case2:\")\n", + "print(\"Ir1=%.4f A\"%Ir1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "ammeter reading case1:\n", + "Ir=0.0050 A\n", + "\n", + "ammeter reading case2:\n", + "Ir1=0.0040 A\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example1_4,pg 482" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# unknown resistance\n", + "\n", + "import math\n", + "#Variable declaration\n", + "Vs=3.0 #supply voltage\n", + "Vu=2.75 #voltmeter reading\n", + "Rp=10*10**3 #parallel resistance\n", + "\n", + "#Calculations\n", + "Ru=Rp*((Vs/Vu)-1)\n", + "\n", + "#Result\n", + "print(\"unknown resistance:\")\n", + "print(\"Ru=%.2f ohm\"%Ru)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "unknown resistance:\n", + "Ru=909.09 ohm\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example1_5,pg 482" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Find input vlotage\n", + "\n", + "#with input voltage exceding 2Vd,diodes conduct and the voltage divider circuit with diodes can allow only a Vi given by Vi=2Vd\n", + "\n", + "#Result\n", + "print(\"input voltage to amplifier:\")\n", + "print(\"Vi=2Vd\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "input voltage to amplifier:\n", + "Vi=2Vd\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Example1_6,pg 482" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# find shunt resistance\n", + "\n", + "import math\n", + "#Variable declaration\n", + "Rm=1000.0 #meter resistance\n", + "Is=900*10**-6 #shunt current\n", + "Vm=100*10**-3 #drop across meter\n", + "\n", + "#Result\n", + "Rs=Vm/Is\n", + "It=1*10**-3\n", + "#Is=It*(Rm/(Rs+Rm))\n", + "Rs=(Rm*(It-Is))/Is\n", + "\n", + "#Result\n", + "print(\"shunt resistance:\")\n", + "print(\"Rs=%.2f ohm\"%Rs)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "shunt resistance:\n", + "Rs=111.11 ohm\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example1_7,pg 483" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# find series resistor\n", + "\n", + "import math\n", + "#Variable declaration\n", + "If=100*10**-6 #full scale current\n", + "Rm=1000.0 #meter resistance\n", + "Vf=10.0 #full scale voltage\n", + "\n", + "#Calculations\n", + "Rs=(Vf/If)-Rm\n", + "\n", + "#Result\n", + "print(\"series resistance:\")\n", + "print(\"Rs=%.2f ohm\"%Rs)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "series resistance:\n", + "Rs=99000.00 ohm\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Example1_8,pg 483" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# sensitivity\n", + "\n", + "import math\n", + "#Variable declaration\n", + "If=100*10**-6 # Current\n", + "\n", + "#Calculations\n", + "S=1/If\n", + "\n", + "#Result\n", + "print(\"sensitivity:\")\n", + "print(\"S=%.2f ohm/volt\"%S)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "sensitivity:\n", + "S=10000.00 ohm/volt\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example1_9,pg 483" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# error in measurment\n", + "\n", + "import math\n", + "# Variable declaration\n", + "\n", + "#assume that the voltmeter full scale reading is 12V which gives its resistance as 1.2*10^6 ohm \n", + "#which is in parallel with 10*10^6 ohm making as equivalent of Rq given as\n", + "R=1.2*10**6 #voltmeter resistance\n", + "R1=10*10**6 #voltage divider resistance\n", + "Vin=12.0 #input voltage to divider network\n", + "Rs=4*10**6 # series resistance\n", + "\n", + "\n", + "#Calculations\n", + "Rq=(R*R1)/(R+R1)\n", + "Vq=(Rq*Vin)/(Rq+Rs) #voltage across equivalent combination\n", + "Va=(R1*Vin)/(R1+Rs) #actual volatge\n", + "er=(Vq-Va)/Va #error\n", + "\n", + "#Result\n", + "print(\"error in measurement:\")\n", + "print(\"\\ner=%.3f \"%er)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "error in measurement:\n", + "\n", + "er=-0.704 \n" + ] + } + ], + "prompt_number": 14 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/LaxmanSole/LaxmanSole_version_backup/Pinciples_of_electronic_Instrumentation.ipynb b/sample_notebooks/LaxmanSole/LaxmanSole_version_backup/Pinciples_of_electronic_Instrumentation.ipynb deleted file mode 100755 index 229d9b52..00000000 --- a/sample_notebooks/LaxmanSole/LaxmanSole_version_backup/Pinciples_of_electronic_Instrumentation.ipynb +++ /dev/null @@ -1,406 +0,0 @@ -{ - "metadata": { - "name": "" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 1 : Basic Concepts" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example1_1,pg 481" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# unknown resistance\n", - "\n", - "import math\n", - "#VAriable declaration\n", - "Ir=10*10**-3 #current drawn by resistor\n", - "Vr=100.0 #voltage across resistor\n", - "Rv=40*10**3 #voltmeter resistance\n", - "\n", - "#Calcualtions\n", - "Ru=(Vr/Ir)*(1/(1-(Vr/(Ir*Rv)))) \n", - "\n", - "#Result\n", - "print(\"output resistance:\")\n", - "print(\"Ru=%.2f ohm\"%Ru)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "output resistance:\n", - "Ru=13333.33 ohm\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example1_2,pg 481" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# unknown resistance\n", - "\n", - "import math\n", - "#Variable declaration\n", - "Ir=10*10**-3 #current drawn by resistor\n", - "Vr=100.0 #voltage across resistor\n", - "Rv=40*10**3 #voltmeter resistance\n", - "Ra=1.0 #ammeter resistance\n", - "\n", - "#Calculations\n", - "Ru=(Rv/Ir)-Ra\n", - "\n", - "#Result\n", - "print(\"output resistance:\")\n", - "print(\"Ru=%.2f ohm\"%Ru)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "output resistance:\n", - "Ru=3999999.00 ohm\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example1_3,pg 481" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# find ammeter reading\n", - "\n", - "import math\n", - "#Variable declaration\n", - "Rv=40*10**3 #voltmeter resistance\n", - "Ra=1.0 #ammeter resistance\n", - "Vr=40.0 #voltmeter reading\n", - "Ru=10*10**3 #unknown resistance\n", - "\n", - "#Calculations\n", - "Ir=(Vr*(Rv+Ru))/(Ru*Rv)\n", - "Ir1=(Vr/(Ru+Ra))\n", - "\n", - "#Result\n", - "print(\"ammeter reading case1:\")\n", - "print(\"Ir=%.4f A\"%Ir)\n", - "print(\"\\nammeter reading case2:\")\n", - "print(\"Ir1=%.4f A\"%Ir1)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "ammeter reading case1:\n", - "Ir=0.0050 A\n", - "\n", - "ammeter reading case2:\n", - "Ir1=0.0040 A\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example1_4,pg 482" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# unknown resistance\n", - "\n", - "import math\n", - "#Variable declaration\n", - "Vs=3.0 #supply voltage\n", - "Vu=2.75 #voltmeter reading\n", - "Rp=10*10**3 #parallel resistance\n", - "\n", - "#Calculations\n", - "Ru=Rp*((Vs/Vu)-1)\n", - "\n", - "#Result\n", - "print(\"unknown resistance:\")\n", - "print(\"Ru=%.2f ohm\"%Ru)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "unknown resistance:\n", - "Ru=909.09 ohm\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example1_5,pg 482" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Find input vlotage\n", - "\n", - "#with input voltage exceding 2Vd,diodes conduct and the voltage divider circuit with diodes can allow only a Vi given by Vi=2Vd\n", - "\n", - "#Result\n", - "print(\"input voltage to amplifier:\")\n", - "print(\"Vi=2Vd\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "input voltage to amplifier:\n", - "Vi=2Vd\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "Example1_6,pg 482" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# find shunt resistance\n", - "\n", - "import math\n", - "#Variable declaration\n", - "Rm=1000.0 #meter resistance\n", - "Is=900*10**-6 #shunt current\n", - "Vm=100*10**-3 #drop across meter\n", - "\n", - "#Result\n", - "Rs=Vm/Is\n", - "It=1*10**-3\n", - "#Is=It*(Rm/(Rs+Rm))\n", - "Rs=(Rm*(It-Is))/Is\n", - "\n", - "#Result\n", - "print(\"shunt resistance:\")\n", - "print(\"Rs=%.2f ohm\"%Rs)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "shunt resistance:\n", - "Rs=111.11 ohm\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example1_7,pg 483" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# find series resistor\n", - "\n", - "import math\n", - "#Variable declaration\n", - "If=100*10**-6 #full scale current\n", - "Rm=1000.0 #meter resistance\n", - "Vf=10.0 #full scale voltage\n", - "\n", - "#Calculations\n", - "Rs=(Vf/If)-Rm\n", - "\n", - "#Result\n", - "print(\"series resistance:\")\n", - "print(\"Rs=%.2f ohm\"%Rs)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "series resistance:\n", - "Rs=99000.00 ohm\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "Example1_8,pg 483" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# sensitivity\n", - "\n", - "import math\n", - "#Variable declaration\n", - "If=100*10**-6 # Current\n", - "\n", - "#Calculations\n", - "S=1/If\n", - "\n", - "#Result\n", - "print(\"sensitivity:\")\n", - "print(\"S=%.2f ohm/volt\"%S)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "sensitivity:\n", - "S=10000.00 ohm/volt\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example1_9,pg 483" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# error in measurment\n", - "\n", - "import math\n", - "# Variable declaration\n", - "\n", - "#assume that the voltmeter full scale reading is 12V which gives its resistance as 1.2*10^6 ohm \n", - "#which is in parallel with 10*10^6 ohm making as equivalent of Rq given as\n", - "R=1.2*10**6 #voltmeter resistance\n", - "R1=10*10**6 #voltage divider resistance\n", - "Vin=12.0 #input voltage to divider network\n", - "Rs=4*10**6 # series resistance\n", - "\n", - "\n", - "#Calculations\n", - "Rq=(R*R1)/(R+R1)\n", - "Vq=(Rq*Vin)/(Rq+Rs) #voltage across equivalent combination\n", - "Va=(R1*Vin)/(R1+Rs) #actual volatge\n", - "er=(Vq-Va)/Va #error\n", - "\n", - "#Result\n", - "print(\"error in measurement:\")\n", - "print(\"\\ner=%.3f \"%er)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "error in measurement:\n", - "\n", - "er=-0.704 \n" - ] - } - ], - "prompt_number": 14 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/ManchukondaGopi Krishna/Chapter_7.ipynb b/sample_notebooks/ManchukondaGopi Krishna/Chapter_7.ipynb new file mode 100755 index 00000000..38d38099 --- /dev/null +++ b/sample_notebooks/ManchukondaGopi Krishna/Chapter_7.ipynb @@ -0,0 +1,299 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 7 Wave Guides" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_1 pgno:75" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-Critical wavelength = cm\n", + "15.24\n", + "-Guide wavelength = cm 13.3\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "c=3.*(10**8);\n", + "f=3000.*(10**8);\n", + "lo=c/f;\n", + "l=lo*(10**4);\n", + "m=1.;n=0;a=7.62;\n", + "lc=2*a;\n", + "print\"-Critical wavelength = cm\\n\",lc\n", + "lg=sqrt((l*l*lc*lc)/((lc*lc)-(l*l)));\n", + "print\"-Guide wavelength = cm\",round(lg*10)/10\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_2 pgno:76" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Frequency of dominant mode = GHz 5.0\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "a=3;\n", + "lc=2*a;\n", + "Zs=500;n=377;c=3*(10**8);\n", + "lo=sqrt(1-((n/Zs)**2))*lc;\n", + "f=c/lo;\n", + "f1=f/(10**7);\n", + "print\"Frequency of dominant mode = GHz\",round(f1*100)/100\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_3 pgno:78" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(i)Cutoff wavelegth = cm\n", + "9.0\n", + "(ii)Guide wavelength = cm\n", + "3.59\n", + "(iii)Phase velocity = * 10**8 m/sec\n", + "3.23\n", + " Group velocity = * 10**8 m/sec\n", + "2.79\n", + "(iv)Characteristic impedance = ohm 406.0\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "a=4.5;b=3.;f=9.*(10**9);c=3.0*(10**8);n=377.\n", + "lo=c/f;\n", + "l=lo*(10**2);\n", + "lc=2*a;\n", + "print\"(i)Cutoff wavelegth = cm\\n\",lc\n", + "lg=l /(sqrt(1-((l/lc)**2)));\n", + "print\"(ii)Guide wavelength = cm\\n\",round(lg*100)/100\n", + "Vp=(lg/l)*c*10**-8;\n", + "print\"(iii)Phase velocity = * 10**8 m/sec\\n\",round(Vp*100)/100\n", + "Vg=(l/lg)*c*10**-8;\n", + "print\" Group velocity = * 10**8 m/sec\\n\",round(Vg*100)/100\n", + "Z=n/(sqrt(1-((l/lc)**2)));\n", + "print\"(iv)Characteristic impedance = ohm\",round(Z)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_4 pgno:79" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total attenuation = db 681.88\n", + "The difference in result is due to erroneous value in textbook\n" + ] + } + ], + "source": [ + "a=1.;c=3.*(10**8);f=(10**9);d=25.;\n", + "lc=2*a;\n", + "lo=c/f;\n", + "l=lo/(10**2);\n", + "att=(54.55/lc)*d;\n", + "print\"Total attenuation = db\",round(att*100)/100\n", + "#the difference in result is due to erroneous value in textbook.\n", + "print (\"The difference in result is due to erroneous value in textbook\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_5 pgno:80" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-Phase velocity Vp = * 10**8 m/sec\n", + "4.2\n", + "-Group velocity Vg = * 10**8 m/sec\n", + "2.2\n", + "-Phase constant = radians/m 45.0\n" + ] + } + ], + "source": [ + "from math import sqrt,pi\n", + "c=3.*(10**8);f=3000.*(10**6);a=.0722;\n", + "lo=c/f;\n", + "lc=2*a;\n", + "lg=lo/(sqrt(1-((lo/lc)**2)));\n", + "Vp=(lg/lo)*c*10**-8;\n", + "print\"-Phase velocity Vp = * 10**8 m/sec\\n\",round(Vp*10)/10\n", + "Vg=(lo/lg)*c*10**-8;\n", + "print\"-Group velocity Vg = * 10**8 m/sec\\n\",round(Vg*10)/10\n", + "b=(2*pi)/lg;\n", + "print\"-Phase constant = radians/m\",round(b)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_6 pgno:81" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(i)Cutoff frequency for TE11 = GHz\n", + "3.52\n", + "(ii)Cutoff frequency for TE01 = GHz 4.6\n" + ] + } + ], + "source": [ + "\n", + "d=5.;c=3.*(10**8);\n", + "lo=1.706*d;\n", + "f=c/lo;\n", + "ff=f/(10**7);\n", + "print\"(i)Cutoff frequency for TE11 = GHz\\n\",round(ff*100)/100\n", + "l=1.306*d;\n", + "fc=c/l;\n", + "ffc=fc/(10**7);\n", + "print\"(ii)Cutoff frequency for TE01 = GHz\",round(ffc*10)/10\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_7 pgno:82" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-Cutoff wavelength = cm\n", + "8.54\n", + "-Guide wavelength = cm\n", + "4.17\n", + "-Characteristic wave impedance = ohm 419.7\n" + ] + } + ], + "source": [ + "from math import pi,sqrt\n", + "c=3.*(10**8);f=8.*(10**9);r=2.5;h=1.84;n=377.;\n", + "l=c/f;\n", + "lo=l*(10**2);\n", + "lc=2*pi*r/h;\n", + "print\"-Cutoff wavelength = cm\\n\",round(lc*100)/100\n", + "lp=lo/(sqrt(1-((lo/lc)**2)));\n", + "print\"-Guide wavelength = cm\\n\",round(lp*100)/100\n", + "Zo=n/(sqrt(1-((lo/lc)**2)));\n", + "print\"-Characteristic wave impedance = ohm\",round(Zo*10)/10\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/ManchukondaGopi Krishna/Chapter_7_Wave.ipynb b/sample_notebooks/ManchukondaGopi Krishna/Chapter_7_Wave.ipynb deleted file mode 100755 index 38d38099..00000000 --- a/sample_notebooks/ManchukondaGopi Krishna/Chapter_7_Wave.ipynb +++ /dev/null @@ -1,299 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 7 Wave Guides" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_1 pgno:75" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "-Critical wavelength = cm\n", - "15.24\n", - "-Guide wavelength = cm 13.3\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "c=3.*(10**8);\n", - "f=3000.*(10**8);\n", - "lo=c/f;\n", - "l=lo*(10**4);\n", - "m=1.;n=0;a=7.62;\n", - "lc=2*a;\n", - "print\"-Critical wavelength = cm\\n\",lc\n", - "lg=sqrt((l*l*lc*lc)/((lc*lc)-(l*l)));\n", - "print\"-Guide wavelength = cm\",round(lg*10)/10\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_2 pgno:76" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Frequency of dominant mode = GHz 5.0\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "a=3;\n", - "lc=2*a;\n", - "Zs=500;n=377;c=3*(10**8);\n", - "lo=sqrt(1-((n/Zs)**2))*lc;\n", - "f=c/lo;\n", - "f1=f/(10**7);\n", - "print\"Frequency of dominant mode = GHz\",round(f1*100)/100\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_3 pgno:78" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(i)Cutoff wavelegth = cm\n", - "9.0\n", - "(ii)Guide wavelength = cm\n", - "3.59\n", - "(iii)Phase velocity = * 10**8 m/sec\n", - "3.23\n", - " Group velocity = * 10**8 m/sec\n", - "2.79\n", - "(iv)Characteristic impedance = ohm 406.0\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "a=4.5;b=3.;f=9.*(10**9);c=3.0*(10**8);n=377.\n", - "lo=c/f;\n", - "l=lo*(10**2);\n", - "lc=2*a;\n", - "print\"(i)Cutoff wavelegth = cm\\n\",lc\n", - "lg=l /(sqrt(1-((l/lc)**2)));\n", - "print\"(ii)Guide wavelength = cm\\n\",round(lg*100)/100\n", - "Vp=(lg/l)*c*10**-8;\n", - "print\"(iii)Phase velocity = * 10**8 m/sec\\n\",round(Vp*100)/100\n", - "Vg=(l/lg)*c*10**-8;\n", - "print\" Group velocity = * 10**8 m/sec\\n\",round(Vg*100)/100\n", - "Z=n/(sqrt(1-((l/lc)**2)));\n", - "print\"(iv)Characteristic impedance = ohm\",round(Z)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_4 pgno:79" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Total attenuation = db 681.88\n", - "The difference in result is due to erroneous value in textbook\n" - ] - } - ], - "source": [ - "a=1.;c=3.*(10**8);f=(10**9);d=25.;\n", - "lc=2*a;\n", - "lo=c/f;\n", - "l=lo/(10**2);\n", - "att=(54.55/lc)*d;\n", - "print\"Total attenuation = db\",round(att*100)/100\n", - "#the difference in result is due to erroneous value in textbook.\n", - "print (\"The difference in result is due to erroneous value in textbook\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_5 pgno:80" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "-Phase velocity Vp = * 10**8 m/sec\n", - "4.2\n", - "-Group velocity Vg = * 10**8 m/sec\n", - "2.2\n", - "-Phase constant = radians/m 45.0\n" - ] - } - ], - "source": [ - "from math import sqrt,pi\n", - "c=3.*(10**8);f=3000.*(10**6);a=.0722;\n", - "lo=c/f;\n", - "lc=2*a;\n", - "lg=lo/(sqrt(1-((lo/lc)**2)));\n", - "Vp=(lg/lo)*c*10**-8;\n", - "print\"-Phase velocity Vp = * 10**8 m/sec\\n\",round(Vp*10)/10\n", - "Vg=(lo/lg)*c*10**-8;\n", - "print\"-Group velocity Vg = * 10**8 m/sec\\n\",round(Vg*10)/10\n", - "b=(2*pi)/lg;\n", - "print\"-Phase constant = radians/m\",round(b)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_6 pgno:81" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(i)Cutoff frequency for TE11 = GHz\n", - "3.52\n", - "(ii)Cutoff frequency for TE01 = GHz 4.6\n" - ] - } - ], - "source": [ - "\n", - "d=5.;c=3.*(10**8);\n", - "lo=1.706*d;\n", - "f=c/lo;\n", - "ff=f/(10**7);\n", - "print\"(i)Cutoff frequency for TE11 = GHz\\n\",round(ff*100)/100\n", - "l=1.306*d;\n", - "fc=c/l;\n", - "ffc=fc/(10**7);\n", - "print\"(ii)Cutoff frequency for TE01 = GHz\",round(ffc*10)/10\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_7 pgno:82" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "-Cutoff wavelength = cm\n", - "8.54\n", - "-Guide wavelength = cm\n", - "4.17\n", - "-Characteristic wave impedance = ohm 419.7\n" - ] - } - ], - "source": [ - "from math import pi,sqrt\n", - "c=3.*(10**8);f=8.*(10**9);r=2.5;h=1.84;n=377.;\n", - "l=c/f;\n", - "lo=l*(10**2);\n", - "lc=2*pi*r/h;\n", - "print\"-Cutoff wavelength = cm\\n\",round(lc*100)/100\n", - "lp=lo/(sqrt(1-((lo/lc)**2)));\n", - "print\"-Guide wavelength = cm\\n\",round(lp*100)/100\n", - "Zo=n/(sqrt(1-((lo/lc)**2)));\n", - "print\"-Characteristic wave impedance = ohm\",round(Zo*10)/10\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/ManchukondaMaruthi Naga Vijaya Durga/Chapter_2_Generalized_Configurations_and_Functional_Descriptions_of.ipynb b/sample_notebooks/ManchukondaMaruthi Naga Vijaya Durga/Chapter_2_Generalized_Configurations_and_Functional_Descriptions_of.ipynb new file mode 100755 index 00000000..2cb57529 --- /dev/null +++ b/sample_notebooks/ManchukondaMaruthi Naga Vijaya Durga/Chapter_2_Generalized_Configurations_and_Functional_Descriptions_of.ipynb @@ -0,0 +1,109 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 2 Generalized Configurations and Functional Descriptions of Measuring Instruments" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_1 pgno:22" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ts=0.1\n", + "ps=2.5\n", + "dT=20\n", + "the error in measurement is d percent\n", + "0.007\n" + ] + } + ], + "source": [ + "#Caption_Error in measurement\n", + "#Ex_1 part_2 #page 22\n", + "print (\"ts=0.1\")\n", + "print (\"ps=2.5\")\n", + "print (\"dT=20\")\n", + "\n", + "ts=0.1 #('enter the temperature sensitivity=:')\n", + "ps=2.5 #('enter the pressure sensitivity(in units/MPa)=:')\n", + "dT=20 #('enter the temperature change during pressure measurement=:')\n", + "P=120 #('enter the pressure to be measured (in MPa)=:')\n", + "error=(ts*dT)/(ps*P);\n", + "print'the error in measurement is d percent\\n',round(error,3) " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_2 pgno:23" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the error in measurement is d percent\n", + "0.017\n" + ] + } + ], + "source": [ + "#Caption_Error in measurement\n", + "#Ex_2 part_2 #page 23\n", + "\n", + "\n", + "ts=0.5 #('enter the temperature sensitivity=:')\n", + "ps=7.5 #('enter the pressure sensitivity(in units/MPa)=:')\n", + "dT=40 #('enter the temperature change during pressure measurement=:')\n", + "P=160 #('enter the pressure to be measured (in MPa)=:')\n", + "error=(ts*dT)/(ps*P);\n", + "print'the error in measurement is d percent\\n',round(error,3) " + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/ManchukondaMaruthi Naga Vijaya Durga/Chapter_2_Generalized_Configurations_and_Functional_Descriptions_of_Measuring.ipynb b/sample_notebooks/ManchukondaMaruthi Naga Vijaya Durga/Chapter_2_Generalized_Configurations_and_Functional_Descriptions_of_Measuring.ipynb deleted file mode 100755 index 2cb57529..00000000 --- a/sample_notebooks/ManchukondaMaruthi Naga Vijaya Durga/Chapter_2_Generalized_Configurations_and_Functional_Descriptions_of_Measuring.ipynb +++ /dev/null @@ -1,109 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 2 Generalized Configurations and Functional Descriptions of Measuring Instruments" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_1 pgno:22" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "ts=0.1\n", - "ps=2.5\n", - "dT=20\n", - "the error in measurement is d percent\n", - "0.007\n" - ] - } - ], - "source": [ - "#Caption_Error in measurement\n", - "#Ex_1 part_2 #page 22\n", - "print (\"ts=0.1\")\n", - "print (\"ps=2.5\")\n", - "print (\"dT=20\")\n", - "\n", - "ts=0.1 #('enter the temperature sensitivity=:')\n", - "ps=2.5 #('enter the pressure sensitivity(in units/MPa)=:')\n", - "dT=20 #('enter the temperature change during pressure measurement=:')\n", - "P=120 #('enter the pressure to be measured (in MPa)=:')\n", - "error=(ts*dT)/(ps*P);\n", - "print'the error in measurement is d percent\\n',round(error,3) " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_2 pgno:23" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the error in measurement is d percent\n", - "0.017\n" - ] - } - ], - "source": [ - "#Caption_Error in measurement\n", - "#Ex_2 part_2 #page 23\n", - "\n", - "\n", - "ts=0.5 #('enter the temperature sensitivity=:')\n", - "ps=7.5 #('enter the pressure sensitivity(in units/MPa)=:')\n", - "dT=40 #('enter the temperature change during pressure measurement=:')\n", - "P=160 #('enter the pressure to be measured (in MPa)=:')\n", - "error=(ts*dT)/(ps*P);\n", - "print'the error in measurement is d percent\\n',round(error,3) " - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/MandalaManoj pruthvi/Chapter_4.ipynb b/sample_notebooks/MandalaManoj pruthvi/Chapter_4.ipynb new file mode 100755 index 00000000..212743ac --- /dev/null +++ b/sample_notebooks/MandalaManoj pruthvi/Chapter_4.ipynb @@ -0,0 +1,658 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4 Radian Measure" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.1 page.no:96" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Radian measure is 0.314159 rad\n", + "(or)\n", + "Radian measure is (pi/10)rad\n" + ] + } + ], + "source": [ + "#To convert a degree measure to radians\n", + "from math import pi\n", + "\n", + "deg=18 # degree measure\n", + "radian=deg*(pi/180) # radian measure\n", + "print \"Radian measure is %f rad\\n(or)\"%radian\n", + "print \"Radian measure is (pi/%.0f)rad\"%(1/(radian/pi))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.2 page.no:96" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Degree measure is 20 degree\n" + ] + } + ], + "source": [ + "#To convert a radian meeasure to degree\n", + "from math import pi\n", + "\n", + "radian=pi/9 # radian measure\n", + "deg=radian/(pi/180) # degree measure\n", + "print \"Degree measure is %.0f degree\"%deg" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.3 page.no:99" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Length of arc intercepted =2.4 cm\n" + ] + } + ], + "source": [ + "#To determine length of the intercepted arc\n", + "r=2. #radius of circle\n", + "theta=1.2 # central angle in radian\n", + "s=r*theta # length of arc\n", + "print \"Length of arc intercepted =%.1f cm\"%s" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.4 page.no:99" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Length of arc intercepted = 7.16 ft \n" + ] + } + ], + "source": [ + "#To determine length of the arc intercepted\n", + "from math import pi\n", + "\n", + "r=10 #radius of circle\n", + "theta=41*(pi/180) # central angle in radian\n", + "s=r*theta # length of arc\n", + "print \"Length of arc intercepted = %.2f ft \"%s" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.5 page.no:100" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Measure of central angle = 0.40 rad\n", + " \n", + "Measure of central angle =22.92 degree\n" + ] + } + ], + "source": [ + "#To determine angle in radians and degrees\n", + "from math import pi\n", + "\n", + "r=5. #radius of circle\n", + "s=2. #length of arc\n", + "theta = s/r #central angle in radian\n", + "print \"Measure of central angle = %.2f rad\\n \"%theta\n", + "print \"Measure of central angle =%.2f degree\"%(theta*(180/pi))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.6 page.no:100" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Length of the rope =13.4 ft\n" + ] + } + ], + "source": [ + "#To determine the length of the rope\n", + "from math import sqrt,pi,atan,acos\n", + "\n", + "d=8. #distance between places in feet\n", + "r=2. #radius of cylinder in feet\n", + "#from the figure\n", + "DA=d/2\n", + "BE=r\n", + "DE=3 #distance from centre of container to wall\n", + "AE=sqrt(DE**2 + DA**2) # pythagoras theorem\n", + "AB=sqrt(AE**2 - BE**2) # pythagoras theorem\n", + "#all angles below are in radians\n", + "angle_AED = atan((d/2)/DE)\n", + "angle_AEB = acos(BE/AE)\n", + "angle_BEC = pi - (angle_AED + angle_AEB)\n", + "arc_BC = BE*angle_BEC #length of arc BC\n", + "L = 2*(AB + arc_BC) #length of rope\n", + "print \"Length of the rope =%.1f ft\"%L" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.7 page.no:101" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Length of belt around pulley = 71.4 cm\n" + ] + } + ], + "source": [ + "#To determine the length of the belt around the pulleys\n", + "from math import pi,sqrt,asin\n", + "\n", + "AE= 5. #radius of first pulley in cm\n", + "BF= 8. #radius of second pulley in cm\n", + "AB=15. #distance between centre of pulleys in cm\n", + "#from the figure\n", + "CF=AE #parallel side of rectangle ACFE\n", + "BC= BF- CF\n", + "AC = sqrt(AB**2 - BC**2) #by pythagoras theorem\n", + "EF=AC# parallel side of rectangle ACFE 14\n", + "angle_EAC = pi/2\n", + "angle_BAC = asin(BC/AB)\n", + "angle_DAE = pi - angle_EAC - angle_BAC\n", + "angle_ABC = angle_DAE #AE and BF are parallel\n", + "angle_GBF= pi - angle_ABC\n", + "arc_DE=AE*angle_ABC # length of arc DE\n", + "arc_FG=BF*angle_GBF # length of arc FG\n", + "L=2*(arc_DE + EF + arc_FG) #length of belt\n", + "print \"Length of belt around pulley = %.1f cm\"%L" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.8 page.no:103" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Area of sector = 1.6∗pi cmˆ2\n", + "(or)\n", + "Area of sector = 5.026548 cmˆ2\n" + ] + } + ], + "source": [ + "#To find the area of sector of circle\n", + "from math import pi\n", + "\n", + "theta= pi/5 # angle in radian\n", + "r=4. #radius in cm\n", + "A=r*r*theta/2 #Area of sector\n", + "print \"Area of sector = %.1f∗pi cmˆ2\\n(or)\"%(A/pi)\n", + "print \"Area of sector = %f cmˆ2\"%A" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.9 page.no:103" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Area of sector =12.51 mˆ2\n" + ] + } + ], + "source": [ + "#To determine area of sector of a circle\n", + "from math import pi\n", + "\n", + "theta= 117*(pi/180) # angle in radian\n", + "r=3.5 #radius in m\n", + "A=r*r*theta/2 #Area of sector\n", + "print \"Area of sector =%.2f mˆ2\"%A" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.10 page.no:104" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Area of sector =27 cmˆ2\n", + "\n", + "Note: Angle subtended by arc = 0.666667 rad\n" + ] + } + ], + "source": [ + "#To determine area of sector of circle\n", + "\n", + "s=6. #arc length in cm\n", + "r=9. #radius in cm\n", + "A=r*s/2 #Area of sector\n", + "print \"Area of sector =%.0f cmˆ2\\n\"%A\n", + "print \"Note: Angle subtended by arc = %f rad\"%(s/r)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.11 page.no:104" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Area enclosed by belt pulley system = 338.71 cmˆ2 \n" + ] + } + ], + "source": [ + "#To determine area insude belt pulley system\n", + "from math import pi,sqrt,asin\n", + "\n", + "AE= 5. #radius of first pulley\n", + "BF= 8. #radius of second pulley\n", + "AB=15. #distance between centre of pulleys\n", + "#from the figure\n", + "CF=AE\n", + "BC= BF- CF\n", + "AC = sqrt(AB**2 - BC**2)\n", + "#from the figure\n", + "angle_EAC = pi/2\n", + "angle_BAC = asin(BC/AB)\n", + "angle_DAE = pi - angle_EAC - angle_BAC\n", + "angle_ABC = angle_DAE #AE and BF are parallel\n", + "angle_GBF= pi - angle_ABC\n", + "area_DAE = AE**2*angle_DAE/2 #area of sector DAE\n", + "area_GBF = BF**2*angle_GBF/2 #area of sector GBF\n", + "area_AEFC = AE*AC #area of rectangle AEFC\n", + "area_ABC = AC*BC/2 #area of triangle ABC\n", + "area_K =2*( area_DAE + area_AEFC + area_ABC +area_GBF)\n", + "print \"Area enclosed by belt pulley system = %.2f cmˆ2 \"%area_K\n", + "#Note: answer differs from book due to approximations by them " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.12 page.no:105" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Required area of segment = 1.408 square units\n" + ] + } + ], + "source": [ + "#To determine area of segment formed by a chord in circle\n", + "from math import acos,sin\n", + "\n", + "radius = 2.\n", + "chord = 3.\n", + "#Use law of cosines\n", + "cos_theta = (radius**2+radius**2-chord**2)/(2*radius*radius)\n", + "theta=acos(cos_theta) #subtended central angle in radians\n", + "area_K=radius**2*(theta-sin(theta))/2\n", + "print \"Required area of segment = %.3f square units\"%area_K" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.13 page.no:106" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Area of intersection of 2 circles =7.66 cm ˆ2 \n" + ] + } + ], + "source": [ + "#To determine area of intersection of 2 circles\n", + "from math import acos\n", + "\n", + "d=7. #distance between centres in cm\n", + "r1= 5. #radius of first circle in cm\n", + "r2= 4. #radius of second circle in cm\n", + "#use law of cosines\n", + "cos_alpha=(d**2+ r1**2 - r2**2 ) /(2*d*r1)\n", + "cos_beeta=(d**2+ r2**2 - r1**2 ) /(2*d*r2)\n", + "#from the geometry of the figure\n", + "#all the angles below are in radians\n", + "alpha= acos(cos_alpha)\n", + "beeta= acos(cos_beeta)\n", + "angle_BAC = alpha\n", + "angle_ABC = beeta\n", + "angle_CAD =2* angle_BAC\n", + "angle_CBD =2* angle_ABC\n", + "#required area = area at segment CD in circle at A and at B\n", + "area_K = r1**2*(angle_CAD-sin(angle_CAD))/2 + r2 **2*(angle_CBD-sin(angle_CBD))/2\n", + "print \"Area of intersection of 2 circles =%.2f cm ˆ2 \"%area_K" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.14 page.no:109" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Angular speed= 2.094395 radian/sec\n", + "\n", + "Linear speed=6.283185m/sec\n", + "\n", + "(or)\n", + "\n", + "Angular speed= 0.666667∗pi radian/sec\n", + " \n", + "Linear speed = 2.000000∗pi m/sec \n" + ] + } + ], + "source": [ + "#To find linear and angular speed of a moving object\n", + "from math import pi\n", + "t=0.5 #time in second\n", + "r= 3 #radius in m of the circle\n", + "theta = pi/3 # central angle in radian\n", + "w = theta/t #angular speed in rad /sec\n", + "v=w*r#linear speed in m/sec\n", + "print \"Angular speed= %f radian/sec\\n\"%w\n", + "print \"Linear speed=%fm/sec\"%v\n", + "print \"\\n(or)\\n\\nAngular speed= %f∗pi radian/sec\\n \"%(w/pi)\n", + "print \"Linear speed = %f∗pi m/sec \"%(v/pi)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.15 page.no:109" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Linear speed = 12.96 ft/sec\n", + "\n", + "Angular speed= 6.48 radian/sec\n" + ] + } + ], + "source": [ + "#To find linear and angular speed of a moving object\n", + "\n", + "t=2.7 #time in second\n", + "r= 2. #radius in ft of the circle\n", + "s=35. #distance in feet\n", + "v=s/t #linear speed in ft/sec\n", + "w=v/r #angular speed in rad /sec\n", + "print \"Linear speed = %.2f ft/sec\\n\"%v\n", + "print \"Angular speed= %.2f radian/sec\"%w" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.16 page.no:109" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "central angle swept = 7.75 radian \n" + ] + } + ], + "source": [ + "#To find the central angle swept by a moving object\n", + "t=3.1 #time in second\n", + "v= 10 #linear speed in m/sec\n", + "r= 4 #radius in m of the circle\n", + "s=v*t # distance in m\n", + "theta = s/r #central angle swept\n", + "print \"central angle swept = %.2f radian \"%theta" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.17 page.no:110" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Angular speed of larger gear=20 rpm \n" + ] + } + ], + "source": [ + "#To find the angular speed of larger gear interlocked with smaller gear\n", + "r1=5 #radius of larger gear\n", + "r2=4 #radius smaller gear\n", + "w2=25 #angular speed of smaller gear\n", + "# Imagine a particle on outer radii of each gear\n", + "#At any time , for every rotation , circular displacement of each particle is same\n", + "# (or) s1=s2 implies v1∗t=v2∗t\n", + "#v1= v2 implies w1∗r1=w2∗r2\n", + "w1=(w2*r2)/r1 #angular speed of larger gear\n", + "print \"Angular speed of larger gear=%.0f rpm \"%w1" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/MandalaManoj pruthvi/Chapter_4_Radian.ipynb b/sample_notebooks/MandalaManoj pruthvi/Chapter_4_Radian.ipynb deleted file mode 100755 index 212743ac..00000000 --- a/sample_notebooks/MandalaManoj pruthvi/Chapter_4_Radian.ipynb +++ /dev/null @@ -1,658 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 4 Radian Measure" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.1 page.no:96" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Radian measure is 0.314159 rad\n", - "(or)\n", - "Radian measure is (pi/10)rad\n" - ] - } - ], - "source": [ - "#To convert a degree measure to radians\n", - "from math import pi\n", - "\n", - "deg=18 # degree measure\n", - "radian=deg*(pi/180) # radian measure\n", - "print \"Radian measure is %f rad\\n(or)\"%radian\n", - "print \"Radian measure is (pi/%.0f)rad\"%(1/(radian/pi))" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.2 page.no:96" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Degree measure is 20 degree\n" - ] - } - ], - "source": [ - "#To convert a radian meeasure to degree\n", - "from math import pi\n", - "\n", - "radian=pi/9 # radian measure\n", - "deg=radian/(pi/180) # degree measure\n", - "print \"Degree measure is %.0f degree\"%deg" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.3 page.no:99" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Length of arc intercepted =2.4 cm\n" - ] - } - ], - "source": [ - "#To determine length of the intercepted arc\n", - "r=2. #radius of circle\n", - "theta=1.2 # central angle in radian\n", - "s=r*theta # length of arc\n", - "print \"Length of arc intercepted =%.1f cm\"%s" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.4 page.no:99" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Length of arc intercepted = 7.16 ft \n" - ] - } - ], - "source": [ - "#To determine length of the arc intercepted\n", - "from math import pi\n", - "\n", - "r=10 #radius of circle\n", - "theta=41*(pi/180) # central angle in radian\n", - "s=r*theta # length of arc\n", - "print \"Length of arc intercepted = %.2f ft \"%s" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.5 page.no:100" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Measure of central angle = 0.40 rad\n", - " \n", - "Measure of central angle =22.92 degree\n" - ] - } - ], - "source": [ - "#To determine angle in radians and degrees\n", - "from math import pi\n", - "\n", - "r=5. #radius of circle\n", - "s=2. #length of arc\n", - "theta = s/r #central angle in radian\n", - "print \"Measure of central angle = %.2f rad\\n \"%theta\n", - "print \"Measure of central angle =%.2f degree\"%(theta*(180/pi))" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.6 page.no:100" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Length of the rope =13.4 ft\n" - ] - } - ], - "source": [ - "#To determine the length of the rope\n", - "from math import sqrt,pi,atan,acos\n", - "\n", - "d=8. #distance between places in feet\n", - "r=2. #radius of cylinder in feet\n", - "#from the figure\n", - "DA=d/2\n", - "BE=r\n", - "DE=3 #distance from centre of container to wall\n", - "AE=sqrt(DE**2 + DA**2) # pythagoras theorem\n", - "AB=sqrt(AE**2 - BE**2) # pythagoras theorem\n", - "#all angles below are in radians\n", - "angle_AED = atan((d/2)/DE)\n", - "angle_AEB = acos(BE/AE)\n", - "angle_BEC = pi - (angle_AED + angle_AEB)\n", - "arc_BC = BE*angle_BEC #length of arc BC\n", - "L = 2*(AB + arc_BC) #length of rope\n", - "print \"Length of the rope =%.1f ft\"%L" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.7 page.no:101" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Length of belt around pulley = 71.4 cm\n" - ] - } - ], - "source": [ - "#To determine the length of the belt around the pulleys\n", - "from math import pi,sqrt,asin\n", - "\n", - "AE= 5. #radius of first pulley in cm\n", - "BF= 8. #radius of second pulley in cm\n", - "AB=15. #distance between centre of pulleys in cm\n", - "#from the figure\n", - "CF=AE #parallel side of rectangle ACFE\n", - "BC= BF- CF\n", - "AC = sqrt(AB**2 - BC**2) #by pythagoras theorem\n", - "EF=AC# parallel side of rectangle ACFE 14\n", - "angle_EAC = pi/2\n", - "angle_BAC = asin(BC/AB)\n", - "angle_DAE = pi - angle_EAC - angle_BAC\n", - "angle_ABC = angle_DAE #AE and BF are parallel\n", - "angle_GBF= pi - angle_ABC\n", - "arc_DE=AE*angle_ABC # length of arc DE\n", - "arc_FG=BF*angle_GBF # length of arc FG\n", - "L=2*(arc_DE + EF + arc_FG) #length of belt\n", - "print \"Length of belt around pulley = %.1f cm\"%L" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.8 page.no:103" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Area of sector = 1.6∗pi cmˆ2\n", - "(or)\n", - "Area of sector = 5.026548 cmˆ2\n" - ] - } - ], - "source": [ - "#To find the area of sector of circle\n", - "from math import pi\n", - "\n", - "theta= pi/5 # angle in radian\n", - "r=4. #radius in cm\n", - "A=r*r*theta/2 #Area of sector\n", - "print \"Area of sector = %.1f∗pi cmˆ2\\n(or)\"%(A/pi)\n", - "print \"Area of sector = %f cmˆ2\"%A" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.9 page.no:103" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Area of sector =12.51 mˆ2\n" - ] - } - ], - "source": [ - "#To determine area of sector of a circle\n", - "from math import pi\n", - "\n", - "theta= 117*(pi/180) # angle in radian\n", - "r=3.5 #radius in m\n", - "A=r*r*theta/2 #Area of sector\n", - "print \"Area of sector =%.2f mˆ2\"%A" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.10 page.no:104" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Area of sector =27 cmˆ2\n", - "\n", - "Note: Angle subtended by arc = 0.666667 rad\n" - ] - } - ], - "source": [ - "#To determine area of sector of circle\n", - "\n", - "s=6. #arc length in cm\n", - "r=9. #radius in cm\n", - "A=r*s/2 #Area of sector\n", - "print \"Area of sector =%.0f cmˆ2\\n\"%A\n", - "print \"Note: Angle subtended by arc = %f rad\"%(s/r)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.11 page.no:104" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Area enclosed by belt pulley system = 338.71 cmˆ2 \n" - ] - } - ], - "source": [ - "#To determine area insude belt pulley system\n", - "from math import pi,sqrt,asin\n", - "\n", - "AE= 5. #radius of first pulley\n", - "BF= 8. #radius of second pulley\n", - "AB=15. #distance between centre of pulleys\n", - "#from the figure\n", - "CF=AE\n", - "BC= BF- CF\n", - "AC = sqrt(AB**2 - BC**2)\n", - "#from the figure\n", - "angle_EAC = pi/2\n", - "angle_BAC = asin(BC/AB)\n", - "angle_DAE = pi - angle_EAC - angle_BAC\n", - "angle_ABC = angle_DAE #AE and BF are parallel\n", - "angle_GBF= pi - angle_ABC\n", - "area_DAE = AE**2*angle_DAE/2 #area of sector DAE\n", - "area_GBF = BF**2*angle_GBF/2 #area of sector GBF\n", - "area_AEFC = AE*AC #area of rectangle AEFC\n", - "area_ABC = AC*BC/2 #area of triangle ABC\n", - "area_K =2*( area_DAE + area_AEFC + area_ABC +area_GBF)\n", - "print \"Area enclosed by belt pulley system = %.2f cmˆ2 \"%area_K\n", - "#Note: answer differs from book due to approximations by them " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.12 page.no:105" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Required area of segment = 1.408 square units\n" - ] - } - ], - "source": [ - "#To determine area of segment formed by a chord in circle\n", - "from math import acos,sin\n", - "\n", - "radius = 2.\n", - "chord = 3.\n", - "#Use law of cosines\n", - "cos_theta = (radius**2+radius**2-chord**2)/(2*radius*radius)\n", - "theta=acos(cos_theta) #subtended central angle in radians\n", - "area_K=radius**2*(theta-sin(theta))/2\n", - "print \"Required area of segment = %.3f square units\"%area_K" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.13 page.no:106" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Area of intersection of 2 circles =7.66 cm ˆ2 \n" - ] - } - ], - "source": [ - "#To determine area of intersection of 2 circles\n", - "from math import acos\n", - "\n", - "d=7. #distance between centres in cm\n", - "r1= 5. #radius of first circle in cm\n", - "r2= 4. #radius of second circle in cm\n", - "#use law of cosines\n", - "cos_alpha=(d**2+ r1**2 - r2**2 ) /(2*d*r1)\n", - "cos_beeta=(d**2+ r2**2 - r1**2 ) /(2*d*r2)\n", - "#from the geometry of the figure\n", - "#all the angles below are in radians\n", - "alpha= acos(cos_alpha)\n", - "beeta= acos(cos_beeta)\n", - "angle_BAC = alpha\n", - "angle_ABC = beeta\n", - "angle_CAD =2* angle_BAC\n", - "angle_CBD =2* angle_ABC\n", - "#required area = area at segment CD in circle at A and at B\n", - "area_K = r1**2*(angle_CAD-sin(angle_CAD))/2 + r2 **2*(angle_CBD-sin(angle_CBD))/2\n", - "print \"Area of intersection of 2 circles =%.2f cm ˆ2 \"%area_K" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.14 page.no:109" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Angular speed= 2.094395 radian/sec\n", - "\n", - "Linear speed=6.283185m/sec\n", - "\n", - "(or)\n", - "\n", - "Angular speed= 0.666667∗pi radian/sec\n", - " \n", - "Linear speed = 2.000000∗pi m/sec \n" - ] - } - ], - "source": [ - "#To find linear and angular speed of a moving object\n", - "from math import pi\n", - "t=0.5 #time in second\n", - "r= 3 #radius in m of the circle\n", - "theta = pi/3 # central angle in radian\n", - "w = theta/t #angular speed in rad /sec\n", - "v=w*r#linear speed in m/sec\n", - "print \"Angular speed= %f radian/sec\\n\"%w\n", - "print \"Linear speed=%fm/sec\"%v\n", - "print \"\\n(or)\\n\\nAngular speed= %f∗pi radian/sec\\n \"%(w/pi)\n", - "print \"Linear speed = %f∗pi m/sec \"%(v/pi)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.15 page.no:109" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Linear speed = 12.96 ft/sec\n", - "\n", - "Angular speed= 6.48 radian/sec\n" - ] - } - ], - "source": [ - "#To find linear and angular speed of a moving object\n", - "\n", - "t=2.7 #time in second\n", - "r= 2. #radius in ft of the circle\n", - "s=35. #distance in feet\n", - "v=s/t #linear speed in ft/sec\n", - "w=v/r #angular speed in rad /sec\n", - "print \"Linear speed = %.2f ft/sec\\n\"%v\n", - "print \"Angular speed= %.2f radian/sec\"%w" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.16 page.no:109" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "central angle swept = 7.75 radian \n" - ] - } - ], - "source": [ - "#To find the central angle swept by a moving object\n", - "t=3.1 #time in second\n", - "v= 10 #linear speed in m/sec\n", - "r= 4 #radius in m of the circle\n", - "s=v*t # distance in m\n", - "theta = s/r #central angle swept\n", - "print \"central angle swept = %.2f radian \"%theta" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.17 page.no:110" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Angular speed of larger gear=20 rpm \n" - ] - } - ], - "source": [ - "#To find the angular speed of larger gear interlocked with smaller gear\n", - "r1=5 #radius of larger gear\n", - "r2=4 #radius smaller gear\n", - "w2=25 #angular speed of smaller gear\n", - "# Imagine a particle on outer radii of each gear\n", - "#At any time , for every rotation , circular displacement of each particle is same\n", - "# (or) s1=s2 implies v1∗t=v2∗t\n", - "#v1= v2 implies w1∗r1=w2∗r2\n", - "w1=(w2*r2)/r1 #angular speed of larger gear\n", - "print \"Angular speed of larger gear=%.0f rpm \"%w1" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/ManikandanD/Chapter_2_Light_propagation_in.ipynb b/sample_notebooks/ManikandanD/Chapter_2_Light_propagation_in.ipynb new file mode 100755 index 00000000..fb6cc7a3 --- /dev/null +++ b/sample_notebooks/ManikandanD/Chapter_2_Light_propagation_in.ipynb @@ -0,0 +1,430 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e126fa636efa72af4b20cd3702da45f085d125811e3d4b6de05ba5fde96d2c77" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2:Light propagation in optical ber" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.1 , Page no:30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "ncore=1.46; #refractive index of core\n", + "nclad=1; #refractive index of cladding\n", + "c=3e5; #velocity of light in Km/s\n", + "L=1; #length of path in Km\n", + "\n", + "#CALCULATIONS\n", + "NA=math.sqrt(ncore**2-nclad**2); #Numerical aperture\n", + "delt_tau_by_L=(NA**2)/(2*c*ncore); #multipath pulse broadening in s/Km\n", + "delt_tau=delt_tau_by_L*L; #bandwidth distance product Hz\n", + "BL=(1/delt_tau)*L; #bandwidth distance product Hz\n", + "#case-2\n", + "ncore1=1.465; #refractive index of core\n", + "nclad1=1.45; #refractive index of cladding\n", + "NA1=math.sqrt(ncore1**2-nclad1**2); #Numerical aperture\n", + "delt_tau_by_L1=(NA1**2)/(2*c*ncore1); #multipath pulse broadening in s/m\n", + "BL1=(1/delt_tau_by_L1)*L; #bandwidth distance product Hz\n", + "\n", + "#RESULTS\n", + "print\"Numerical aperture=\",round(NA,5); #The answers vary due to round off error\n", + "print\"\\nMultipath pulse broadening=\",round(delt_tau_by_L*1e9,5),\"ns/Km\"; #The answer provided in the textbook is wrong//multiplication by 1e9 to convert s/Km to ns/Km \n", + "print\"\\nBandwidth distance product=\",round(BL*1e-6,5),\"GHz \"; #The answer provided in the textbook is wrong//multiplication by 1e-6 to convert Hz to MHz\n", + "print\"\\n\\nNumerical aperture=\",round(NA1,5);\n", + "print\"\\nMultipath pulse broadening=\",round(delt_tau_by_L1*1e9,5),\"ns/Km\"; #The answer provided in the textbook is wrong//multiplication by 1e9 to convert s/Km to ns/Km \n", + "print\"\\nBandwidth distance product=\",round(BL1*1e-9,5),\"GHz \"; #The answer provided in the textbook is wrong//multiplication by 1e-6 to convert Hz to GHz" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Numerical aperture= 1.06377\n", + "\n", + "Multipath pulse broadening= 1291.78082 ns/Km\n", + "\n", + "Bandwidth distance product= 0.77413 GHz \n", + "\n", + "\n", + "Numerical aperture= 0.20911\n", + "\n", + "Multipath pulse broadening= 49.74403 ns/Km\n", + "\n", + "Bandwidth distance product= 0.0201 GHz \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.2 , Page no:30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "lamda1=0.7; #wavelength in um\n", + "lamda2=1.3; #wavelength in um\n", + "lamda3=2; #wavelength in um\n", + "\n", + "#CALCULATIONS\n", + "f_lambda1=(303.33*(lamda1**-1)-233.33); #equation for lambda1\n", + "f_lambda2=(303.33*(lamda2**-1)-233.33); #equation for lambda2\n", + "f_lambda3=(303.33*(lamda3**-1)-233.33); #equation for lambda3\n", + "\n", + "#RESULTS\n", + "print\"Material dispersion at Lambda 0.7um=\",round(f_lambda1,5);\n", + "print\"\\nMaterial dispersion at Lambda 1.3um=\",round(f_lambda2,5); #The answers vary due to round off error\n", + "print\"\\nMaterial dispersion at Lambda 2um=\",round(f_lambda3,5); #The answers vary due to round off error\n", + "print\"\\nIts is a standard silica fiber\";" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Material dispersion at Lambda 0.7um= 199.99857\n", + "\n", + "Material dispersion at Lambda 1.3um= 0.00077\n", + "\n", + "Material dispersion at Lambda 2um= -81.665\n", + "\n", + "Its is a standard silica fiber\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3 , Page no:32" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "ncore=1.505; #refractive index of core\n", + "nclad=1.502; #refractive index of cladding\n", + "V=2.4; #v no. for single mode \n", + "lambda1=1300e-9; #operating wavelength in m\n", + "\n", + "#CALCULATIONS\n", + "NA=math.sqrt(ncore**2-nclad**2); #numerical aperture\n", + "a=V*(lambda1)/(2*3.14*NA); #dimension of fiber core in m\n", + "\n", + "#RESULTS\n", + "print\"The numarical aperture =\",round(NA,5);\n", + "print\"\\n Dimension of fiber core =\",round(a*1e6,5),\"um\"; #multiplication by 1e6 to convert unit from m to um" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The numarical aperture = 0.09498\n", + "\n", + " Dimension of fiber core = 5.23079 um\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.4 , Page no:33" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "V=2; #v no. for single mode \n", + "a=4; #radius of fiber in um\n", + "\n", + "#CALCULATIONS\n", + "w=a*(0.65+1.619*V**(-3/2)+2.87*V**-6); #effective mode radius in um\n", + "\n", + "#RESULTS\n", + "print\"Effective mode radius =\",round(w,5),\"um\";" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Effective mode radius = 5.06899 um\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6 , Page no:34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "m=0; #for dominant mode\n", + "v=0; #for dominant mode\n", + "n1=1.5; #refractive index of core\n", + "delta=0.01; #core clad index difference\n", + "a=5; #fiber radius in um\n", + "lambda1=1.3; #wavelength of operation in um\n", + "\n", + "#CALCULATIONS\n", + "k0=(2*3.14/lambda1); #constant in /m\n", + "beta=math.sqrt((k0**2)*(n1**2)-(2*k0*n1*math.sqrt(2*delta)/a)); #propagation constant in rad/um\n", + "\n", + "#RESULTS\n", + "print\"Propagation constant=\",round(beta,5),\"rad/um\"; #The answers vary due to round off error" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Propagation constant= 7.21781 rad/um\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.8 , Page no:34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "M=1000; #modes supported\n", + "lambda1=1.3; #operating wavelength in um\n", + "n1=1.5; #refractive index of core\n", + "n2=1.48; #refractive index of cladding\n", + "\n", + "#CALCULATIONS\n", + "V=math.sqrt(2*M); #normalised frequency V no.\n", + "NA=math.sqrt(n1**2-n2**2); #numerical apperture\n", + "R=lambda1*V/(2*3.14*NA); #radius of fiber in um\n", + "\n", + "#RESULTS\n", + "print\"Core Radius=\",round(R,5),\"um\"; #The answer provided in the textbook is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Core Radius= 37.92063 um\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.9 , Page no:35" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "lambda1=1.3; #wavelength of operation in um\n", + "n1=1.5; #refractive index of core\n", + "n2=1.48; #refractive index of cladding\n", + "k0=2*3.14/lambda1; #constant in /m\n", + "\n", + "#CALCULATIONS\n", + "#case-1\n", + "b=0.5; #normalized propagation constant\n", + "k0=2*3.14/lambda1; #constant\n", + "beta=k0*math.sqrt(n2**2+b*(n1**2-n2**2)); #propagation constant\n", + "\n", + "#case-2\n", + "#given \n", + "lambda1=1.3; #wavelength of operation in um\n", + "n1=1.5; #refractive index of core\n", + "n2=1.48; #refractive index of cladding\n", + "k0=2*3.14/lambda1; #constant in /m\n", + "b=0.5; #normalized propagation constant\n", + "k0=2*3.14/lambda1; #constant\n", + "b1=(((n1+n2)/2)**2-n2**2)/(n1**2-n2**2); #normalized propagation constant\n", + "\n", + "#case-3\n", + "#given \n", + "lambda1=1.3; #wavelength of operation in um\n", + "n1=1.5; #refractive index of core\n", + "n21=1.0; #refractive index of cladding\n", + "k0=2*3.14/lambda1; #constant in /m\n", + "b=0.5; #normalized propagation constant\n", + "k0=2*3.14/lambda1; #constant\n", + "beta1=k0*math.sqrt(n21**2+b*(n1**2-n21**2)); #propagation constant\n", + "\n", + "#RESULTS\n", + "print\"Propagation constant=\",round(beta,5),\"rad/um\"; #The answers vary due to round off error\n", + "print\"\\nPropagation constant=\",round(b1,5); #The answers vary due to round off error\n", + "print\"\\nPropagation constant=\",round(beta1,5),\"rad/um\"; #The answers vary due to round off error" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Propagation constant= 7.19801 rad/um\n", + "\n", + "Propagation constant= 0.49832\n", + "\n", + "Propagation constant= 6.15805 rad/um\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.10 , Page no:35" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "#case-1\n", + "n1=1.49; #refractive index of core\n", + "n2=1.46; #refractive index of cladding\n", + "c=3*10**5; #speed of light in Km/s\n", + "t1=n1/c; #time delay for one traveling along axis in s/Km\n", + "t2=(n1**2/n2)/c; #time delay for one traveling along path that is totally reflecting at the first interface in s/km\n", + "\n", + "#case-2\n", + "n11=1.47; #refractive index of core\n", + "n21=1.46; #refractive index of cladding\n", + "c1=3*10**5; #speed of light in Km/s\n", + "t11=n11/c1; #time delay for one traveling along axis in\n", + "t22=(n11**2/n21)/c1; #time delay for one traveling along path that is totally reflecting at the first interface\n", + "\n", + "\n", + "print\"time delay for traveling along axis =\",round(t1*1e6,5),\"us/Km\"; #multiplication by 1e6 to convert the unit from s/Km to us/Km\n", + "print\"\\ntime delay for traveling along path that is totally reflecting at the first interface =\",round(t2*1e6,5),\"us/Km\"; #multiplication by 1e6 to convert the unit from s/Km to us/Km\n", + "print\"\\ntime delay for traveling along axis =\",round(t11*1e6,5),\"us/Km\"; #multiplication by 1e6 to convert the unit from s/Km to us/Km\n", + "print\"\\ntime delay for traveling along path that is totally reflecting at the first interface =\",round(t22*1e6,5),\"us/Km\"; #multiplication by 1e6 to convert the unit from s/Km to us/Km\n", + "#The answer provided in the textbook is wrong it has got wrong unit" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "time delay for traveling along axis = 4.96667 us/Km\n", + "\n", + "time delay for traveling along path that is totally reflecting at the first interface = 5.06872 us/Km\n", + "\n", + "time delay for traveling along axis = 4.9 us/Km\n", + "\n", + "time delay for traveling along path that is totally reflecting at the first interface = 4.93356 us/Km\n" + ] + } + ], + "prompt_number": 8 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/ManikandanD/Chapter_2_Light_propagation_in_optical.ipynb b/sample_notebooks/ManikandanD/Chapter_2_Light_propagation_in_optical.ipynb deleted file mode 100755 index fb6cc7a3..00000000 --- a/sample_notebooks/ManikandanD/Chapter_2_Light_propagation_in_optical.ipynb +++ /dev/null @@ -1,430 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:e126fa636efa72af4b20cd3702da45f085d125811e3d4b6de05ba5fde96d2c77" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 2:Light propagation in optical ber" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.1 , Page no:30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "ncore=1.46; #refractive index of core\n", - "nclad=1; #refractive index of cladding\n", - "c=3e5; #velocity of light in Km/s\n", - "L=1; #length of path in Km\n", - "\n", - "#CALCULATIONS\n", - "NA=math.sqrt(ncore**2-nclad**2); #Numerical aperture\n", - "delt_tau_by_L=(NA**2)/(2*c*ncore); #multipath pulse broadening in s/Km\n", - "delt_tau=delt_tau_by_L*L; #bandwidth distance product Hz\n", - "BL=(1/delt_tau)*L; #bandwidth distance product Hz\n", - "#case-2\n", - "ncore1=1.465; #refractive index of core\n", - "nclad1=1.45; #refractive index of cladding\n", - "NA1=math.sqrt(ncore1**2-nclad1**2); #Numerical aperture\n", - "delt_tau_by_L1=(NA1**2)/(2*c*ncore1); #multipath pulse broadening in s/m\n", - "BL1=(1/delt_tau_by_L1)*L; #bandwidth distance product Hz\n", - "\n", - "#RESULTS\n", - "print\"Numerical aperture=\",round(NA,5); #The answers vary due to round off error\n", - "print\"\\nMultipath pulse broadening=\",round(delt_tau_by_L*1e9,5),\"ns/Km\"; #The answer provided in the textbook is wrong//multiplication by 1e9 to convert s/Km to ns/Km \n", - "print\"\\nBandwidth distance product=\",round(BL*1e-6,5),\"GHz \"; #The answer provided in the textbook is wrong//multiplication by 1e-6 to convert Hz to MHz\n", - "print\"\\n\\nNumerical aperture=\",round(NA1,5);\n", - "print\"\\nMultipath pulse broadening=\",round(delt_tau_by_L1*1e9,5),\"ns/Km\"; #The answer provided in the textbook is wrong//multiplication by 1e9 to convert s/Km to ns/Km \n", - "print\"\\nBandwidth distance product=\",round(BL1*1e-9,5),\"GHz \"; #The answer provided in the textbook is wrong//multiplication by 1e-6 to convert Hz to GHz" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Numerical aperture= 1.06377\n", - "\n", - "Multipath pulse broadening= 1291.78082 ns/Km\n", - "\n", - "Bandwidth distance product= 0.77413 GHz \n", - "\n", - "\n", - "Numerical aperture= 0.20911\n", - "\n", - "Multipath pulse broadening= 49.74403 ns/Km\n", - "\n", - "Bandwidth distance product= 0.0201 GHz \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.2 , Page no:30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "lamda1=0.7; #wavelength in um\n", - "lamda2=1.3; #wavelength in um\n", - "lamda3=2; #wavelength in um\n", - "\n", - "#CALCULATIONS\n", - "f_lambda1=(303.33*(lamda1**-1)-233.33); #equation for lambda1\n", - "f_lambda2=(303.33*(lamda2**-1)-233.33); #equation for lambda2\n", - "f_lambda3=(303.33*(lamda3**-1)-233.33); #equation for lambda3\n", - "\n", - "#RESULTS\n", - "print\"Material dispersion at Lambda 0.7um=\",round(f_lambda1,5);\n", - "print\"\\nMaterial dispersion at Lambda 1.3um=\",round(f_lambda2,5); #The answers vary due to round off error\n", - "print\"\\nMaterial dispersion at Lambda 2um=\",round(f_lambda3,5); #The answers vary due to round off error\n", - "print\"\\nIts is a standard silica fiber\";" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Material dispersion at Lambda 0.7um= 199.99857\n", - "\n", - "Material dispersion at Lambda 1.3um= 0.00077\n", - "\n", - "Material dispersion at Lambda 2um= -81.665\n", - "\n", - "Its is a standard silica fiber\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3 , Page no:32" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "ncore=1.505; #refractive index of core\n", - "nclad=1.502; #refractive index of cladding\n", - "V=2.4; #v no. for single mode \n", - "lambda1=1300e-9; #operating wavelength in m\n", - "\n", - "#CALCULATIONS\n", - "NA=math.sqrt(ncore**2-nclad**2); #numerical aperture\n", - "a=V*(lambda1)/(2*3.14*NA); #dimension of fiber core in m\n", - "\n", - "#RESULTS\n", - "print\"The numarical aperture =\",round(NA,5);\n", - "print\"\\n Dimension of fiber core =\",round(a*1e6,5),\"um\"; #multiplication by 1e6 to convert unit from m to um" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The numarical aperture = 0.09498\n", - "\n", - " Dimension of fiber core = 5.23079 um\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.4 , Page no:33" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "V=2; #v no. for single mode \n", - "a=4; #radius of fiber in um\n", - "\n", - "#CALCULATIONS\n", - "w=a*(0.65+1.619*V**(-3/2)+2.87*V**-6); #effective mode radius in um\n", - "\n", - "#RESULTS\n", - "print\"Effective mode radius =\",round(w,5),\"um\";" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Effective mode radius = 5.06899 um\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6 , Page no:34" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "m=0; #for dominant mode\n", - "v=0; #for dominant mode\n", - "n1=1.5; #refractive index of core\n", - "delta=0.01; #core clad index difference\n", - "a=5; #fiber radius in um\n", - "lambda1=1.3; #wavelength of operation in um\n", - "\n", - "#CALCULATIONS\n", - "k0=(2*3.14/lambda1); #constant in /m\n", - "beta=math.sqrt((k0**2)*(n1**2)-(2*k0*n1*math.sqrt(2*delta)/a)); #propagation constant in rad/um\n", - "\n", - "#RESULTS\n", - "print\"Propagation constant=\",round(beta,5),\"rad/um\"; #The answers vary due to round off error" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Propagation constant= 7.21781 rad/um\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.8 , Page no:34" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "M=1000; #modes supported\n", - "lambda1=1.3; #operating wavelength in um\n", - "n1=1.5; #refractive index of core\n", - "n2=1.48; #refractive index of cladding\n", - "\n", - "#CALCULATIONS\n", - "V=math.sqrt(2*M); #normalised frequency V no.\n", - "NA=math.sqrt(n1**2-n2**2); #numerical apperture\n", - "R=lambda1*V/(2*3.14*NA); #radius of fiber in um\n", - "\n", - "#RESULTS\n", - "print\"Core Radius=\",round(R,5),\"um\"; #The answer provided in the textbook is wrong" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Core Radius= 37.92063 um\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.9 , Page no:35" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "lambda1=1.3; #wavelength of operation in um\n", - "n1=1.5; #refractive index of core\n", - "n2=1.48; #refractive index of cladding\n", - "k0=2*3.14/lambda1; #constant in /m\n", - "\n", - "#CALCULATIONS\n", - "#case-1\n", - "b=0.5; #normalized propagation constant\n", - "k0=2*3.14/lambda1; #constant\n", - "beta=k0*math.sqrt(n2**2+b*(n1**2-n2**2)); #propagation constant\n", - "\n", - "#case-2\n", - "#given \n", - "lambda1=1.3; #wavelength of operation in um\n", - "n1=1.5; #refractive index of core\n", - "n2=1.48; #refractive index of cladding\n", - "k0=2*3.14/lambda1; #constant in /m\n", - "b=0.5; #normalized propagation constant\n", - "k0=2*3.14/lambda1; #constant\n", - "b1=(((n1+n2)/2)**2-n2**2)/(n1**2-n2**2); #normalized propagation constant\n", - "\n", - "#case-3\n", - "#given \n", - "lambda1=1.3; #wavelength of operation in um\n", - "n1=1.5; #refractive index of core\n", - "n21=1.0; #refractive index of cladding\n", - "k0=2*3.14/lambda1; #constant in /m\n", - "b=0.5; #normalized propagation constant\n", - "k0=2*3.14/lambda1; #constant\n", - "beta1=k0*math.sqrt(n21**2+b*(n1**2-n21**2)); #propagation constant\n", - "\n", - "#RESULTS\n", - "print\"Propagation constant=\",round(beta,5),\"rad/um\"; #The answers vary due to round off error\n", - "print\"\\nPropagation constant=\",round(b1,5); #The answers vary due to round off error\n", - "print\"\\nPropagation constant=\",round(beta1,5),\"rad/um\"; #The answers vary due to round off error" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Propagation constant= 7.19801 rad/um\n", - "\n", - "Propagation constant= 0.49832\n", - "\n", - "Propagation constant= 6.15805 rad/um\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.10 , Page no:35" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "#case-1\n", - "n1=1.49; #refractive index of core\n", - "n2=1.46; #refractive index of cladding\n", - "c=3*10**5; #speed of light in Km/s\n", - "t1=n1/c; #time delay for one traveling along axis in s/Km\n", - "t2=(n1**2/n2)/c; #time delay for one traveling along path that is totally reflecting at the first interface in s/km\n", - "\n", - "#case-2\n", - "n11=1.47; #refractive index of core\n", - "n21=1.46; #refractive index of cladding\n", - "c1=3*10**5; #speed of light in Km/s\n", - "t11=n11/c1; #time delay for one traveling along axis in\n", - "t22=(n11**2/n21)/c1; #time delay for one traveling along path that is totally reflecting at the first interface\n", - "\n", - "\n", - "print\"time delay for traveling along axis =\",round(t1*1e6,5),\"us/Km\"; #multiplication by 1e6 to convert the unit from s/Km to us/Km\n", - "print\"\\ntime delay for traveling along path that is totally reflecting at the first interface =\",round(t2*1e6,5),\"us/Km\"; #multiplication by 1e6 to convert the unit from s/Km to us/Km\n", - "print\"\\ntime delay for traveling along axis =\",round(t11*1e6,5),\"us/Km\"; #multiplication by 1e6 to convert the unit from s/Km to us/Km\n", - "print\"\\ntime delay for traveling along path that is totally reflecting at the first interface =\",round(t22*1e6,5),\"us/Km\"; #multiplication by 1e6 to convert the unit from s/Km to us/Km\n", - "#The answer provided in the textbook is wrong it has got wrong unit" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "time delay for traveling along axis = 4.96667 us/Km\n", - "\n", - "time delay for traveling along path that is totally reflecting at the first interface = 5.06872 us/Km\n", - "\n", - "time delay for traveling along axis = 4.9 us/Km\n", - "\n", - "time delay for traveling along path that is totally reflecting at the first interface = 4.93356 us/Km\n" - ] - } - ], - "prompt_number": 8 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/ManikandanD/Chapter_2_Motion_in_a.ipynb b/sample_notebooks/ManikandanD/Chapter_2_Motion_in_a.ipynb new file mode 100755 index 00000000..5e1116e7 --- /dev/null +++ b/sample_notebooks/ManikandanD/Chapter_2_Motion_in_a.ipynb @@ -0,0 +1,825 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:81e7e778194095c491cf9fdf7aefef02501d247d9b184528d44cff4b23142c68" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2 :Motion in a straight line" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.1 , Page no:11" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "s=9 #miles\n", + "#since 45 min=3/4hr\n", + "t=3/4 #hr\n", + "\n", + "#CALCULATIONS\n", + "v=(s/t)\n", + "\n", + "#RESULTS\n", + "print \"Velocity in min/hr =\",round(v);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity in min/hr = 12.0\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.2 , Page no:11" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "s=(1100*3)\n", + "\n", + "#RESULTS\n", + "print\"Distance in ft =\",round(s);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Distance in ft = 3300.0\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3 , Page no:11" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "s=1.5*10**11; #m\n", + "v=3*10**8; #ms\n", + "\n", + "#CALCULATIONS\n", + "t=(s/v)\n", + "\n", + "#Result\n", + "print\"Time in second =\",round(t),\"sec\";" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Time in second = 500.0 sec\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.4 , Page no:11" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "s=270; #mils\n", + "t=4.5; #hours\n", + "t2=7; #hours\n", + "s2=300; #mi\n", + "\n", + "#CALCULATIONS\n", + "v=(s/t)\n", + "vt=(v*t2)\n", + "t3=(s2/v)\n", + "\n", + "#RESULTS\n", + "print\"Velocity in min/hr =\",round(v),\"mi/hr\";\n", + "print\"Distance in mile =\",round(vt),\"mils\";\n", + "print\"Time in hr =\",round(t3),\"hours\";" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity in min/hr = 60.0 mi/hr\n", + "Distance in mile = 420.0 mils\n", + "Time in hr = 5.0 hours\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.5 , Page no:11" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "s=1000; #distance in mile\n", + "\n", + "#CALCULATIONS\n", + "v=400+120; #velocity in mile/hr\n", + "t=s/v;\n", + "\n", + "#RESULTS\n", + "print\"Time in hr =\",round(t,1); " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Time in hr = 1.9\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6 , Page no:11" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "v1=100; #speed in km/hr\n", + "v2=60; #speed in km/hr\n", + "v3=80; #speed in km/hr\n", + "t1=2; #time in hr\n", + "t2=2; #time in hr\n", + "t3=1; #time in hr\n", + "\n", + "#CALCULATIONS\n", + "v=((v1*t1)+(v2*t2)+(v3*t3))/(t1+t2+t3)\n", + "\n", + "#RESULTS\n", + "print\"Velocity in km/hr =\",round(v);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity in km/hr = 80.0\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7 , Page no:12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "v=40; #velocity in ft/sec\n", + "t=10; #time in sec\n", + "\n", + "#CALCULATIONS\n", + "a=v/t;\n", + "v1=a*t\n", + "\n", + "#RESULTS\n", + "print\"Accelaration in ft/sec square =\",round(a);\n", + "print\"Velocity in ft/sec =\",round(v1);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Accelaration in ft/sec square = 4.0\n", + "Velocity in ft/sec = 40.0\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.8 , Page no:12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "v=30; #velocity in min/hr\n", + "v0=20; #velocity in min/hr\n", + "t=1.5; #time in sec\n", + "\n", + "#CALCULATIONS\n", + "a=((v-v0)/t); #calculating acc. \n", + "t1=(36-30)/a; #calculating time\n", + "\n", + "#RESULTS\n", + "print\"Accelaration in (min/h)/sec =\",round(a,3);\n", + "print\"Time in second =\",round(t1,2);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Accelaration in (min/h)/sec = 6.667\n", + "Time in second = 0.9\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.9 , Page no:12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "v=24; #velocity in m/sec\n", + "a=8; #acc. in m/sec square\n", + "\n", + "#CALCULATIONS\n", + "t=v/a; #using t=v/a\n", + "s=(1/2)*(a*t*t); #kinematical equation\n", + "\n", + "#RESULTS\n", + "print\"Time in sec =\",round(t);\n", + "print\"Distance in metre =\",round(s);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Time in sec = 3.0\n", + "Distance in metre = 36.0\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.10 , Page no:12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "v=30; #velocity in m/sec\n", + "a=6; #acc. in m/sec square\n", + "\n", + "#CALCULATIONS\n", + "t=v/a; #using t=v/a\n", + "s=(1/2)*(a*t*t); #kinematical equation\n", + "\n", + "#RESULTS\n", + "print\"Time in sec =\",round(t);\n", + "print\"Distance in metre =\",round(s);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Time in sec = 5.0\n", + "Distance in metre = 75.0\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.11 , Page no:12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "v=math.sqrt(2*5*600);\n", + "\n", + "#RESULTS\n", + "print\"Velocity in ft/sec =\",round(v);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity in ft/sec = 77.0\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.12 , Page no:12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "v=50; #velocity in m/sec\n", + "s=500; #distance in m\n", + "\n", + "#CALCULATIONS\n", + "a=((v*v)/(2*s));\n", + "\n", + "#RESULTS\n", + "print\"Acc. in m/sec square =\",round(a,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Acc. in m/sec square = 2.5\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.13 , Page no:13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "v=15; #velocity in m/sec\n", + "v0=30; #velocity in m/sec\n", + "a=-2; #acc. in m/sec square\n", + "\n", + "#CALCULATIONS\n", + "s=((v*v)-(v0*v0))/(2*a); #kinematical equation\n", + "v=0;\n", + "s1=(v*v)-(v0*v0)/(2*a);\n", + "\n", + "#RESULTS\n", + "print\"Distance in metre =\",round(s,2);\n", + "print\"Distance in metre =\",round(s1,2);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Distance in metre = 168.75\n", + "Distance in metre = 225.0\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.14 , Page no:13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "g=9.8; #gravitational constant in m/sec square\n", + "t=2.5; #time in sec\n", + "\n", + "#CALCULATIONS\n", + "v=g*t;\n", + "h=(1/2)*g*t*t; #kinematical equation\n", + "\n", + "#RESULTS\n", + "print\"Velocity in m/sec =\",round(v,2);\n", + "print\"Height in m =\",round(h,3);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity in m/sec = 24.5\n", + "Height in m = 30.625\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.15 , Page no:13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "g=32; #gravitational constant in ft/sec square\n", + "h=64; #height in ft\n", + "\n", + "#CALCULATIONS\n", + "t=(math.sqrt((2*h)/g)); #kinematical equation\n", + "v=g*t; #kinematical equation\n", + "\n", + "#RESULTS\n", + "print\"Time in sec =\",round(t);\n", + "print\"Velocity in ft/sec =\",round(v);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Time in sec = 2.0\n", + "Velocity in ft/sec = 64.0\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.16 , Page no:13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "g=32; #gravitational constant in ft/sec square\n", + "h=100; #height in ft\n", + "\n", + "#CALCULATIONS\n", + "v=math.sqrt(2*g*h); #calculating velocity \n", + "\n", + "#RESULTS\n", + "print\"Velocity in ft/sec =\",round(v);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity in ft/sec = 80.0\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.17 , Page no:13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "h=0.78; #height in m\n", + "g=9.8; #gravitational constant in m/sec square\n", + "v=0.5; #velocity in m/sec\n", + "\n", + "#CALCULATIONS\n", + "t=math.sqrt((2*h)/g); #calculating t\n", + "s=v*t; #calculating distance\n", + "\n", + "#RESULTS\n", + "print\"Time required in sec =\",round(t,3);\n", + "print\"Horizontal distance in m =\",round(s,3);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Time required in sec = 0.399\n", + "Horizontal distance in m = 0.199\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.18 , Page no:14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "v0=20; #velocity in ft/sec\n", + "g=32; #gravitational constant in ft/sec\n", + "t=2; #time in sec\n", + "\n", + "#CALCULATIONS\n", + "v=v0+(g*t); #kinematical equation\n", + "s=(v0*t)+(1/2)*g*t*t; #kinematical equation\n", + "\n", + "#RESULTS\n", + "print\"Velocity in ft/sec =\",round(v);\n", + "print\"Distance in ft =\",round(s);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity in ft/sec = 84.0\n", + "Distance in ft = 104.0\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.19 , Page no:14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "v0=20; #velocity in ft/sec\n", + "g=-32; #gravitational constant in ft/sec\n", + "t=0.5; #time in sec\n", + "\n", + "#CALCULATIONS\n", + "v=v0+(g*t); #kinematical equation\n", + "t=2; #time in sec\n", + "s=v0+(g*t); #kinematical equation\n", + "\n", + "#RESULTS\n", + "print\"Velocity in ft/sec =\",round(v);\n", + "print\"Distance in ft =\",round(s);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity in ft/sec = 4.0\n", + "Distance in ft = -44.0\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.20 , Page no:14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#initialisation of variables\n", + "h=6; #height in ft\n", + "g=32; #gravitaional constant in ft/sec square\n", + "\n", + "#CALCULATIONS\n", + "t=math.sqrt((2*h)/g); #calculating time\n", + "\n", + "#RESULTS\n", + "print\"Time in sec =\",round(t,3);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Time in sec = 0.612\n" + ] + } + ], + "prompt_number": 20 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/ManikandanD/Chapter_2_Motion_in_a_straight.ipynb b/sample_notebooks/ManikandanD/Chapter_2_Motion_in_a_straight.ipynb deleted file mode 100755 index 5e1116e7..00000000 --- a/sample_notebooks/ManikandanD/Chapter_2_Motion_in_a_straight.ipynb +++ /dev/null @@ -1,825 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:81e7e778194095c491cf9fdf7aefef02501d247d9b184528d44cff4b23142c68" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 2 :Motion in a straight line" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.1 , Page no:11" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "s=9 #miles\n", - "#since 45 min=3/4hr\n", - "t=3/4 #hr\n", - "\n", - "#CALCULATIONS\n", - "v=(s/t)\n", - "\n", - "#RESULTS\n", - "print \"Velocity in min/hr =\",round(v);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity in min/hr = 12.0\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.2 , Page no:11" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "s=(1100*3)\n", - "\n", - "#RESULTS\n", - "print\"Distance in ft =\",round(s);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Distance in ft = 3300.0\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3 , Page no:11" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "s=1.5*10**11; #m\n", - "v=3*10**8; #ms\n", - "\n", - "#CALCULATIONS\n", - "t=(s/v)\n", - "\n", - "#Result\n", - "print\"Time in second =\",round(t),\"sec\";" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Time in second = 500.0 sec\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.4 , Page no:11" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "s=270; #mils\n", - "t=4.5; #hours\n", - "t2=7; #hours\n", - "s2=300; #mi\n", - "\n", - "#CALCULATIONS\n", - "v=(s/t)\n", - "vt=(v*t2)\n", - "t3=(s2/v)\n", - "\n", - "#RESULTS\n", - "print\"Velocity in min/hr =\",round(v),\"mi/hr\";\n", - "print\"Distance in mile =\",round(vt),\"mils\";\n", - "print\"Time in hr =\",round(t3),\"hours\";" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity in min/hr = 60.0 mi/hr\n", - "Distance in mile = 420.0 mils\n", - "Time in hr = 5.0 hours\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.5 , Page no:11" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "s=1000; #distance in mile\n", - "\n", - "#CALCULATIONS\n", - "v=400+120; #velocity in mile/hr\n", - "t=s/v;\n", - "\n", - "#RESULTS\n", - "print\"Time in hr =\",round(t,1); " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Time in hr = 1.9\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6 , Page no:11" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "v1=100; #speed in km/hr\n", - "v2=60; #speed in km/hr\n", - "v3=80; #speed in km/hr\n", - "t1=2; #time in hr\n", - "t2=2; #time in hr\n", - "t3=1; #time in hr\n", - "\n", - "#CALCULATIONS\n", - "v=((v1*t1)+(v2*t2)+(v3*t3))/(t1+t2+t3)\n", - "\n", - "#RESULTS\n", - "print\"Velocity in km/hr =\",round(v);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity in km/hr = 80.0\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7 , Page no:12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "v=40; #velocity in ft/sec\n", - "t=10; #time in sec\n", - "\n", - "#CALCULATIONS\n", - "a=v/t;\n", - "v1=a*t\n", - "\n", - "#RESULTS\n", - "print\"Accelaration in ft/sec square =\",round(a);\n", - "print\"Velocity in ft/sec =\",round(v1);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Accelaration in ft/sec square = 4.0\n", - "Velocity in ft/sec = 40.0\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.8 , Page no:12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "v=30; #velocity in min/hr\n", - "v0=20; #velocity in min/hr\n", - "t=1.5; #time in sec\n", - "\n", - "#CALCULATIONS\n", - "a=((v-v0)/t); #calculating acc. \n", - "t1=(36-30)/a; #calculating time\n", - "\n", - "#RESULTS\n", - "print\"Accelaration in (min/h)/sec =\",round(a,3);\n", - "print\"Time in second =\",round(t1,2);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Accelaration in (min/h)/sec = 6.667\n", - "Time in second = 0.9\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.9 , Page no:12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "v=24; #velocity in m/sec\n", - "a=8; #acc. in m/sec square\n", - "\n", - "#CALCULATIONS\n", - "t=v/a; #using t=v/a\n", - "s=(1/2)*(a*t*t); #kinematical equation\n", - "\n", - "#RESULTS\n", - "print\"Time in sec =\",round(t);\n", - "print\"Distance in metre =\",round(s);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Time in sec = 3.0\n", - "Distance in metre = 36.0\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.10 , Page no:12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "v=30; #velocity in m/sec\n", - "a=6; #acc. in m/sec square\n", - "\n", - "#CALCULATIONS\n", - "t=v/a; #using t=v/a\n", - "s=(1/2)*(a*t*t); #kinematical equation\n", - "\n", - "#RESULTS\n", - "print\"Time in sec =\",round(t);\n", - "print\"Distance in metre =\",round(s);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Time in sec = 5.0\n", - "Distance in metre = 75.0\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.11 , Page no:12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "v=math.sqrt(2*5*600);\n", - "\n", - "#RESULTS\n", - "print\"Velocity in ft/sec =\",round(v);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity in ft/sec = 77.0\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.12 , Page no:12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "v=50; #velocity in m/sec\n", - "s=500; #distance in m\n", - "\n", - "#CALCULATIONS\n", - "a=((v*v)/(2*s));\n", - "\n", - "#RESULTS\n", - "print\"Acc. in m/sec square =\",round(a,2)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Acc. in m/sec square = 2.5\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.13 , Page no:13" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "v=15; #velocity in m/sec\n", - "v0=30; #velocity in m/sec\n", - "a=-2; #acc. in m/sec square\n", - "\n", - "#CALCULATIONS\n", - "s=((v*v)-(v0*v0))/(2*a); #kinematical equation\n", - "v=0;\n", - "s1=(v*v)-(v0*v0)/(2*a);\n", - "\n", - "#RESULTS\n", - "print\"Distance in metre =\",round(s,2);\n", - "print\"Distance in metre =\",round(s1,2);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Distance in metre = 168.75\n", - "Distance in metre = 225.0\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.14 , Page no:13" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "g=9.8; #gravitational constant in m/sec square\n", - "t=2.5; #time in sec\n", - "\n", - "#CALCULATIONS\n", - "v=g*t;\n", - "h=(1/2)*g*t*t; #kinematical equation\n", - "\n", - "#RESULTS\n", - "print\"Velocity in m/sec =\",round(v,2);\n", - "print\"Height in m =\",round(h,3);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity in m/sec = 24.5\n", - "Height in m = 30.625\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.15 , Page no:13" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "g=32; #gravitational constant in ft/sec square\n", - "h=64; #height in ft\n", - "\n", - "#CALCULATIONS\n", - "t=(math.sqrt((2*h)/g)); #kinematical equation\n", - "v=g*t; #kinematical equation\n", - "\n", - "#RESULTS\n", - "print\"Time in sec =\",round(t);\n", - "print\"Velocity in ft/sec =\",round(v);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Time in sec = 2.0\n", - "Velocity in ft/sec = 64.0\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.16 , Page no:13" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "g=32; #gravitational constant in ft/sec square\n", - "h=100; #height in ft\n", - "\n", - "#CALCULATIONS\n", - "v=math.sqrt(2*g*h); #calculating velocity \n", - "\n", - "#RESULTS\n", - "print\"Velocity in ft/sec =\",round(v);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity in ft/sec = 80.0\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.17 , Page no:13" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "h=0.78; #height in m\n", - "g=9.8; #gravitational constant in m/sec square\n", - "v=0.5; #velocity in m/sec\n", - "\n", - "#CALCULATIONS\n", - "t=math.sqrt((2*h)/g); #calculating t\n", - "s=v*t; #calculating distance\n", - "\n", - "#RESULTS\n", - "print\"Time required in sec =\",round(t,3);\n", - "print\"Horizontal distance in m =\",round(s,3);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Time required in sec = 0.399\n", - "Horizontal distance in m = 0.199\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.18 , Page no:14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "v0=20; #velocity in ft/sec\n", - "g=32; #gravitational constant in ft/sec\n", - "t=2; #time in sec\n", - "\n", - "#CALCULATIONS\n", - "v=v0+(g*t); #kinematical equation\n", - "s=(v0*t)+(1/2)*g*t*t; #kinematical equation\n", - "\n", - "#RESULTS\n", - "print\"Velocity in ft/sec =\",round(v);\n", - "print\"Distance in ft =\",round(s);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity in ft/sec = 84.0\n", - "Distance in ft = 104.0\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.19 , Page no:14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "v0=20; #velocity in ft/sec\n", - "g=-32; #gravitational constant in ft/sec\n", - "t=0.5; #time in sec\n", - "\n", - "#CALCULATIONS\n", - "v=v0+(g*t); #kinematical equation\n", - "t=2; #time in sec\n", - "s=v0+(g*t); #kinematical equation\n", - "\n", - "#RESULTS\n", - "print\"Velocity in ft/sec =\",round(v);\n", - "print\"Distance in ft =\",round(s);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Velocity in ft/sec = 4.0\n", - "Distance in ft = -44.0\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.20 , Page no:14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "from __future__ import division\n", - "\n", - "#initialisation of variables\n", - "h=6; #height in ft\n", - "g=32; #gravitaional constant in ft/sec square\n", - "\n", - "#CALCULATIONS\n", - "t=math.sqrt((2*h)/g); #calculating time\n", - "\n", - "#RESULTS\n", - "print\"Time in sec =\",round(t,3);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Time in sec = 0.612\n" - ] - } - ], - "prompt_number": 20 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/MeenaChandrupatla/Chapter_1.ipynb b/sample_notebooks/MeenaChandrupatla/Chapter_1.ipynb new file mode 100755 index 00000000..5503c007 --- /dev/null +++ b/sample_notebooks/MeenaChandrupatla/Chapter_1.ipynb @@ -0,0 +1,289 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1,Page number 6" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The current in circuit is 0.3672\n" + ] + } + ], + "source": [ + "from math import pi\n", + "import math \n", + "# given\n", + "Bc=0.8\n", + "Hc=510\n", + "Bg=0.8\n", + "A=12.566 \n", + "lg=0.0015\n", + "lc=0.36\n", + "N=500\n", + "# calculations\n", + "Fg=Bg/A*(2*lg)\n", + "Fc=Hc*lc\n", + "F=Fc+Fg\n", + "i=F/N\n", + "Pre=Bc/Hc\n", + "RelPre=Pre/A\n", + "F=Hc*lc\n", + "i=F /N #current\n", + "print 'The current in circuit is ',i\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2,Page number 7" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The flux density is 5\n" + ] + } + ], + "source": [ + "from math import pi\n", + "A=12.566 \n", + "lc=360\n", + "N=500\n", + "i=4\n", + "lg=2*10**-3\n", + "m=-A*(lc/lg)\n", + "c=(N*i*A)/(lg)\n", + "Hc=(N*i)/(lc) #flux density\n", + "print 'The flux density is',Hc" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3,Page number 7" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The airgap flux value is -7.47688567997e-07\n" + ] + } + ], + "source": [ + "import math\n", + "#given\n", + "N1=500\n", + "I1=10\n", + "N2=500\n", + "I2=10\n", + "Ibafe=3*52*10**-2\n", + "A=12.566\n", + "b=1200\n", + "Ag=4*10^-4\n", + "Ac=4*10^-4\n", + "lg=5*10^-3\n", + "Ibecore=0.515\n", + "c=0.0002067\n", + "d=0.0004134\n", + "#calculations\n", + "F1=N1*I1\n", + "F2=N2*I2\n", + "Pre=1200*A\n", + "Rbafe=(Ibafe)/(Pre*Ac)\n", + "Rg=lg/(A*Ag)\n", + "Rbecore=Ibecore/(Pre*Ac)\n", + "Bg=d/(Ag)\n", + "Hg=Bg/A # airgap flux\n", + "print 'The airgap flux value is',Hg\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4,Page number 8" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The magnetic flux is 0.153938040026\n" + ] + } + ], + "source": [ + "from math import pi\n", + "# given \n", + "Irad=20\n", + "Orad=25\n", + "Dia=22.5\n", + "N=250\n", + "i=2.5\n", + "B=1.225\n", + "# calculations\n", + "l=2*pi*Dia*10**-2\n", + "radius=1/2*(Irad+Orad)\n", + "H=(N*i)/l\n", + "A=pi*((Orad -Irad)/2)**2*10**-4\n", + "z=(1.225)*(pi*6.25*10**-4)\n", + "y=(N*z)\n", + "L=(y/i)\n", + "core=(B/H)\n", + "l=(2*pi*22.5*10**-2)\n", + "Rcore=(l)/(core*A)\n", + "L=(N**2)/(Rcore)\n", + "print 'The magnetic flux is',L" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 5,Page number 8" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "flux density 144.0\n" + ] + } + ], + "source": [ + "import math\n", + "# given\n", + "n=500\n", + "E=100\n", + "A=0.001\n", + "b=1/120\n", + "f=1.2\n", + "#calculations\n", + "max1=(E/1000)*(b)\n", + "max2=(f*A)\n", + "E=(120*n*max2*2) # result\n", + "print 'flux density',E\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 6,Page number 9" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The dimension Am is 0.000210526315789\n" + ] + } + ], + "source": [ + "from math import pi\n", + "#given\n", + "lg=0.4*10**-2\n", + "Bg=0.8\n", + "Hm=42*10**3\n", + "A=4*pi*10**-7\n", + "Ag=2.5*10**-4\n", + "Bm=0.95\n", + "#calculations\n", + "Hg=Bg/A\n", + "lm=(lg/Hm)*Hg\n", + "Am=(Bg*Ag)/(Bm)\n", + "print 'The dimension Am is',Am\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/MeenaChandrupatla/Chapter_1_Magnetic.ipynb b/sample_notebooks/MeenaChandrupatla/Chapter_1_Magnetic.ipynb deleted file mode 100755 index 5503c007..00000000 --- a/sample_notebooks/MeenaChandrupatla/Chapter_1_Magnetic.ipynb +++ /dev/null @@ -1,289 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 1,Page number 6" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The current in circuit is 0.3672\n" - ] - } - ], - "source": [ - "from math import pi\n", - "import math \n", - "# given\n", - "Bc=0.8\n", - "Hc=510\n", - "Bg=0.8\n", - "A=12.566 \n", - "lg=0.0015\n", - "lc=0.36\n", - "N=500\n", - "# calculations\n", - "Fg=Bg/A*(2*lg)\n", - "Fc=Hc*lc\n", - "F=Fc+Fg\n", - "i=F/N\n", - "Pre=Bc/Hc\n", - "RelPre=Pre/A\n", - "F=Hc*lc\n", - "i=F /N #current\n", - "print 'The current in circuit is ',i\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2,Page number 7" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The flux density is 5\n" - ] - } - ], - "source": [ - "from math import pi\n", - "A=12.566 \n", - "lc=360\n", - "N=500\n", - "i=4\n", - "lg=2*10**-3\n", - "m=-A*(lc/lg)\n", - "c=(N*i*A)/(lg)\n", - "Hc=(N*i)/(lc) #flux density\n", - "print 'The flux density is',Hc" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3,Page number 7" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The airgap flux value is -7.47688567997e-07\n" - ] - } - ], - "source": [ - "import math\n", - "#given\n", - "N1=500\n", - "I1=10\n", - "N2=500\n", - "I2=10\n", - "Ibafe=3*52*10**-2\n", - "A=12.566\n", - "b=1200\n", - "Ag=4*10^-4\n", - "Ac=4*10^-4\n", - "lg=5*10^-3\n", - "Ibecore=0.515\n", - "c=0.0002067\n", - "d=0.0004134\n", - "#calculations\n", - "F1=N1*I1\n", - "F2=N2*I2\n", - "Pre=1200*A\n", - "Rbafe=(Ibafe)/(Pre*Ac)\n", - "Rg=lg/(A*Ag)\n", - "Rbecore=Ibecore/(Pre*Ac)\n", - "Bg=d/(Ag)\n", - "Hg=Bg/A # airgap flux\n", - "print 'The airgap flux value is',Hg\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4,Page number 8" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The magnetic flux is 0.153938040026\n" - ] - } - ], - "source": [ - "from math import pi\n", - "# given \n", - "Irad=20\n", - "Orad=25\n", - "Dia=22.5\n", - "N=250\n", - "i=2.5\n", - "B=1.225\n", - "# calculations\n", - "l=2*pi*Dia*10**-2\n", - "radius=1/2*(Irad+Orad)\n", - "H=(N*i)/l\n", - "A=pi*((Orad -Irad)/2)**2*10**-4\n", - "z=(1.225)*(pi*6.25*10**-4)\n", - "y=(N*z)\n", - "L=(y/i)\n", - "core=(B/H)\n", - "l=(2*pi*22.5*10**-2)\n", - "Rcore=(l)/(core*A)\n", - "L=(N**2)/(Rcore)\n", - "print 'The magnetic flux is',L" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "collapsed": true - }, - "source": [ - "## Example 5,Page number 8" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "flux density 144.0\n" - ] - } - ], - "source": [ - "import math\n", - "# given\n", - "n=500\n", - "E=100\n", - "A=0.001\n", - "b=1/120\n", - "f=1.2\n", - "#calculations\n", - "max1=(E/1000)*(b)\n", - "max2=(f*A)\n", - "E=(120*n*max2*2) # result\n", - "print 'flux density',E\n" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "collapsed": true - }, - "source": [ - "## Example 6,Page number 9" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The dimension Am is 0.000210526315789\n" - ] - } - ], - "source": [ - "from math import pi\n", - "#given\n", - "lg=0.4*10**-2\n", - "Bg=0.8\n", - "Hm=42*10**3\n", - "A=4*pi*10**-7\n", - "Ag=2.5*10**-4\n", - "Bm=0.95\n", - "#calculations\n", - "Hg=Bg/A\n", - "lm=(lg/Hm)*Hg\n", - "Am=(Bg*Ag)/(Bm)\n", - "print 'The dimension Am is',Am\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/MeenaChandrupatla/Chapter_2.ipynb b/sample_notebooks/MeenaChandrupatla/Chapter_2.ipynb new file mode 100755 index 00000000..9406e5a1 --- /dev/null +++ b/sample_notebooks/MeenaChandrupatla/Chapter_2.ipynb @@ -0,0 +1,249 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 2 The Device" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.1,Page number 7" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "value of voltage safety factor= 2.56\n" + ] + } + ], + "source": [ + "from math import pi,sqrt\n", + "import math \n", + "Vpiv=1500 # peak inverse voltage\n", + "V=415 # main supply\n", + "Vf=Vpiv/(sqrt(2)*V) # voltage safety factor\n", + "Vf=round(Vf,2)\n", + "print 'value of voltage safety factor=',Vf" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2,Page number 7" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "value of peak inverse voltage= 683.07 volts\n" + ] + } + ], + "source": [ + "from math import pi,sqrt\n", + "import math \n", + "Vf=2.1 # voltage safety factor \n", + "V=230 # main supply\n", + "Vpiv=sqrt(2)*Vf*V # peak inverse voltage\n", + "Vpiv=round(Vpiv,2)\n", + "print 'value of peak inverse voltage=',Vpiv,'volts'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.3,Page number 8" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "value of capacitive current= 0.0045 Amp\n" + ] + } + ], + "source": [ + "import math \n", + "C=30*10**-12 # equivalent capacitance \n", + "diffV=150*10**6 # dv/dt value of capacitor\n", + "Ic=C*(diffV) # capacitive current\n", + "print 'value of capacitive current=',Ic,'Amp'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.4,Page number 8" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "value of equivalent capacitance= 28.57 pico farad\n" + ] + } + ], + "source": [ + "import math \n", + "Ic=5.0 # capacitive current in milli amperes\n", + "difV=175.0 # dv/dt value in mega V/s\n", + "C=Ic/(difV)*10**3 # equivalent capacitance in pico farad\n", + "C=round(C,2)\n", + "print 'value of equivalent capacitance=',C,'pico farad'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.5,Page number 8" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "value of dv/dt= 240000000.0 v/s\n" + ] + } + ], + "source": [ + "import math \n", + "Ic=6*10**-3 # capacitive current\n", + "C=25*10**-12 # equivalent capacitance\n", + "diffV=Ic/C # dv/dt value of capacitor\n", + "print 'value of dv/dt=',diffV,'v/s'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.6,Page number 9" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "value of dv/dt that can trigger the device= 142 V/microseconds\n" + ] + } + ], + "source": [ + "import math \n", + "Ic=5 # capacitive current in milli amperes\n", + "C=35 # equivalent capacitance in pico farad\n", + "difV=Ic*10**3/C # value of dv/dt that can trigger the device in V/ microseconds\n", + "print 'value of dv/dt that can trigger the device=',difV,'V/microseconds'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.7,Page number 9" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "value of voltage safety factor= 2.3 v\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "import math \n", + "Vpiv=1350 # peak inverse voltage in volts\n", + "V=415 # main supply in volts\n", + "Vf=Vpiv/(sqrt(2)*V) # voltage safety factor\n", + "Vf=round(Vf,2)\n", + "print 'value of voltage safety factor=',Vf,'v'" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/MeenaChandrupatla/Chapter_2_The.ipynb b/sample_notebooks/MeenaChandrupatla/Chapter_2_The.ipynb deleted file mode 100755 index 9406e5a1..00000000 --- a/sample_notebooks/MeenaChandrupatla/Chapter_2_The.ipynb +++ /dev/null @@ -1,249 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 2 The Device" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2.1,Page number 7" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "value of voltage safety factor= 2.56\n" - ] - } - ], - "source": [ - "from math import pi,sqrt\n", - "import math \n", - "Vpiv=1500 # peak inverse voltage\n", - "V=415 # main supply\n", - "Vf=Vpiv/(sqrt(2)*V) # voltage safety factor\n", - "Vf=round(Vf,2)\n", - "print 'value of voltage safety factor=',Vf" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2.2,Page number 7" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "value of peak inverse voltage= 683.07 volts\n" - ] - } - ], - "source": [ - "from math import pi,sqrt\n", - "import math \n", - "Vf=2.1 # voltage safety factor \n", - "V=230 # main supply\n", - "Vpiv=sqrt(2)*Vf*V # peak inverse voltage\n", - "Vpiv=round(Vpiv,2)\n", - "print 'value of peak inverse voltage=',Vpiv,'volts'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2.3,Page number 8" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "value of capacitive current= 0.0045 Amp\n" - ] - } - ], - "source": [ - "import math \n", - "C=30*10**-12 # equivalent capacitance \n", - "diffV=150*10**6 # dv/dt value of capacitor\n", - "Ic=C*(diffV) # capacitive current\n", - "print 'value of capacitive current=',Ic,'Amp'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2.4,Page number 8" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "value of equivalent capacitance= 28.57 pico farad\n" - ] - } - ], - "source": [ - "import math \n", - "Ic=5.0 # capacitive current in milli amperes\n", - "difV=175.0 # dv/dt value in mega V/s\n", - "C=Ic/(difV)*10**3 # equivalent capacitance in pico farad\n", - "C=round(C,2)\n", - "print 'value of equivalent capacitance=',C,'pico farad'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2.5,Page number 8" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "value of dv/dt= 240000000.0 v/s\n" - ] - } - ], - "source": [ - "import math \n", - "Ic=6*10**-3 # capacitive current\n", - "C=25*10**-12 # equivalent capacitance\n", - "diffV=Ic/C # dv/dt value of capacitor\n", - "print 'value of dv/dt=',diffV,'v/s'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2.6,Page number 9" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "value of dv/dt that can trigger the device= 142 V/microseconds\n" - ] - } - ], - "source": [ - "import math \n", - "Ic=5 # capacitive current in milli amperes\n", - "C=35 # equivalent capacitance in pico farad\n", - "difV=Ic*10**3/C # value of dv/dt that can trigger the device in V/ microseconds\n", - "print 'value of dv/dt that can trigger the device=',difV,'V/microseconds'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2.7,Page number 9" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "value of voltage safety factor= 2.3 v\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "import math \n", - "Vpiv=1350 # peak inverse voltage in volts\n", - "V=415 # main supply in volts\n", - "Vf=Vpiv/(sqrt(2)*V) # voltage safety factor\n", - "Vf=round(Vf,2)\n", - "print 'value of voltage safety factor=',Vf,'v'" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/MohdAsif/Chapter2,.ipynb b/sample_notebooks/MohdAsif/Chapter2,.ipynb new file mode 100755 index 00000000..f8ad79f0 --- /dev/null +++ b/sample_notebooks/MohdAsif/Chapter2,.ipynb @@ -0,0 +1,257 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:7b602763fd5a9c056abb62703a3bc42ae0cb4a39b3c349f78c056ebe58b1c643" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Example 2_3_1" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Precision of the 5th measurement\n", + "#Given data : Measurements taken(Unit less)\n", + "X1=98;\n", + "X2=101;\n", + "X3=102;\n", + "X4=97;\n", + "X5=101;\n", + "X6=100;\n", + "X7=103;\n", + "X8=98;\n", + "X9=106;\n", + "X10=99.0;\n", + "#Calculation\n", + "Xn_bar=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/10;\n", + "Xn=101 # value of 5th measurement\n", + "P=(1-abs((Xn-Xn_bar)/Xn_bar))*100 #Precision\n", + "print \"Precision of the 5th measurement,P(%) = \",round(P,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Precision of the 5th measurement,P(%) = 99.502\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Example 2_3_2_a" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Absolute error\n", + "#given data :\n", + "Ae=80.0 # in V\n", + "Am=79 # in V\n", + "e=Ae-Am #absolute error\n", + "print \"Absolute error,e(V) = \",e" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Absolute error,e(V) = 1.0\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Example 2_3_2_b" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Finding error\n", + "#given data :\n", + "Ae=80.0 # in V\n", + "Am=79 # in V\n", + "e=Ae-Am #error\n", + "ep=(e/Ae)*100 #relative percent error\n", + "print \"Relative Percent Error(%) = \",ep" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Relative Percent Error(%) = 1.25\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Example 2_3_3" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# maximum error\n", + "#given data :\n", + "V1=100 # in volts\n", + "V2=200 # in volts\n", + "V=V2-V1 # Voltage difference\n", + "A=.25 # Accuracy may be \u00b1 in %\n", + "max_error=(A/100)*V # in Volts\n", + "print \"maximum error(V) = \u00b1\",max_error" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "maximum error(V) = \u00b1 0.25\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Example 2_3_4" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#sensitivity and deflection error\n", + "# given data :\n", + "C=4.0 # change in output in mm\n", + "M=8.0 # magnitude of input in ohm\n", + "S=C/M # sensitivity\n", + "print \"sensitivity,S(mm/ohm) = \",S\n", + "D=M/C # Deflection\n", + "print \"Deflection factor,D(ohm/m) = \",D" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "sensitivity,S(mm/ohm) = 0.5\n", + "Deflection factor,D(ohm/m) = 2.0\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Example 2_3_5 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Resolution\n", + "# given data :\n", + "V=200.0 # full scale reading in volts\n", + "N=100.0 # number of divisions \n", + "Scale_div=V/N # Volts\n", + "R=(1/10.0)*Scale_div # Resolution in Volts\n", + "print \"Resolution, R(V) = \",round(R,4)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Resolution, R(V) = 0.2\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Example 2_3_6" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Resolution\n", + "#given data :\n", + "V=9.999 # full scale read out in volt\n", + "c=range(0,9999) # range from 0 to 9999\n", + "R=(1/max(c))*V*10.0**3\n", + "print \"Resolution, R(mV)\", R" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Resolution, R(mV) 0.0\n" + ] + } + ], + "prompt_number": 29 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/MohdAsif/Chapter2,_Measurement.ipynb b/sample_notebooks/MohdAsif/Chapter2,_Measurement.ipynb deleted file mode 100755 index f8ad79f0..00000000 --- a/sample_notebooks/MohdAsif/Chapter2,_Measurement.ipynb +++ /dev/null @@ -1,257 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:7b602763fd5a9c056abb62703a3bc42ae0cb4a39b3c349f78c056ebe58b1c643" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Example 2_3_1" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Precision of the 5th measurement\n", - "#Given data : Measurements taken(Unit less)\n", - "X1=98;\n", - "X2=101;\n", - "X3=102;\n", - "X4=97;\n", - "X5=101;\n", - "X6=100;\n", - "X7=103;\n", - "X8=98;\n", - "X9=106;\n", - "X10=99.0;\n", - "#Calculation\n", - "Xn_bar=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/10;\n", - "Xn=101 # value of 5th measurement\n", - "P=(1-abs((Xn-Xn_bar)/Xn_bar))*100 #Precision\n", - "print \"Precision of the 5th measurement,P(%) = \",round(P,3)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Precision of the 5th measurement,P(%) = 99.502\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Example 2_3_2_a" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Absolute error\n", - "#given data :\n", - "Ae=80.0 # in V\n", - "Am=79 # in V\n", - "e=Ae-Am #absolute error\n", - "print \"Absolute error,e(V) = \",e" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Absolute error,e(V) = 1.0\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Example 2_3_2_b" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Finding error\n", - "#given data :\n", - "Ae=80.0 # in V\n", - "Am=79 # in V\n", - "e=Ae-Am #error\n", - "ep=(e/Ae)*100 #relative percent error\n", - "print \"Relative Percent Error(%) = \",ep" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Relative Percent Error(%) = 1.25\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Example 2_3_3" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# maximum error\n", - "#given data :\n", - "V1=100 # in volts\n", - "V2=200 # in volts\n", - "V=V2-V1 # Voltage difference\n", - "A=.25 # Accuracy may be \u00b1 in %\n", - "max_error=(A/100)*V # in Volts\n", - "print \"maximum error(V) = \u00b1\",max_error" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "maximum error(V) = \u00b1 0.25\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Example 2_3_4" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#sensitivity and deflection error\n", - "# given data :\n", - "C=4.0 # change in output in mm\n", - "M=8.0 # magnitude of input in ohm\n", - "S=C/M # sensitivity\n", - "print \"sensitivity,S(mm/ohm) = \",S\n", - "D=M/C # Deflection\n", - "print \"Deflection factor,D(ohm/m) = \",D" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "sensitivity,S(mm/ohm) = 0.5\n", - "Deflection factor,D(ohm/m) = 2.0\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Example 2_3_5 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Resolution\n", - "# given data :\n", - "V=200.0 # full scale reading in volts\n", - "N=100.0 # number of divisions \n", - "Scale_div=V/N # Volts\n", - "R=(1/10.0)*Scale_div # Resolution in Volts\n", - "print \"Resolution, R(V) = \",round(R,4)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Resolution, R(V) = 0.2\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Example 2_3_6" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Resolution\n", - "#given data :\n", - "V=9.999 # full scale read out in volt\n", - "c=range(0,9999) # range from 0 to 9999\n", - "R=(1/max(c))*V*10.0**3\n", - "print \"Resolution, R(mV)\", R" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Resolution, R(mV) 0.0\n" - ] - } - ], - "prompt_number": 29 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/MohdAsif/Chapter2_-.ipynb b/sample_notebooks/MohdAsif/Chapter2_-.ipynb new file mode 100755 index 00000000..3442a20e --- /dev/null +++ b/sample_notebooks/MohdAsif/Chapter2_-.ipynb @@ -0,0 +1,1549 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:95b9e0f83468dda84f2de4d99c5a704a6fadf8064c232b063678fd245192ca75" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter2 - Measurement Errors" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3.1 - page : 2-8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#precision of the 5th measurement\n", + "#given data :\n", + "X1=98.0 \n", + "X2=101.0\n", + "X3=102.0 \n", + "X4=97.0 \n", + "X5=101.0 \n", + "X6=100.0 \n", + "X7=103.0 \n", + "X8=98.0 \n", + "X9=106.0 \n", + "X10=99.0 \n", + "Xn_bar=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/10 \n", + "Xn=101 # value of 5th measurement\n", + "P=(1-abs((Xn-Xn_bar)/Xn_bar))*100 \n", + "print \"Precision of the 5th measurement, P = \", round(P,2), \" %\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Precision of the 5th measurement, P = 99.5 %\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3.2.i - page : 2-10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Absolute error\n", + "#given data :\n", + "Ae=80.0 # in V\n", + "Am=79.0 # in V\n", + "e=Ae-Am \n", + "print \"Absolute error, e = \", e, \" V\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Absolute error, e = 1.0 V\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3.2.ii - page : 2-10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Error\n", + "#given data :\n", + "Ae=80.0 # in V\n", + "Am=79.0 # in V\n", + "e=Ae-Am \n", + "error1=(e/Ae)*100 \n", + "print \"Error = \", error1, \" %\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Error = 1.25 %\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3.2.iii - page : 2-10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Relative accuracy\n", + "#given data :\n", + "Ae=80.0 # in V\n", + "Am=79.0 # in V\n", + "e=Ae-Am \n", + "error1=(e/Ae)*100 \n", + "A=(1-abs(e/Ae)) \n", + "print \"Relative Accuracy, A = \", A" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Relative Accuracy, A = 0.9875\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3.2.iv - page : 2-10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# % accuracy\n", + "#given data :\n", + "Ae=80.0 # in V\n", + "Am=79.0 # in V\n", + "e=Ae-Am \n", + "error1=(e/Ae)*100 \n", + "A=(1-abs(e/Ae)) \n", + "accuracy=A*100 \n", + "print \"Accuracy = \", accuracy, \" %\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Accuracy = 98.75 %\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3.2.v - page : 2-10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# % error\n", + "#given data :\n", + "Ae=80.0 # in V\n", + "Am=79.0 # in V\n", + "e=Ae-Am \n", + "f=100.0 #full scale deflection\n", + "error1=(e/Ae)*100 \n", + "A=(1-abs(e/Ae)) \n", + "accuracy=A*100 \n", + "P_error=(e/f)*100 \n", + "print \"% error = \", P_error, \" %\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "% error = 1.0 %\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3.3 - page : 2-11" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Maximum error\n", + "#given data :\n", + "V1=100.0 # in V\n", + "V2=200.0 #in V\n", + "V=V2-V1 \n", + "A=0.25 #may be \u00b1 in %\n", + "max_error=(A/100)*V \n", + "print \"Maximum error = \u00b1 \", max_error, \" V\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum error = \u00b1 0.25 V\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3.4 - page : 2-12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# sensitivity and deflection error\n", + "#given data :\n", + "C=4.0 # change in output in mm\n", + "M=8.0 # magnitude of input in ohm\n", + "S=C/M \n", + "print \"sensitivity, S = \", S, \" mm/ohm\"\n", + "D=M/C \n", + "print \"Deflection factor, D = \", D, \" ohm/mm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "sensitivity, S = 0.5 mm/ohm\n", + "Deflection factor, D = 2.0 ohm/mm\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3.5 - page : 2-14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Resolution\n", + "#given data :\n", + "V=200.0 # full scale reading in V\n", + "N=100.0 # number of divisions \n", + "Scale_div=V/N \n", + "R=(1.0/10)*Scale_div \n", + "print \"Resolution, R = \", R, \" V\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Resolution, R = 0.2 V\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3.6 - page : 2-14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Resolution\n", + "#given data :\n", + "V=9.999 # full scale read out in volt\n", + "c=9999.0 # range from 0 to 9999\n", + "R=(1/c)*V*10**3 \n", + "print \"Resolution, R = \", R, \" mV\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Resolution, R = 1.0 mV\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6.1 - page : 2-23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Magnitude and relative error\n", + "#given data :\n", + "R1=15.0 #ohm\n", + "E1=R1*5.0/100 # \u00b1 limiting error for R1\n", + "R2=33.0 #ohm\n", + "E2=R2*2.0/100 # \u00b1 limiting error for R2\n", + "R3=75.0 #ohm\n", + "E3=R3*5.0/100 # \u00b1 limiting error for R3\n", + "RT=R1+R2+R3 # ohm(in series)\n", + "ET=E1+E2+E3 #\u00b1limiting error for RT\n", + "print \"For series connection, magnitude is \", RT, \" ohm & limiting error is \u00b1 \", ET, \" ohm.\" \n", + "Epr=ET/RT*100 #%\n", + "print \"Percent relative error : \u00b1\", round(Epr,1),\" %\" \n", + "\n", + "# Answer is not accurate in the textbook." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "For series connection, magnitude is 123.0 ohm & limiting error is \u00b1 5.16 ohm.\n", + "Percent relative error : \u00b1 4.2 %\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6.2 - page : 2-23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Magnitude and relative error\n", + "#given data :\n", + "R1=36.0 #ohm\n", + "E1=5.0 # \u00b1 limiting error for R1\n", + "R2=75.0 #ohm\n", + "E2=5.0 # \u00b1 limiting error for R2\n", + "RT=(R1*R2)/(R1+R2) #ohm(in parallel)\n", + "EP1=E1+E2 # \u00b1 limiting error\n", + "EP2=((R1*E1)/(R1+R2))+((R2*E2)/(R1+R2)) \n", + "ET=EP1+EP2 \n", + "etm=(ET/100)*RT \n", + "print \"Magnitude of limiting error is \u00b1\", round(etm,2), \" ohm\"\n", + "print \"Percentage relative error is \u00b1\", ET, \" %\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Magnitude of limiting error is \u00b1 3.65 ohm\n", + "Percentage relative error is \u00b1 15.0 %\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6.3 page : 2-24" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Limiting error\n", + "vr=40.0 #reading of voltmeter in volts\n", + "v=50.0 #rane in volts\n", + "va=50.0 #ammeeter reading in mA\n", + "i=125.0 #range in mA\n", + "fsd=2.0 #accurace in percentage in \u00b1\n", + "dv=(2.0/100)*v #limiting error of voltmeter\n", + "da=(2./100)*i #liming error of the ammeter in mA\n", + "erv=dv/vr #relative limiting error in voltmeter reading\n", + "eri=da/i #relative limiting error in ammeter reading\n", + "et=erv+eri \n", + "pet=et*100 #percentage limiting error of the power calcultaed\n", + "print \"Percentage limiting error of the power calcultaed is \u00b1 \",pet,\" %\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Percentage limiting error of the power calcultaed is \u00b1 4.5 %\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6.4 - page : 2-25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# limiting error\n", + "r1=120.0 # ohm\n", + "er1=0.5 #limiting error in resistance 1 in ohm \u00b1\n", + "r2=2 #in A\n", + "er2=0.02 #limiting error in amperes \u00b1\n", + "e1=er2/r2 #limiting error in current\n", + "e2=er1/r1 #limiting eror in resistance\n", + "et=(2*e1+e2) #total error\n", + "etp=et*100 #percentage limtimg error\n", + "print \"Percentage limiting error in the value of power dissipation is \u00b1\",round(etp,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Percentage limiting error in the value of power dissipation is \u00b1 2.417\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6.5 - page : 2-25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#magnitude and limiting error\n", + "r1=120 #in ohm\n", + "er1=0.1 #limiting error in resistance 1 in ohm \u00b1\n", + "r2=2700 #in ohm\n", + "er2=0.5 #limiting error in resistance 2 in ohm \u00b1\n", + "r3=470 #in ohm\n", + "er3=0.5 #limiting error in resistance 3 in ohm \u00b1\n", + "rxm=(r2*r3)/r1 #magnitude of unknown resistance in ohm\n", + "rxe=(er1+er2+er3) #error\n", + "er=(rxe*rxm)/100 #relative error \u00b1\n", + "print \"Magnitude of unknown resistance is \",rxm,\" kohm\"\n", + "print \"Relative limiting error is \u00b1\",er,\" ohm\"\n", + "print \"Guranteed value of resistance is between \",rxm-er, \" ohm to \" ,rxm+er,\" ohm\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Magnitude of unknown resistance is 10575 kohm\n", + "Relative limiting error is \u00b1 116.325 ohm\n", + "Guranteed value of resistance is between 10458.675 ohm to 10691.325 ohm\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6.6 - page : 2-26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# absolute error, % error, relative error, % accuracy and % error of full scale reading\n", + "#given data :\n", + "Ae=80.0 # in volt\n", + "Am=79 # in volt\n", + "fsd=100 #full scale reading in volt\n", + "e=Ae-Am \n", + "print \"Absolute error, e = \",e,\" V\"\n", + "error1=(e/Ae)*100 \n", + "print \"Error = \",error1,\" %\"\n", + "A=1-abs(e/Ae) \n", + "print \"Relative accuracy, A = \",A,\" %\"\n", + "p_accuracy=A*100 \n", + "print \"% accuracy = \",p_accuracy,\" %\"\n", + "error2=(e/fsd)*100 \n", + "print \"% error expressed as percentage of full scale reading = \",error2,\" %\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Absolute error, e = 1.0 V\n", + "Error = 1.25 %\n", + "Relative accuracy, A = 0.9875 %\n", + "% accuracy = 98.75 %\n", + "% error expressed as percentage of full scale reading = 1.0 %\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6.7 - page : 2-27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# limiting error\n", + "#given data :\n", + "fsd=100.0 # in V\n", + "A=1.0 # (+ve or -ve) in %\n", + "del_A=(A/100)*fsd \n", + "As=15.0 #in V\n", + "e1=del_A/As \n", + "e=e1*100 \n", + "print \"Limiting error, e = \",round(e,4),\" %\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Limiting error, e = 6.6667 %\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6.8 - page : 2-27 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# limiting value of current and % limiting error\n", + "#given data :\n", + "As=2.5 # in A\n", + "fsd=10 #full scale reading in A\n", + "A=1.5/100 \n", + "del_A=A*fsd \n", + "At1=As+del_A \n", + "At2=As-del_A \n", + "print \"Limiting value of current, At1 = \",At1,\" A\"\n", + "print \"Limiting value of current, At2 = \",At2,\" A\"\n", + "e=(del_A/As)*100 \n", + "print \"Percentage limiting error, e = \",e,\" %\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Limiting value of current, At1 = 2.65 A\n", + "Limiting value of current, At2 = 2.35 A\n", + "Percentage limiting error, e = 6.0 %\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.1.i - page : 2-30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#ARITHEMATIC MEAN\n", + "import numpy\n", + "q=[49.7,50.1,50.2,49.6,49.7] #\n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "print \"Arithematic mean is \",AM\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Arithematic mean is 49.86\n" + ] + } + ], + "prompt_number": 57 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.1.ii - page : 2-30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#deviation\n", + "import numpy\n", + "q=[49.7,50.1,50.2,49.6,49.7] #\n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "d=q-AM\n", + "print \"Deviations of each value are : \"\n", + "for dev in d:\n", + " print dev\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Deviations of each value are : \n", + "-0.16\n", + "0.24\n", + "0.34\n", + "-0.26\n", + "-0.16\n" + ] + } + ], + "prompt_number": 58 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.1.iii - page : 2-30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#algebric sum of deviation\n", + "import numpy\n", + "q=[49.7,50.1,50.2,49.6,49.7] #\n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "d=q-AM\n", + "dtotal=sum(d)\n", + "print \"Algebric sum of deviation is\", round(dtotal,4)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Algebric sum of deviation is 0.0\n" + ] + } + ], + "prompt_number": 59 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.1.iv - page : 2-30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#standard deviation\n", + "import numpy\n", + "q=[49.7,50.1,50.2,49.6,49.7] #\n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "d=q-AM\n", + "sigma=0\n", + "n=5 # no. of measurements\n", + "for dev in d:\n", + " sigma+=dev**2\n", + "sigma/=(n-1)\n", + "sigma**=(1.0/2)\n", + "print \"Standard Deviation is \",round(sigma,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Standard Deviation is 0.27\n" + ] + } + ], + "prompt_number": 60 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.2.i - page : 2-31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#ARITHEMATIC MEAN\n", + "import numpy\n", + "q=[101.2,101.4,101.7,101.3,101.3,101.2,101.0,101.3,101.5,101.1] #\n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "print \"Arithematic mean is \",AM,\" V\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Arithematic mean is 101.3 V\n" + ] + } + ], + "prompt_number": 61 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.2.ii - page : 2-31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Deviation from mean\n", + "import numpy\n", + "q=[101.2,101.4,101.7,101.3,101.3,101.2,101.0,101.3,101.5,101.1] #\n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "d=q-AM\n", + "print \"Deviations of each value are : \"\n", + "for dev in d:\n", + " print dev\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Deviations of each value are : \n", + "-0.1\n", + "0.1\n", + "0.4\n", + "0.0\n", + "0.0\n", + "-0.1\n", + "-0.3\n", + "0.0\n", + "0.2\n", + "-0.2\n" + ] + } + ], + "prompt_number": 62 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.2.iii - page : 2-31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#standard deviation\n", + "import numpy\n", + "q=[101.2,101.4,101.7,101.3,101.3,101.2,101.0,101.3,101.5,101.1] \n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "d=q-AM\n", + "sigma=0\n", + "n=10 # no. of measurements\n", + "for dev in d:\n", + " sigma+=dev**2\n", + "sigma/=(n-1)\n", + "sigma**=(1.0/2)\n", + "print \"Standard Deviation is \",round(sigma,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Standard Deviation is 0.2\n" + ] + } + ], + "prompt_number": 63 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.2.iv - page : 2-31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#probable error\n", + "import numpy\n", + "q=[101.2,101.4,101.7,101.3,101.3,101.2,101.0,101.3,101.5,101.1] \n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "d=q-AM\n", + "sigma=0\n", + "n=10 # no. of measurements\n", + "for dev in d:\n", + " sigma+=dev**2\n", + "sigma/=(n-1)\n", + "sigma**=(1.0/2)\n", + "pe1=0.6745*sigma # Probable error of one reading\n", + "print \"Probable error of one reading is \",pe1,\" V\"\n", + "pm=pe1/(n-1)**(1.0/2)\n", + "print \"Probable error of mean is \",round(pm,5)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Probable error of one reading is 0.1349 V\n", + "Probable error of mean is 0.04497\n" + ] + } + ], + "prompt_number": 64 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.3.i - page : 2-32" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Arithmetic mean\n", + "#given data :\n", + "X1=147.2 # in nF\n", + "X2=147.4 # in nF\n", + "X3=147.9 # in nF\n", + "X4=148.1 # in nF\n", + "X5=148.1 # in nF\n", + "X6=147.5 # in nF\n", + "X7=147.6 # in nF\n", + "X8=147.4 # in nF\n", + "X9=147.6 # in nF\n", + "X10=147.5 # in nF\n", + "AM=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/10 \n", + "print \"Arithmetic mean, AM = \",AM,\" nF\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Arithmetic mean, AM = 147.63 nF\n" + ] + } + ], + "prompt_number": 77 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.3.ii - page : 2-32" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Average deviation\n", + "#given data :\n", + "n=10 \n", + "X1=147.2 # in nF\n", + "X2=147.4 # in nF\n", + "X3=147.9 # in nF\n", + "X4=148.1 # in nF\n", + "X5=148.1 # in nF\n", + "X6=147.5 # in nF\n", + "X7=147.6 # in nF\n", + "X8=147.4 # in nF\n", + "X9=147.6 # in nF\n", + "X10=147.5 # in nF\n", + "AM=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/n \n", + "d1=X1-AM \n", + "d2=X2-AM \n", + "d3=X3-AM \n", + "d4=X4-AM \n", + "d5=X5-AM \n", + "d6=X6-AM \n", + "d7=X7-AM \n", + "d8=X8-AM \n", + "d9=X9-AM \n", + "d10=X10-AM \n", + "Average_deviation=(abs(d1)+abs(d2)+abs(d3)+abs(d4)+abs(d5)+abs(d5)+abs(d6)+abs(d7)+abs(d8)+abs(d9)+abs(d10))/n \n", + "print \"Average deviation = \",Average_deviation,\" nF\"\n", + "# answer is wrong in book" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Average deviation = 0.289 nF\n" + ] + } + ], + "prompt_number": 79 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.3.iii - page : 2-32" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Standard deviation\n", + "#given data :\n", + "n=10 \n", + "X1=147.2 # in nF\n", + "X2=147.4 # in nF\n", + "X3=147.9 # in nF\n", + "X4=148.1 # in nF\n", + "X5=148.1 # in nF\n", + "X6=147.5 # in nF\n", + "X7=147.6 # in nF\n", + "X8=147.4 # in nF\n", + "X9=147.6 # in nF\n", + "X10=147.5 # in nF\n", + "AM=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/n \n", + "d1=X1-AM \n", + "d2=X2-AM \n", + "d3=X3-AM \n", + "d4=X4-AM \n", + "d5=X5-AM \n", + "d6=X6-AM \n", + "d7=X7-AM \n", + "d8=X8-AM \n", + "d9=X9-AM \n", + "d10=X10-AM \n", + "sigma=((d1**2+d2**2+d3**2+d4**2+d5**2+d6**2+d7**2+d8**2+d9**2+d10**2)/(n-1))**(1.0/2) \n", + "print \"Standard deviation = \",round(sigma,4),\" nF\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Standard deviation = 0.3057 nF\n" + ] + } + ], + "prompt_number": 82 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.3.iv - page : 2-32" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#: Probable error\n", + "#given data :\n", + "n=10 \n", + "X1=147.2 # in nF\n", + "X2=147.4 # in nF\n", + "X3=147.9 # in nF\n", + "X4=148.1 # in nF\n", + "X5=148.1 # in nF\n", + "X6=147.5 # in nF\n", + "X7=147.6 # in nF\n", + "X8=147.4 # in nF\n", + "X9=147.6 # in nF\n", + "X10=147.5 # in nF\n", + "AM=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/n \n", + "d1=X1-AM \n", + "d2=X2-AM \n", + "d3=X3-AM \n", + "d4=X4-AM \n", + "d5=X5-AM \n", + "d6=X6-AM \n", + "d7=X7-AM \n", + "d8=X8-AM \n", + "d9=X9-AM \n", + "d10=X10-AM \n", + "sigma=((d1**2+d2**2+d3**2+d4**2+d5**2+d6**2+d7**2+d8**2+d9**2+d10**2)/(n-1))**(1.0/2)\n", + "Pe1=0.6745*sigma # probable error of one reading\n", + "probable_error=Pe1/(n-1)**(1.0/2)\n", + "print \"Probable error of one reading = \",round(Pe1,4),\" nF\"\n", + "print \"Probable error of mean = \",round(probable_error,4),\" nF\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Probable error of one reading = 0.2062 nF\n", + "Probable error of mean = 0.0687 nF\n" + ] + } + ], + "prompt_number": 86 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.4.i - page : 2-34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#ARITHEMATIC MEAN\n", + "import numpy\n", + "q=[10.3,10.7,10.9,9.7,9.5,9.2,10.3,11.7] #\n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "print \"Arithematic mean is \",AM,\" kg/cm2\"\n", + "#answer is wrong in textbook\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Arithematic mean is 10.2875 kg/cm2\n" + ] + } + ], + "prompt_number": 65 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.4.ii - page : 2-34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#average deviation\n", + "import numpy\n", + "n=8 # NO. OF MEASUREMENTS\n", + "q=[10.3,10.7,10.9,9.7,9.5,9.2,10.3,11.7] #\n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "d=q-AM # deviation\n", + "davg=sum(abs(d))/n # average deviation\n", + "print \"Average deviation = \",round(davg,4),\" kg/cm2\"\n", + "#answer is wrong in textbook" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Average deviation = 0.6156 kg/cm2\n" + ] + } + ], + "prompt_number": 66 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.4.iii - page : 2-34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#standard deviation\n", + "import numpy\n", + "q=[10.3,10.7,10.9,9.7,9.5,9.2,10.3,11.7] #\n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "d=q-AM\n", + "sigma=0\n", + "n=8 # no. of measurements\n", + "for dev in d:\n", + " sigma+=dev**2\n", + "sigma/=(n-1)\n", + "sigma**=(1.0/2)\n", + "print \"Standard Deviation is \",round(sigma,4),\" kg/cm2\"\n", + "#answer is wrong in textbook\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Standard Deviation is 0.8184 kg/cm2\n" + ] + } + ], + "prompt_number": 95 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.4.iv - page : 2-34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#probable error\n", + "n=8 # no. of measurements\n", + "q=[10.3,10.7,10.9,9.7,9.5,9.2,10.3,11.7] #\n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "d=q-AM\n", + "sigma=0\n", + "n=10 # no. of measurements\n", + "for dev in d:\n", + " sigma+=dev**2\n", + "sigma/=(n-1)\n", + "sigma**=(1.0/2)\n", + "pe1=0.6745*sigma # Probable error of one reading\n", + "print \"Probable error of one reading is \",round(pe1,4),\" kg/cm2\"\n", + "pm=pe1/(n-1)**(1.0/2)\n", + "print \"Probable error of mean is \",round(pm,4),\" kg/cm2\"\n", + "#answer is wrong in textbook\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Probable error of one reading is 0.4868 kg/cm2\n", + "Probable error of mean is 0.1623 kg/cm2\n" + ] + } + ], + "prompt_number": 67 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.8.1 - page : 2-34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#ARITHEMATIC MEAN ,median value ,standard deviation and variance\n", + "q=[25.5,30.3,31.1,29.6,32.4,39.4,28.9,30.0,33.3,31.4,29.5,30.5,31.7,33.0,29.2] #\n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "n=len(q) # no. of measurements\n", + "Q=q-AM\n", + "mv=sorted(q)[n/2] # get the median value from sorted q\n", + "d=q-AM\n", + "sigma=0\n", + "for dev in d:\n", + " sigma+=dev**2\n", + "sigma/=(n-1)\n", + "sigma**=(1.0/2) #standard deviation\n", + "V=sigma**2 #variance\n", + "print \"Arithematic mean is \",round(AM,4),\" V\"\n", + "print \"Median value is\",round(mv,1)\n", + "\n", + "print \"Standard Deviation is \",round(sigma,2)\n", + "\n", + "print \"Variance is \",round(V,0)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Arithematic mean is 31.0533 V\n", + "Median value is 30.5\n", + "Standard Deviation is 3.0\n", + "Variance is 9.0\n" + ] + } + ], + "prompt_number": 116 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.8.2 - page : 2-37" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#ARITHEMATIC MEAN\n", + "#from __future__ import division\n", + "v=[10,11,12,13,14] #\n", + "f=[03,12,18,12,03] #\n", + "xn=[a*b for a,b in zip(v,f)]\n", + "am=sum(xn)/sum(f) # arithmetic mean\n", + "print \"Arithematic mean is \",am,\" V\"\n", + "dn=[x-am for x in v] # deviation\n", + "n_dn=[a*b for a,b in zip(f,dn)]\n", + "dn2=[a*b for a,b in zip(dn,dn)]\n", + "n_dn2=[a*b for a,b in zip(f,dn2)]\n", + "absn_dn=[abs(a) for a in n_dn]\n", + "mean_dev=sum(absn_dn)/sum(f)\n", + "print \"Mean deviation = \",mean_dev\n", + "sigma=(sum(n_dn2)/sum(f))**(1.0/2)\n", + "print \"Standard deviation is \", sigma\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Arithematic mean is 12.0 V\n", + "Mean deviation = 0.75\n", + "Standard deviation is 1.0\n" + ] + } + ], + "prompt_number": 46 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.8.3 - page : 2-37" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#ARITHEMATIC MEAN ,median value ,standard deviation \n", + "import numpy\n", + "q=[29.2,29.5,29.6,30.0,30.5,31.4,31.7,32.4,33.0,33.3,39.4,28.9] #\n", + "AM= numpy.mean(q)#arithematic mean in mm\n", + "print \"Arithematic mean is \",round(AM,2)\n", + "mv=sorted(q)[int(len(q)/2-1)]\n", + "print \"Median value = \",mv\n", + "d=[x-AM for x in q]\n", + "d2=[x**2 for x in d]\n", + "sigma=(sum(d2)/(len(q)-1))**(1.0/2)\n", + "print \"Standard Deviation = \",round(sigma,3)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Arithematic mean is 31.57\n", + "Median value = 30.5\n", + "Standard Deviation = 2.886\n" + ] + } + ], + "prompt_number": 97 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.8.4 - page:2-39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Unknown resistor \n", + "#given data :\n", + "S=1000.0 # ohm/V\n", + "V=100.0 #in V\n", + "I=5*10**-3 # in A\n", + "# part (i)\n", + "R_app=(V/I)*10**-3 \n", + "print \"(i) Apparent Resistor, R_app = \",R_app, \" kohm\"\n", + "# part (ii)\n", + "V1=150 #in V\n", + "Rv=S*V1*10**-3 \n", + "Rx=Rv/6.5 #actual resistance in kohm\n", + "print \"(ii) Actual resistance is \",round(Rx,2),\" kohm.\"\n", + "# part(iii)\n", + "per=(Rx-R_app)/Rx*100 # in %\n", + "print \"(iii) Percentage error due to loading effect of voltmeter is \",round(per,1), \" %\" \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Apparent Resistor, R_app = 20.0 kohm\n", + "(ii) Actual resistance is 23.08 kohm.\n", + "(iii) Percentage error due to loading effect of voltmeter is 13.3 %\n" + ] + } + ], + "prompt_number": 103 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.8.5 - page : 2-40" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# limiting error\n", + "#given data :\n", + "del_A=2.5 # may be +ve or-ve in %\n", + "As=400.0 \n", + "FSD=600.0 # in V\n", + "del_A1=(del_A/100)*FSD \n", + "e=(del_A1/As)*100 # in %\n", + "print \"Limiting error, e = \",e, \" %\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Limiting error, e = 3.75 %\n" + ] + } + ], + "prompt_number": 104 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/MohdAsif/Chapter2_-_Measurement.ipynb b/sample_notebooks/MohdAsif/Chapter2_-_Measurement.ipynb deleted file mode 100755 index 3442a20e..00000000 --- a/sample_notebooks/MohdAsif/Chapter2_-_Measurement.ipynb +++ /dev/null @@ -1,1549 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:95b9e0f83468dda84f2de4d99c5a704a6fadf8064c232b063678fd245192ca75" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter2 - Measurement Errors" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3.1 - page : 2-8" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#precision of the 5th measurement\n", - "#given data :\n", - "X1=98.0 \n", - "X2=101.0\n", - "X3=102.0 \n", - "X4=97.0 \n", - "X5=101.0 \n", - "X6=100.0 \n", - "X7=103.0 \n", - "X8=98.0 \n", - "X9=106.0 \n", - "X10=99.0 \n", - "Xn_bar=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/10 \n", - "Xn=101 # value of 5th measurement\n", - "P=(1-abs((Xn-Xn_bar)/Xn_bar))*100 \n", - "print \"Precision of the 5th measurement, P = \", round(P,2), \" %\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Precision of the 5th measurement, P = 99.5 %\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3.2.i - page : 2-10" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Absolute error\n", - "#given data :\n", - "Ae=80.0 # in V\n", - "Am=79.0 # in V\n", - "e=Ae-Am \n", - "print \"Absolute error, e = \", e, \" V\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Absolute error, e = 1.0 V\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3.2.ii - page : 2-10" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Error\n", - "#given data :\n", - "Ae=80.0 # in V\n", - "Am=79.0 # in V\n", - "e=Ae-Am \n", - "error1=(e/Ae)*100 \n", - "print \"Error = \", error1, \" %\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Error = 1.25 %\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3.2.iii - page : 2-10" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Relative accuracy\n", - "#given data :\n", - "Ae=80.0 # in V\n", - "Am=79.0 # in V\n", - "e=Ae-Am \n", - "error1=(e/Ae)*100 \n", - "A=(1-abs(e/Ae)) \n", - "print \"Relative Accuracy, A = \", A" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Relative Accuracy, A = 0.9875\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3.2.iv - page : 2-10" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# % accuracy\n", - "#given data :\n", - "Ae=80.0 # in V\n", - "Am=79.0 # in V\n", - "e=Ae-Am \n", - "error1=(e/Ae)*100 \n", - "A=(1-abs(e/Ae)) \n", - "accuracy=A*100 \n", - "print \"Accuracy = \", accuracy, \" %\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Accuracy = 98.75 %\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3.2.v - page : 2-10" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# % error\n", - "#given data :\n", - "Ae=80.0 # in V\n", - "Am=79.0 # in V\n", - "e=Ae-Am \n", - "f=100.0 #full scale deflection\n", - "error1=(e/Ae)*100 \n", - "A=(1-abs(e/Ae)) \n", - "accuracy=A*100 \n", - "P_error=(e/f)*100 \n", - "print \"% error = \", P_error, \" %\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "% error = 1.0 %\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3.3 - page : 2-11" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Maximum error\n", - "#given data :\n", - "V1=100.0 # in V\n", - "V2=200.0 #in V\n", - "V=V2-V1 \n", - "A=0.25 #may be \u00b1 in %\n", - "max_error=(A/100)*V \n", - "print \"Maximum error = \u00b1 \", max_error, \" V\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum error = \u00b1 0.25 V\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3.4 - page : 2-12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# sensitivity and deflection error\n", - "#given data :\n", - "C=4.0 # change in output in mm\n", - "M=8.0 # magnitude of input in ohm\n", - "S=C/M \n", - "print \"sensitivity, S = \", S, \" mm/ohm\"\n", - "D=M/C \n", - "print \"Deflection factor, D = \", D, \" ohm/mm\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "sensitivity, S = 0.5 mm/ohm\n", - "Deflection factor, D = 2.0 ohm/mm\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3.5 - page : 2-14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Resolution\n", - "#given data :\n", - "V=200.0 # full scale reading in V\n", - "N=100.0 # number of divisions \n", - "Scale_div=V/N \n", - "R=(1.0/10)*Scale_div \n", - "print \"Resolution, R = \", R, \" V\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Resolution, R = 0.2 V\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3.6 - page : 2-14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Resolution\n", - "#given data :\n", - "V=9.999 # full scale read out in volt\n", - "c=9999.0 # range from 0 to 9999\n", - "R=(1/c)*V*10**3 \n", - "print \"Resolution, R = \", R, \" mV\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Resolution, R = 1.0 mV\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6.1 - page : 2-23" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Magnitude and relative error\n", - "#given data :\n", - "R1=15.0 #ohm\n", - "E1=R1*5.0/100 # \u00b1 limiting error for R1\n", - "R2=33.0 #ohm\n", - "E2=R2*2.0/100 # \u00b1 limiting error for R2\n", - "R3=75.0 #ohm\n", - "E3=R3*5.0/100 # \u00b1 limiting error for R3\n", - "RT=R1+R2+R3 # ohm(in series)\n", - "ET=E1+E2+E3 #\u00b1limiting error for RT\n", - "print \"For series connection, magnitude is \", RT, \" ohm & limiting error is \u00b1 \", ET, \" ohm.\" \n", - "Epr=ET/RT*100 #%\n", - "print \"Percent relative error : \u00b1\", round(Epr,1),\" %\" \n", - "\n", - "# Answer is not accurate in the textbook." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "For series connection, magnitude is 123.0 ohm & limiting error is \u00b1 5.16 ohm.\n", - "Percent relative error : \u00b1 4.2 %\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6.2 - page : 2-23" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Magnitude and relative error\n", - "#given data :\n", - "R1=36.0 #ohm\n", - "E1=5.0 # \u00b1 limiting error for R1\n", - "R2=75.0 #ohm\n", - "E2=5.0 # \u00b1 limiting error for R2\n", - "RT=(R1*R2)/(R1+R2) #ohm(in parallel)\n", - "EP1=E1+E2 # \u00b1 limiting error\n", - "EP2=((R1*E1)/(R1+R2))+((R2*E2)/(R1+R2)) \n", - "ET=EP1+EP2 \n", - "etm=(ET/100)*RT \n", - "print \"Magnitude of limiting error is \u00b1\", round(etm,2), \" ohm\"\n", - "print \"Percentage relative error is \u00b1\", ET, \" %\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Magnitude of limiting error is \u00b1 3.65 ohm\n", - "Percentage relative error is \u00b1 15.0 %\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6.3 page : 2-24" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Limiting error\n", - "vr=40.0 #reading of voltmeter in volts\n", - "v=50.0 #rane in volts\n", - "va=50.0 #ammeeter reading in mA\n", - "i=125.0 #range in mA\n", - "fsd=2.0 #accurace in percentage in \u00b1\n", - "dv=(2.0/100)*v #limiting error of voltmeter\n", - "da=(2./100)*i #liming error of the ammeter in mA\n", - "erv=dv/vr #relative limiting error in voltmeter reading\n", - "eri=da/i #relative limiting error in ammeter reading\n", - "et=erv+eri \n", - "pet=et*100 #percentage limiting error of the power calcultaed\n", - "print \"Percentage limiting error of the power calcultaed is \u00b1 \",pet,\" %\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Percentage limiting error of the power calcultaed is \u00b1 4.5 %\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6.4 - page : 2-25" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# limiting error\n", - "r1=120.0 # ohm\n", - "er1=0.5 #limiting error in resistance 1 in ohm \u00b1\n", - "r2=2 #in A\n", - "er2=0.02 #limiting error in amperes \u00b1\n", - "e1=er2/r2 #limiting error in current\n", - "e2=er1/r1 #limiting eror in resistance\n", - "et=(2*e1+e2) #total error\n", - "etp=et*100 #percentage limtimg error\n", - "print \"Percentage limiting error in the value of power dissipation is \u00b1\",round(etp,3)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Percentage limiting error in the value of power dissipation is \u00b1 2.417\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6.5 - page : 2-25" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#magnitude and limiting error\n", - "r1=120 #in ohm\n", - "er1=0.1 #limiting error in resistance 1 in ohm \u00b1\n", - "r2=2700 #in ohm\n", - "er2=0.5 #limiting error in resistance 2 in ohm \u00b1\n", - "r3=470 #in ohm\n", - "er3=0.5 #limiting error in resistance 3 in ohm \u00b1\n", - "rxm=(r2*r3)/r1 #magnitude of unknown resistance in ohm\n", - "rxe=(er1+er2+er3) #error\n", - "er=(rxe*rxm)/100 #relative error \u00b1\n", - "print \"Magnitude of unknown resistance is \",rxm,\" kohm\"\n", - "print \"Relative limiting error is \u00b1\",er,\" ohm\"\n", - "print \"Guranteed value of resistance is between \",rxm-er, \" ohm to \" ,rxm+er,\" ohm\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Magnitude of unknown resistance is 10575 kohm\n", - "Relative limiting error is \u00b1 116.325 ohm\n", - "Guranteed value of resistance is between 10458.675 ohm to 10691.325 ohm\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6.6 - page : 2-26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# absolute error, % error, relative error, % accuracy and % error of full scale reading\n", - "#given data :\n", - "Ae=80.0 # in volt\n", - "Am=79 # in volt\n", - "fsd=100 #full scale reading in volt\n", - "e=Ae-Am \n", - "print \"Absolute error, e = \",e,\" V\"\n", - "error1=(e/Ae)*100 \n", - "print \"Error = \",error1,\" %\"\n", - "A=1-abs(e/Ae) \n", - "print \"Relative accuracy, A = \",A,\" %\"\n", - "p_accuracy=A*100 \n", - "print \"% accuracy = \",p_accuracy,\" %\"\n", - "error2=(e/fsd)*100 \n", - "print \"% error expressed as percentage of full scale reading = \",error2,\" %\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Absolute error, e = 1.0 V\n", - "Error = 1.25 %\n", - "Relative accuracy, A = 0.9875 %\n", - "% accuracy = 98.75 %\n", - "% error expressed as percentage of full scale reading = 1.0 %\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6.7 - page : 2-27" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# limiting error\n", - "#given data :\n", - "fsd=100.0 # in V\n", - "A=1.0 # (+ve or -ve) in %\n", - "del_A=(A/100)*fsd \n", - "As=15.0 #in V\n", - "e1=del_A/As \n", - "e=e1*100 \n", - "print \"Limiting error, e = \",round(e,4),\" %\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Limiting error, e = 6.6667 %\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6.8 - page : 2-27 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# limiting value of current and % limiting error\n", - "#given data :\n", - "As=2.5 # in A\n", - "fsd=10 #full scale reading in A\n", - "A=1.5/100 \n", - "del_A=A*fsd \n", - "At1=As+del_A \n", - "At2=As-del_A \n", - "print \"Limiting value of current, At1 = \",At1,\" A\"\n", - "print \"Limiting value of current, At2 = \",At2,\" A\"\n", - "e=(del_A/As)*100 \n", - "print \"Percentage limiting error, e = \",e,\" %\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Limiting value of current, At1 = 2.65 A\n", - "Limiting value of current, At2 = 2.35 A\n", - "Percentage limiting error, e = 6.0 %\n" - ] - } - ], - "prompt_number": 23 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.1.i - page : 2-30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#ARITHEMATIC MEAN\n", - "import numpy\n", - "q=[49.7,50.1,50.2,49.6,49.7] #\n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "print \"Arithematic mean is \",AM\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Arithematic mean is 49.86\n" - ] - } - ], - "prompt_number": 57 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.1.ii - page : 2-30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#deviation\n", - "import numpy\n", - "q=[49.7,50.1,50.2,49.6,49.7] #\n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "d=q-AM\n", - "print \"Deviations of each value are : \"\n", - "for dev in d:\n", - " print dev\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Deviations of each value are : \n", - "-0.16\n", - "0.24\n", - "0.34\n", - "-0.26\n", - "-0.16\n" - ] - } - ], - "prompt_number": 58 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.1.iii - page : 2-30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#algebric sum of deviation\n", - "import numpy\n", - "q=[49.7,50.1,50.2,49.6,49.7] #\n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "d=q-AM\n", - "dtotal=sum(d)\n", - "print \"Algebric sum of deviation is\", round(dtotal,4)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Algebric sum of deviation is 0.0\n" - ] - } - ], - "prompt_number": 59 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.1.iv - page : 2-30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#standard deviation\n", - "import numpy\n", - "q=[49.7,50.1,50.2,49.6,49.7] #\n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "d=q-AM\n", - "sigma=0\n", - "n=5 # no. of measurements\n", - "for dev in d:\n", - " sigma+=dev**2\n", - "sigma/=(n-1)\n", - "sigma**=(1.0/2)\n", - "print \"Standard Deviation is \",round(sigma,2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Standard Deviation is 0.27\n" - ] - } - ], - "prompt_number": 60 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.2.i - page : 2-31" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#ARITHEMATIC MEAN\n", - "import numpy\n", - "q=[101.2,101.4,101.7,101.3,101.3,101.2,101.0,101.3,101.5,101.1] #\n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "print \"Arithematic mean is \",AM,\" V\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Arithematic mean is 101.3 V\n" - ] - } - ], - "prompt_number": 61 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.2.ii - page : 2-31" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Deviation from mean\n", - "import numpy\n", - "q=[101.2,101.4,101.7,101.3,101.3,101.2,101.0,101.3,101.5,101.1] #\n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "d=q-AM\n", - "print \"Deviations of each value are : \"\n", - "for dev in d:\n", - " print dev\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Deviations of each value are : \n", - "-0.1\n", - "0.1\n", - "0.4\n", - "0.0\n", - "0.0\n", - "-0.1\n", - "-0.3\n", - "0.0\n", - "0.2\n", - "-0.2\n" - ] - } - ], - "prompt_number": 62 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.2.iii - page : 2-31" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#standard deviation\n", - "import numpy\n", - "q=[101.2,101.4,101.7,101.3,101.3,101.2,101.0,101.3,101.5,101.1] \n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "d=q-AM\n", - "sigma=0\n", - "n=10 # no. of measurements\n", - "for dev in d:\n", - " sigma+=dev**2\n", - "sigma/=(n-1)\n", - "sigma**=(1.0/2)\n", - "print \"Standard Deviation is \",round(sigma,2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Standard Deviation is 0.2\n" - ] - } - ], - "prompt_number": 63 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.2.iv - page : 2-31" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#probable error\n", - "import numpy\n", - "q=[101.2,101.4,101.7,101.3,101.3,101.2,101.0,101.3,101.5,101.1] \n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "d=q-AM\n", - "sigma=0\n", - "n=10 # no. of measurements\n", - "for dev in d:\n", - " sigma+=dev**2\n", - "sigma/=(n-1)\n", - "sigma**=(1.0/2)\n", - "pe1=0.6745*sigma # Probable error of one reading\n", - "print \"Probable error of one reading is \",pe1,\" V\"\n", - "pm=pe1/(n-1)**(1.0/2)\n", - "print \"Probable error of mean is \",round(pm,5)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Probable error of one reading is 0.1349 V\n", - "Probable error of mean is 0.04497\n" - ] - } - ], - "prompt_number": 64 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.3.i - page : 2-32" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Arithmetic mean\n", - "#given data :\n", - "X1=147.2 # in nF\n", - "X2=147.4 # in nF\n", - "X3=147.9 # in nF\n", - "X4=148.1 # in nF\n", - "X5=148.1 # in nF\n", - "X6=147.5 # in nF\n", - "X7=147.6 # in nF\n", - "X8=147.4 # in nF\n", - "X9=147.6 # in nF\n", - "X10=147.5 # in nF\n", - "AM=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/10 \n", - "print \"Arithmetic mean, AM = \",AM,\" nF\" " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Arithmetic mean, AM = 147.63 nF\n" - ] - } - ], - "prompt_number": 77 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.3.ii - page : 2-32" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Average deviation\n", - "#given data :\n", - "n=10 \n", - "X1=147.2 # in nF\n", - "X2=147.4 # in nF\n", - "X3=147.9 # in nF\n", - "X4=148.1 # in nF\n", - "X5=148.1 # in nF\n", - "X6=147.5 # in nF\n", - "X7=147.6 # in nF\n", - "X8=147.4 # in nF\n", - "X9=147.6 # in nF\n", - "X10=147.5 # in nF\n", - "AM=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/n \n", - "d1=X1-AM \n", - "d2=X2-AM \n", - "d3=X3-AM \n", - "d4=X4-AM \n", - "d5=X5-AM \n", - "d6=X6-AM \n", - "d7=X7-AM \n", - "d8=X8-AM \n", - "d9=X9-AM \n", - "d10=X10-AM \n", - "Average_deviation=(abs(d1)+abs(d2)+abs(d3)+abs(d4)+abs(d5)+abs(d5)+abs(d6)+abs(d7)+abs(d8)+abs(d9)+abs(d10))/n \n", - "print \"Average deviation = \",Average_deviation,\" nF\"\n", - "# answer is wrong in book" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Average deviation = 0.289 nF\n" - ] - } - ], - "prompt_number": 79 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.3.iii - page : 2-32" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Standard deviation\n", - "#given data :\n", - "n=10 \n", - "X1=147.2 # in nF\n", - "X2=147.4 # in nF\n", - "X3=147.9 # in nF\n", - "X4=148.1 # in nF\n", - "X5=148.1 # in nF\n", - "X6=147.5 # in nF\n", - "X7=147.6 # in nF\n", - "X8=147.4 # in nF\n", - "X9=147.6 # in nF\n", - "X10=147.5 # in nF\n", - "AM=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/n \n", - "d1=X1-AM \n", - "d2=X2-AM \n", - "d3=X3-AM \n", - "d4=X4-AM \n", - "d5=X5-AM \n", - "d6=X6-AM \n", - "d7=X7-AM \n", - "d8=X8-AM \n", - "d9=X9-AM \n", - "d10=X10-AM \n", - "sigma=((d1**2+d2**2+d3**2+d4**2+d5**2+d6**2+d7**2+d8**2+d9**2+d10**2)/(n-1))**(1.0/2) \n", - "print \"Standard deviation = \",round(sigma,4),\" nF\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Standard deviation = 0.3057 nF\n" - ] - } - ], - "prompt_number": 82 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.3.iv - page : 2-32" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#: Probable error\n", - "#given data :\n", - "n=10 \n", - "X1=147.2 # in nF\n", - "X2=147.4 # in nF\n", - "X3=147.9 # in nF\n", - "X4=148.1 # in nF\n", - "X5=148.1 # in nF\n", - "X6=147.5 # in nF\n", - "X7=147.6 # in nF\n", - "X8=147.4 # in nF\n", - "X9=147.6 # in nF\n", - "X10=147.5 # in nF\n", - "AM=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/n \n", - "d1=X1-AM \n", - "d2=X2-AM \n", - "d3=X3-AM \n", - "d4=X4-AM \n", - "d5=X5-AM \n", - "d6=X6-AM \n", - "d7=X7-AM \n", - "d8=X8-AM \n", - "d9=X9-AM \n", - "d10=X10-AM \n", - "sigma=((d1**2+d2**2+d3**2+d4**2+d5**2+d6**2+d7**2+d8**2+d9**2+d10**2)/(n-1))**(1.0/2)\n", - "Pe1=0.6745*sigma # probable error of one reading\n", - "probable_error=Pe1/(n-1)**(1.0/2)\n", - "print \"Probable error of one reading = \",round(Pe1,4),\" nF\"\n", - "print \"Probable error of mean = \",round(probable_error,4),\" nF\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Probable error of one reading = 0.2062 nF\n", - "Probable error of mean = 0.0687 nF\n" - ] - } - ], - "prompt_number": 86 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.4.i - page : 2-34" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#ARITHEMATIC MEAN\n", - "import numpy\n", - "q=[10.3,10.7,10.9,9.7,9.5,9.2,10.3,11.7] #\n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "print \"Arithematic mean is \",AM,\" kg/cm2\"\n", - "#answer is wrong in textbook\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Arithematic mean is 10.2875 kg/cm2\n" - ] - } - ], - "prompt_number": 65 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.4.ii - page : 2-34" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#average deviation\n", - "import numpy\n", - "n=8 # NO. OF MEASUREMENTS\n", - "q=[10.3,10.7,10.9,9.7,9.5,9.2,10.3,11.7] #\n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "d=q-AM # deviation\n", - "davg=sum(abs(d))/n # average deviation\n", - "print \"Average deviation = \",round(davg,4),\" kg/cm2\"\n", - "#answer is wrong in textbook" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Average deviation = 0.6156 kg/cm2\n" - ] - } - ], - "prompt_number": 66 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.4.iii - page : 2-34" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#standard deviation\n", - "import numpy\n", - "q=[10.3,10.7,10.9,9.7,9.5,9.2,10.3,11.7] #\n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "d=q-AM\n", - "sigma=0\n", - "n=8 # no. of measurements\n", - "for dev in d:\n", - " sigma+=dev**2\n", - "sigma/=(n-1)\n", - "sigma**=(1.0/2)\n", - "print \"Standard Deviation is \",round(sigma,4),\" kg/cm2\"\n", - "#answer is wrong in textbook\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Standard Deviation is 0.8184 kg/cm2\n" - ] - } - ], - "prompt_number": 95 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.4.iv - page : 2-34" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#probable error\n", - "n=8 # no. of measurements\n", - "q=[10.3,10.7,10.9,9.7,9.5,9.2,10.3,11.7] #\n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "d=q-AM\n", - "sigma=0\n", - "n=10 # no. of measurements\n", - "for dev in d:\n", - " sigma+=dev**2\n", - "sigma/=(n-1)\n", - "sigma**=(1.0/2)\n", - "pe1=0.6745*sigma # Probable error of one reading\n", - "print \"Probable error of one reading is \",round(pe1,4),\" kg/cm2\"\n", - "pm=pe1/(n-1)**(1.0/2)\n", - "print \"Probable error of mean is \",round(pm,4),\" kg/cm2\"\n", - "#answer is wrong in textbook\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Probable error of one reading is 0.4868 kg/cm2\n", - "Probable error of mean is 0.1623 kg/cm2\n" - ] - } - ], - "prompt_number": 67 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.8.1 - page : 2-34" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#ARITHEMATIC MEAN ,median value ,standard deviation and variance\n", - "q=[25.5,30.3,31.1,29.6,32.4,39.4,28.9,30.0,33.3,31.4,29.5,30.5,31.7,33.0,29.2] #\n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "n=len(q) # no. of measurements\n", - "Q=q-AM\n", - "mv=sorted(q)[n/2] # get the median value from sorted q\n", - "d=q-AM\n", - "sigma=0\n", - "for dev in d:\n", - " sigma+=dev**2\n", - "sigma/=(n-1)\n", - "sigma**=(1.0/2) #standard deviation\n", - "V=sigma**2 #variance\n", - "print \"Arithematic mean is \",round(AM,4),\" V\"\n", - "print \"Median value is\",round(mv,1)\n", - "\n", - "print \"Standard Deviation is \",round(sigma,2)\n", - "\n", - "print \"Variance is \",round(V,0)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Arithematic mean is 31.0533 V\n", - "Median value is 30.5\n", - "Standard Deviation is 3.0\n", - "Variance is 9.0\n" - ] - } - ], - "prompt_number": 116 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.8.2 - page : 2-37" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#ARITHEMATIC MEAN\n", - "#from __future__ import division\n", - "v=[10,11,12,13,14] #\n", - "f=[03,12,18,12,03] #\n", - "xn=[a*b for a,b in zip(v,f)]\n", - "am=sum(xn)/sum(f) # arithmetic mean\n", - "print \"Arithematic mean is \",am,\" V\"\n", - "dn=[x-am for x in v] # deviation\n", - "n_dn=[a*b for a,b in zip(f,dn)]\n", - "dn2=[a*b for a,b in zip(dn,dn)]\n", - "n_dn2=[a*b for a,b in zip(f,dn2)]\n", - "absn_dn=[abs(a) for a in n_dn]\n", - "mean_dev=sum(absn_dn)/sum(f)\n", - "print \"Mean deviation = \",mean_dev\n", - "sigma=(sum(n_dn2)/sum(f))**(1.0/2)\n", - "print \"Standard deviation is \", sigma\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Arithematic mean is 12.0 V\n", - "Mean deviation = 0.75\n", - "Standard deviation is 1.0\n" - ] - } - ], - "prompt_number": 46 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.8.3 - page : 2-37" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#ARITHEMATIC MEAN ,median value ,standard deviation \n", - "import numpy\n", - "q=[29.2,29.5,29.6,30.0,30.5,31.4,31.7,32.4,33.0,33.3,39.4,28.9] #\n", - "AM= numpy.mean(q)#arithematic mean in mm\n", - "print \"Arithematic mean is \",round(AM,2)\n", - "mv=sorted(q)[int(len(q)/2-1)]\n", - "print \"Median value = \",mv\n", - "d=[x-AM for x in q]\n", - "d2=[x**2 for x in d]\n", - "sigma=(sum(d2)/(len(q)-1))**(1.0/2)\n", - "print \"Standard Deviation = \",round(sigma,3)\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Arithematic mean is 31.57\n", - "Median value = 30.5\n", - "Standard Deviation = 2.886\n" - ] - } - ], - "prompt_number": 97 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.8.4 - page:2-39" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Unknown resistor \n", - "#given data :\n", - "S=1000.0 # ohm/V\n", - "V=100.0 #in V\n", - "I=5*10**-3 # in A\n", - "# part (i)\n", - "R_app=(V/I)*10**-3 \n", - "print \"(i) Apparent Resistor, R_app = \",R_app, \" kohm\"\n", - "# part (ii)\n", - "V1=150 #in V\n", - "Rv=S*V1*10**-3 \n", - "Rx=Rv/6.5 #actual resistance in kohm\n", - "print \"(ii) Actual resistance is \",round(Rx,2),\" kohm.\"\n", - "# part(iii)\n", - "per=(Rx-R_app)/Rx*100 # in %\n", - "print \"(iii) Percentage error due to loading effect of voltmeter is \",round(per,1), \" %\" \n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(i) Apparent Resistor, R_app = 20.0 kohm\n", - "(ii) Actual resistance is 23.08 kohm.\n", - "(iii) Percentage error due to loading effect of voltmeter is 13.3 %\n" - ] - } - ], - "prompt_number": 103 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.8.5 - page : 2-40" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# limiting error\n", - "#given data :\n", - "del_A=2.5 # may be +ve or-ve in %\n", - "As=400.0 \n", - "FSD=600.0 # in V\n", - "del_A1=(del_A/100)*FSD \n", - "e=(del_A1/As)*100 # in %\n", - "print \"Limiting error, e = \",e, \" %\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Limiting error, e = 3.75 %\n" - ] - } - ], - "prompt_number": 104 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI.ipynb new file mode 100755 index 00000000..e025dd86 --- /dev/null +++ b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI.ipynb @@ -0,0 +1,462 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Radiation" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.7.1, PAGE NO.-30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "# Variable declaration\n", + "\n", + "I_m = 15 #Current in Ampere\n", + "P_rad = 6 #Power radiated in kW\n", + "\n", + "#Calculation\n", + "\n", + "# By formula\n", + "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", + "\n", + "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", + "\n", + "#Result\n", + "\n", + "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The radiation resistance of Antenna is 53.33 kW\n" + ] + } + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.1,PAGE NO.-42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt \n", + "from sympy import Symbol\n", + "\n", + "# Variable Declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = Lm/25 # Length of dipole for Hertian dipole\n", + "H_phi = 5 # Magnetic field strength in uA/m\n", + "theta = pi/2\n", + "r = 2 # Distance in Km\n", + "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", + "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", + "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", + "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", + "\n", + "# Calculation\n", + "\n", + "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", + "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", + "I_rms = I_m/sqrt(2)\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", + "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", + "I_rms1 = I_m1/sqrt(2)\n", + "P_rad1 = (I_rms1**2)*R_rad\n", + "P_rad2 = (I_rms1**2)*R_rad1\n", + "\n", + "# Result\n", + "\n", + "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", + "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", + "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.2,PAGE NO.-43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt\n", + "\n", + "\n", + "\n", + "#variable declaration \n", + "\n", + "\n", + "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", + "theta = pi/2 #observation angle\n", + "r = 500*(10**3) #distance in metrs\n", + "f = 50*(10**6) #frequency in Hertz\n", + "c = 3*(10**8) #speed of light in m/sec\n", + "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", + "\n", + "\n", + "# calculation\n", + "lamda = c/f\n", + "L = lamda/2 #L is the length of half wave dipole\n", + "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", + "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", + "I_rms = I_m/sqrt(2)\n", + "P_avg = (R_rad*(I_m**2))/2\n", + "\n", + "#Result\n", + "\n", + "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", + "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", + "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.3,PAGE NO.-44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 100 #effective hieght in m\n", + "f = 60*(10**3) #frequency in Hertz\n", + "r = 100*(10**3) #Distance in m\n", + "c = 3*(10**8) #Speed of light in m/sec\n", + "P_rad = 100*(10**3) #radiated power\n", + "\n", + "# calculation\n", + "\n", + "lamda = c/f\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "I_rms = sqrt(P_rad/R_rad)\n", + "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", + "\n", + "# Results\n", + "\n", + "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.4,PAGE NO.-45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 113.3 #Effective length in metres\n", + "lamda = 18.8 #Wavelength in metres\n", + "I_rms = 725 #Base current in Ampere\n", + "r = 175 #Distance in metre\n", + "Eta_o = 120*pi\n", + "\n", + "#Calculation\n", + "\n", + "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", + "H = E/Eta_o\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "P_rad = (I_rms**2)*(R_rad)\n", + "\n", + "#Result\n", + "\n", + "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", + "print \"The H field is\",round(H,2),\"uA/m\"\n", + "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.5,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin\n", + "\n", + "# variable declaration\n", + "\n", + "lamda = 10*(10**(-2)) # In cm\n", + "r = 200*(10**(-2)) # In cm\n", + "theta = 90 # In Degrees\n", + "phi = 0 # In Degrees\n", + "IdL = 3*(10**(-4)) # current distribution in Am\n", + "\n", + "#Calculation\n", + "\n", + "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", + "\n", + "#Result\n", + "\n", + "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.6,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "dL = lamda/12\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.7,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "I_m = 100 # uniform current in ampere\n", + "Lm = Symbol('Lm') #Taking Lm as lamda\n", + "dL = Lm/16\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", + "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.8,PAGE NO.-47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# variable declaration\n", + "\n", + "f = 30*(10**6) #Frequency in Hz\n", + "c = 3*(10**8) #speed of light in m/s\n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "\n", + "#Result\n", + "\n", + "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.10,PAGE NO.-48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin,sqrt \n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = 0.01*Lm # Length of dipole \n", + "theta = 45\n", + "P_rad = 1 # Power radiated in kW\n", + "phi = 90\n", + "r = 1 # Distance in Km\n", + "Eta_o=120*pi\n", + "\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", + "I_m = sqrt(2*P_rad*R_rad)\n", + "\n", + "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", + "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Power density is \",P,\"Watt/m^2\"\n", + "\n", + "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.11,PAGE NO.-49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi \n", + "\n", + "# variable declaration\n", + "\n", + "dL = 75 #Length of dipole in m\n", + "f = 800 # Frequency in kHz\n", + "I_rms = 10 #rms Current in Amp\n", + "c = 3*(10**8) #Speed of light in m/s \n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_1.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_1.ipynb new file mode 100755 index 00000000..e025dd86 --- /dev/null +++ b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_1.ipynb @@ -0,0 +1,462 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Radiation" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.7.1, PAGE NO.-30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "# Variable declaration\n", + "\n", + "I_m = 15 #Current in Ampere\n", + "P_rad = 6 #Power radiated in kW\n", + "\n", + "#Calculation\n", + "\n", + "# By formula\n", + "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", + "\n", + "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", + "\n", + "#Result\n", + "\n", + "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The radiation resistance of Antenna is 53.33 kW\n" + ] + } + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.1,PAGE NO.-42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt \n", + "from sympy import Symbol\n", + "\n", + "# Variable Declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = Lm/25 # Length of dipole for Hertian dipole\n", + "H_phi = 5 # Magnetic field strength in uA/m\n", + "theta = pi/2\n", + "r = 2 # Distance in Km\n", + "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", + "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", + "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", + "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", + "\n", + "# Calculation\n", + "\n", + "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", + "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", + "I_rms = I_m/sqrt(2)\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", + "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", + "I_rms1 = I_m1/sqrt(2)\n", + "P_rad1 = (I_rms1**2)*R_rad\n", + "P_rad2 = (I_rms1**2)*R_rad1\n", + "\n", + "# Result\n", + "\n", + "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", + "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", + "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.2,PAGE NO.-43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt\n", + "\n", + "\n", + "\n", + "#variable declaration \n", + "\n", + "\n", + "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", + "theta = pi/2 #observation angle\n", + "r = 500*(10**3) #distance in metrs\n", + "f = 50*(10**6) #frequency in Hertz\n", + "c = 3*(10**8) #speed of light in m/sec\n", + "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", + "\n", + "\n", + "# calculation\n", + "lamda = c/f\n", + "L = lamda/2 #L is the length of half wave dipole\n", + "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", + "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", + "I_rms = I_m/sqrt(2)\n", + "P_avg = (R_rad*(I_m**2))/2\n", + "\n", + "#Result\n", + "\n", + "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", + "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", + "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.3,PAGE NO.-44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 100 #effective hieght in m\n", + "f = 60*(10**3) #frequency in Hertz\n", + "r = 100*(10**3) #Distance in m\n", + "c = 3*(10**8) #Speed of light in m/sec\n", + "P_rad = 100*(10**3) #radiated power\n", + "\n", + "# calculation\n", + "\n", + "lamda = c/f\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "I_rms = sqrt(P_rad/R_rad)\n", + "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", + "\n", + "# Results\n", + "\n", + "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.4,PAGE NO.-45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 113.3 #Effective length in metres\n", + "lamda = 18.8 #Wavelength in metres\n", + "I_rms = 725 #Base current in Ampere\n", + "r = 175 #Distance in metre\n", + "Eta_o = 120*pi\n", + "\n", + "#Calculation\n", + "\n", + "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", + "H = E/Eta_o\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "P_rad = (I_rms**2)*(R_rad)\n", + "\n", + "#Result\n", + "\n", + "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", + "print \"The H field is\",round(H,2),\"uA/m\"\n", + "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.5,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin\n", + "\n", + "# variable declaration\n", + "\n", + "lamda = 10*(10**(-2)) # In cm\n", + "r = 200*(10**(-2)) # In cm\n", + "theta = 90 # In Degrees\n", + "phi = 0 # In Degrees\n", + "IdL = 3*(10**(-4)) # current distribution in Am\n", + "\n", + "#Calculation\n", + "\n", + "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", + "\n", + "#Result\n", + "\n", + "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.6,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "dL = lamda/12\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.7,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "I_m = 100 # uniform current in ampere\n", + "Lm = Symbol('Lm') #Taking Lm as lamda\n", + "dL = Lm/16\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", + "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.8,PAGE NO.-47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# variable declaration\n", + "\n", + "f = 30*(10**6) #Frequency in Hz\n", + "c = 3*(10**8) #speed of light in m/s\n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "\n", + "#Result\n", + "\n", + "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.10,PAGE NO.-48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin,sqrt \n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = 0.01*Lm # Length of dipole \n", + "theta = 45\n", + "P_rad = 1 # Power radiated in kW\n", + "phi = 90\n", + "r = 1 # Distance in Km\n", + "Eta_o=120*pi\n", + "\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", + "I_m = sqrt(2*P_rad*R_rad)\n", + "\n", + "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", + "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Power density is \",P,\"Watt/m^2\"\n", + "\n", + "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.11,PAGE NO.-49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi \n", + "\n", + "# variable declaration\n", + "\n", + "dL = 75 #Length of dipole in m\n", + "f = 800 # Frequency in kHz\n", + "I_rms = 10 #rms Current in Amp\n", + "c = 3*(10**8) #Speed of light in m/s \n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_10.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_10.ipynb new file mode 100755 index 00000000..e025dd86 --- /dev/null +++ b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_10.ipynb @@ -0,0 +1,462 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Radiation" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.7.1, PAGE NO.-30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "# Variable declaration\n", + "\n", + "I_m = 15 #Current in Ampere\n", + "P_rad = 6 #Power radiated in kW\n", + "\n", + "#Calculation\n", + "\n", + "# By formula\n", + "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", + "\n", + "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", + "\n", + "#Result\n", + "\n", + "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The radiation resistance of Antenna is 53.33 kW\n" + ] + } + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.1,PAGE NO.-42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt \n", + "from sympy import Symbol\n", + "\n", + "# Variable Declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = Lm/25 # Length of dipole for Hertian dipole\n", + "H_phi = 5 # Magnetic field strength in uA/m\n", + "theta = pi/2\n", + "r = 2 # Distance in Km\n", + "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", + "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", + "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", + "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", + "\n", + "# Calculation\n", + "\n", + "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", + "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", + "I_rms = I_m/sqrt(2)\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", + "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", + "I_rms1 = I_m1/sqrt(2)\n", + "P_rad1 = (I_rms1**2)*R_rad\n", + "P_rad2 = (I_rms1**2)*R_rad1\n", + "\n", + "# Result\n", + "\n", + "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", + "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", + "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.2,PAGE NO.-43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt\n", + "\n", + "\n", + "\n", + "#variable declaration \n", + "\n", + "\n", + "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", + "theta = pi/2 #observation angle\n", + "r = 500*(10**3) #distance in metrs\n", + "f = 50*(10**6) #frequency in Hertz\n", + "c = 3*(10**8) #speed of light in m/sec\n", + "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", + "\n", + "\n", + "# calculation\n", + "lamda = c/f\n", + "L = lamda/2 #L is the length of half wave dipole\n", + "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", + "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", + "I_rms = I_m/sqrt(2)\n", + "P_avg = (R_rad*(I_m**2))/2\n", + "\n", + "#Result\n", + "\n", + "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", + "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", + "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.3,PAGE NO.-44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 100 #effective hieght in m\n", + "f = 60*(10**3) #frequency in Hertz\n", + "r = 100*(10**3) #Distance in m\n", + "c = 3*(10**8) #Speed of light in m/sec\n", + "P_rad = 100*(10**3) #radiated power\n", + "\n", + "# calculation\n", + "\n", + "lamda = c/f\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "I_rms = sqrt(P_rad/R_rad)\n", + "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", + "\n", + "# Results\n", + "\n", + "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.4,PAGE NO.-45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 113.3 #Effective length in metres\n", + "lamda = 18.8 #Wavelength in metres\n", + "I_rms = 725 #Base current in Ampere\n", + "r = 175 #Distance in metre\n", + "Eta_o = 120*pi\n", + "\n", + "#Calculation\n", + "\n", + "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", + "H = E/Eta_o\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "P_rad = (I_rms**2)*(R_rad)\n", + "\n", + "#Result\n", + "\n", + "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", + "print \"The H field is\",round(H,2),\"uA/m\"\n", + "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.5,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin\n", + "\n", + "# variable declaration\n", + "\n", + "lamda = 10*(10**(-2)) # In cm\n", + "r = 200*(10**(-2)) # In cm\n", + "theta = 90 # In Degrees\n", + "phi = 0 # In Degrees\n", + "IdL = 3*(10**(-4)) # current distribution in Am\n", + "\n", + "#Calculation\n", + "\n", + "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", + "\n", + "#Result\n", + "\n", + "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.6,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "dL = lamda/12\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.7,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "I_m = 100 # uniform current in ampere\n", + "Lm = Symbol('Lm') #Taking Lm as lamda\n", + "dL = Lm/16\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", + "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.8,PAGE NO.-47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# variable declaration\n", + "\n", + "f = 30*(10**6) #Frequency in Hz\n", + "c = 3*(10**8) #speed of light in m/s\n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "\n", + "#Result\n", + "\n", + "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.10,PAGE NO.-48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin,sqrt \n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = 0.01*Lm # Length of dipole \n", + "theta = 45\n", + "P_rad = 1 # Power radiated in kW\n", + "phi = 90\n", + "r = 1 # Distance in Km\n", + "Eta_o=120*pi\n", + "\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", + "I_m = sqrt(2*P_rad*R_rad)\n", + "\n", + "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", + "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Power density is \",P,\"Watt/m^2\"\n", + "\n", + "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.11,PAGE NO.-49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi \n", + "\n", + "# variable declaration\n", + "\n", + "dL = 75 #Length of dipole in m\n", + "f = 800 # Frequency in kHz\n", + "I_rms = 10 #rms Current in Amp\n", + "c = 3*(10**8) #Speed of light in m/s \n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_11.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_11.ipynb new file mode 100755 index 00000000..e025dd86 --- /dev/null +++ b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_11.ipynb @@ -0,0 +1,462 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Radiation" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.7.1, PAGE NO.-30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "# Variable declaration\n", + "\n", + "I_m = 15 #Current in Ampere\n", + "P_rad = 6 #Power radiated in kW\n", + "\n", + "#Calculation\n", + "\n", + "# By formula\n", + "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", + "\n", + "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", + "\n", + "#Result\n", + "\n", + "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The radiation resistance of Antenna is 53.33 kW\n" + ] + } + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.1,PAGE NO.-42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt \n", + "from sympy import Symbol\n", + "\n", + "# Variable Declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = Lm/25 # Length of dipole for Hertian dipole\n", + "H_phi = 5 # Magnetic field strength in uA/m\n", + "theta = pi/2\n", + "r = 2 # Distance in Km\n", + "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", + "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", + "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", + "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", + "\n", + "# Calculation\n", + "\n", + "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", + "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", + "I_rms = I_m/sqrt(2)\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", + "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", + "I_rms1 = I_m1/sqrt(2)\n", + "P_rad1 = (I_rms1**2)*R_rad\n", + "P_rad2 = (I_rms1**2)*R_rad1\n", + "\n", + "# Result\n", + "\n", + "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", + "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", + "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.2,PAGE NO.-43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt\n", + "\n", + "\n", + "\n", + "#variable declaration \n", + "\n", + "\n", + "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", + "theta = pi/2 #observation angle\n", + "r = 500*(10**3) #distance in metrs\n", + "f = 50*(10**6) #frequency in Hertz\n", + "c = 3*(10**8) #speed of light in m/sec\n", + "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", + "\n", + "\n", + "# calculation\n", + "lamda = c/f\n", + "L = lamda/2 #L is the length of half wave dipole\n", + "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", + "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", + "I_rms = I_m/sqrt(2)\n", + "P_avg = (R_rad*(I_m**2))/2\n", + "\n", + "#Result\n", + "\n", + "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", + "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", + "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.3,PAGE NO.-44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 100 #effective hieght in m\n", + "f = 60*(10**3) #frequency in Hertz\n", + "r = 100*(10**3) #Distance in m\n", + "c = 3*(10**8) #Speed of light in m/sec\n", + "P_rad = 100*(10**3) #radiated power\n", + "\n", + "# calculation\n", + "\n", + "lamda = c/f\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "I_rms = sqrt(P_rad/R_rad)\n", + "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", + "\n", + "# Results\n", + "\n", + "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.4,PAGE NO.-45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 113.3 #Effective length in metres\n", + "lamda = 18.8 #Wavelength in metres\n", + "I_rms = 725 #Base current in Ampere\n", + "r = 175 #Distance in metre\n", + "Eta_o = 120*pi\n", + "\n", + "#Calculation\n", + "\n", + "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", + "H = E/Eta_o\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "P_rad = (I_rms**2)*(R_rad)\n", + "\n", + "#Result\n", + "\n", + "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", + "print \"The H field is\",round(H,2),\"uA/m\"\n", + "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.5,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin\n", + "\n", + "# variable declaration\n", + "\n", + "lamda = 10*(10**(-2)) # In cm\n", + "r = 200*(10**(-2)) # In cm\n", + "theta = 90 # In Degrees\n", + "phi = 0 # In Degrees\n", + "IdL = 3*(10**(-4)) # current distribution in Am\n", + "\n", + "#Calculation\n", + "\n", + "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", + "\n", + "#Result\n", + "\n", + "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.6,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "dL = lamda/12\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.7,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "I_m = 100 # uniform current in ampere\n", + "Lm = Symbol('Lm') #Taking Lm as lamda\n", + "dL = Lm/16\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", + "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.8,PAGE NO.-47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# variable declaration\n", + "\n", + "f = 30*(10**6) #Frequency in Hz\n", + "c = 3*(10**8) #speed of light in m/s\n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "\n", + "#Result\n", + "\n", + "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.10,PAGE NO.-48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin,sqrt \n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = 0.01*Lm # Length of dipole \n", + "theta = 45\n", + "P_rad = 1 # Power radiated in kW\n", + "phi = 90\n", + "r = 1 # Distance in Km\n", + "Eta_o=120*pi\n", + "\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", + "I_m = sqrt(2*P_rad*R_rad)\n", + "\n", + "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", + "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Power density is \",P,\"Watt/m^2\"\n", + "\n", + "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.11,PAGE NO.-49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi \n", + "\n", + "# variable declaration\n", + "\n", + "dL = 75 #Length of dipole in m\n", + "f = 800 # Frequency in kHz\n", + "I_rms = 10 #rms Current in Amp\n", + "c = 3*(10**8) #Speed of light in m/s \n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_12.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_12.ipynb new file mode 100755 index 00000000..e025dd86 --- /dev/null +++ b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_12.ipynb @@ -0,0 +1,462 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Radiation" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.7.1, PAGE NO.-30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "# Variable declaration\n", + "\n", + "I_m = 15 #Current in Ampere\n", + "P_rad = 6 #Power radiated in kW\n", + "\n", + "#Calculation\n", + "\n", + "# By formula\n", + "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", + "\n", + "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", + "\n", + "#Result\n", + "\n", + "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The radiation resistance of Antenna is 53.33 kW\n" + ] + } + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.1,PAGE NO.-42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt \n", + "from sympy import Symbol\n", + "\n", + "# Variable Declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = Lm/25 # Length of dipole for Hertian dipole\n", + "H_phi = 5 # Magnetic field strength in uA/m\n", + "theta = pi/2\n", + "r = 2 # Distance in Km\n", + "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", + "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", + "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", + "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", + "\n", + "# Calculation\n", + "\n", + "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", + "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", + "I_rms = I_m/sqrt(2)\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", + "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", + "I_rms1 = I_m1/sqrt(2)\n", + "P_rad1 = (I_rms1**2)*R_rad\n", + "P_rad2 = (I_rms1**2)*R_rad1\n", + "\n", + "# Result\n", + "\n", + "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", + "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", + "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.2,PAGE NO.-43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt\n", + "\n", + "\n", + "\n", + "#variable declaration \n", + "\n", + "\n", + "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", + "theta = pi/2 #observation angle\n", + "r = 500*(10**3) #distance in metrs\n", + "f = 50*(10**6) #frequency in Hertz\n", + "c = 3*(10**8) #speed of light in m/sec\n", + "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", + "\n", + "\n", + "# calculation\n", + "lamda = c/f\n", + "L = lamda/2 #L is the length of half wave dipole\n", + "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", + "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", + "I_rms = I_m/sqrt(2)\n", + "P_avg = (R_rad*(I_m**2))/2\n", + "\n", + "#Result\n", + "\n", + "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", + "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", + "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.3,PAGE NO.-44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 100 #effective hieght in m\n", + "f = 60*(10**3) #frequency in Hertz\n", + "r = 100*(10**3) #Distance in m\n", + "c = 3*(10**8) #Speed of light in m/sec\n", + "P_rad = 100*(10**3) #radiated power\n", + "\n", + "# calculation\n", + "\n", + "lamda = c/f\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "I_rms = sqrt(P_rad/R_rad)\n", + "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", + "\n", + "# Results\n", + "\n", + "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.4,PAGE NO.-45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 113.3 #Effective length in metres\n", + "lamda = 18.8 #Wavelength in metres\n", + "I_rms = 725 #Base current in Ampere\n", + "r = 175 #Distance in metre\n", + "Eta_o = 120*pi\n", + "\n", + "#Calculation\n", + "\n", + "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", + "H = E/Eta_o\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "P_rad = (I_rms**2)*(R_rad)\n", + "\n", + "#Result\n", + "\n", + "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", + "print \"The H field is\",round(H,2),\"uA/m\"\n", + "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.5,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin\n", + "\n", + "# variable declaration\n", + "\n", + "lamda = 10*(10**(-2)) # In cm\n", + "r = 200*(10**(-2)) # In cm\n", + "theta = 90 # In Degrees\n", + "phi = 0 # In Degrees\n", + "IdL = 3*(10**(-4)) # current distribution in Am\n", + "\n", + "#Calculation\n", + "\n", + "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", + "\n", + "#Result\n", + "\n", + "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.6,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "dL = lamda/12\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.7,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "I_m = 100 # uniform current in ampere\n", + "Lm = Symbol('Lm') #Taking Lm as lamda\n", + "dL = Lm/16\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", + "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.8,PAGE NO.-47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# variable declaration\n", + "\n", + "f = 30*(10**6) #Frequency in Hz\n", + "c = 3*(10**8) #speed of light in m/s\n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "\n", + "#Result\n", + "\n", + "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.10,PAGE NO.-48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin,sqrt \n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = 0.01*Lm # Length of dipole \n", + "theta = 45\n", + "P_rad = 1 # Power radiated in kW\n", + "phi = 90\n", + "r = 1 # Distance in Km\n", + "Eta_o=120*pi\n", + "\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", + "I_m = sqrt(2*P_rad*R_rad)\n", + "\n", + "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", + "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Power density is \",P,\"Watt/m^2\"\n", + "\n", + "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.11,PAGE NO.-49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi \n", + "\n", + "# variable declaration\n", + "\n", + "dL = 75 #Length of dipole in m\n", + "f = 800 # Frequency in kHz\n", + "I_rms = 10 #rms Current in Amp\n", + "c = 3*(10**8) #Speed of light in m/s \n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_2.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_2.ipynb new file mode 100755 index 00000000..e025dd86 --- /dev/null +++ b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_2.ipynb @@ -0,0 +1,462 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Radiation" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.7.1, PAGE NO.-30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "# Variable declaration\n", + "\n", + "I_m = 15 #Current in Ampere\n", + "P_rad = 6 #Power radiated in kW\n", + "\n", + "#Calculation\n", + "\n", + "# By formula\n", + "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", + "\n", + "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", + "\n", + "#Result\n", + "\n", + "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The radiation resistance of Antenna is 53.33 kW\n" + ] + } + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.1,PAGE NO.-42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt \n", + "from sympy import Symbol\n", + "\n", + "# Variable Declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = Lm/25 # Length of dipole for Hertian dipole\n", + "H_phi = 5 # Magnetic field strength in uA/m\n", + "theta = pi/2\n", + "r = 2 # Distance in Km\n", + "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", + "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", + "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", + "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", + "\n", + "# Calculation\n", + "\n", + "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", + "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", + "I_rms = I_m/sqrt(2)\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", + "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", + "I_rms1 = I_m1/sqrt(2)\n", + "P_rad1 = (I_rms1**2)*R_rad\n", + "P_rad2 = (I_rms1**2)*R_rad1\n", + "\n", + "# Result\n", + "\n", + "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", + "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", + "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.2,PAGE NO.-43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt\n", + "\n", + "\n", + "\n", + "#variable declaration \n", + "\n", + "\n", + "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", + "theta = pi/2 #observation angle\n", + "r = 500*(10**3) #distance in metrs\n", + "f = 50*(10**6) #frequency in Hertz\n", + "c = 3*(10**8) #speed of light in m/sec\n", + "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", + "\n", + "\n", + "# calculation\n", + "lamda = c/f\n", + "L = lamda/2 #L is the length of half wave dipole\n", + "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", + "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", + "I_rms = I_m/sqrt(2)\n", + "P_avg = (R_rad*(I_m**2))/2\n", + "\n", + "#Result\n", + "\n", + "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", + "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", + "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.3,PAGE NO.-44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 100 #effective hieght in m\n", + "f = 60*(10**3) #frequency in Hertz\n", + "r = 100*(10**3) #Distance in m\n", + "c = 3*(10**8) #Speed of light in m/sec\n", + "P_rad = 100*(10**3) #radiated power\n", + "\n", + "# calculation\n", + "\n", + "lamda = c/f\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "I_rms = sqrt(P_rad/R_rad)\n", + "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", + "\n", + "# Results\n", + "\n", + "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.4,PAGE NO.-45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 113.3 #Effective length in metres\n", + "lamda = 18.8 #Wavelength in metres\n", + "I_rms = 725 #Base current in Ampere\n", + "r = 175 #Distance in metre\n", + "Eta_o = 120*pi\n", + "\n", + "#Calculation\n", + "\n", + "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", + "H = E/Eta_o\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "P_rad = (I_rms**2)*(R_rad)\n", + "\n", + "#Result\n", + "\n", + "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", + "print \"The H field is\",round(H,2),\"uA/m\"\n", + "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.5,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin\n", + "\n", + "# variable declaration\n", + "\n", + "lamda = 10*(10**(-2)) # In cm\n", + "r = 200*(10**(-2)) # In cm\n", + "theta = 90 # In Degrees\n", + "phi = 0 # In Degrees\n", + "IdL = 3*(10**(-4)) # current distribution in Am\n", + "\n", + "#Calculation\n", + "\n", + "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", + "\n", + "#Result\n", + "\n", + "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.6,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "dL = lamda/12\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.7,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "I_m = 100 # uniform current in ampere\n", + "Lm = Symbol('Lm') #Taking Lm as lamda\n", + "dL = Lm/16\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", + "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.8,PAGE NO.-47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# variable declaration\n", + "\n", + "f = 30*(10**6) #Frequency in Hz\n", + "c = 3*(10**8) #speed of light in m/s\n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "\n", + "#Result\n", + "\n", + "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.10,PAGE NO.-48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin,sqrt \n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = 0.01*Lm # Length of dipole \n", + "theta = 45\n", + "P_rad = 1 # Power radiated in kW\n", + "phi = 90\n", + "r = 1 # Distance in Km\n", + "Eta_o=120*pi\n", + "\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", + "I_m = sqrt(2*P_rad*R_rad)\n", + "\n", + "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", + "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Power density is \",P,\"Watt/m^2\"\n", + "\n", + "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.11,PAGE NO.-49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi \n", + "\n", + "# variable declaration\n", + "\n", + "dL = 75 #Length of dipole in m\n", + "f = 800 # Frequency in kHz\n", + "I_rms = 10 #rms Current in Amp\n", + "c = 3*(10**8) #Speed of light in m/s \n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_3.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_3.ipynb new file mode 100755 index 00000000..e025dd86 --- /dev/null +++ b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_3.ipynb @@ -0,0 +1,462 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Radiation" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.7.1, PAGE NO.-30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "# Variable declaration\n", + "\n", + "I_m = 15 #Current in Ampere\n", + "P_rad = 6 #Power radiated in kW\n", + "\n", + "#Calculation\n", + "\n", + "# By formula\n", + "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", + "\n", + "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", + "\n", + "#Result\n", + "\n", + "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The radiation resistance of Antenna is 53.33 kW\n" + ] + } + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.1,PAGE NO.-42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt \n", + "from sympy import Symbol\n", + "\n", + "# Variable Declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = Lm/25 # Length of dipole for Hertian dipole\n", + "H_phi = 5 # Magnetic field strength in uA/m\n", + "theta = pi/2\n", + "r = 2 # Distance in Km\n", + "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", + "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", + "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", + "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", + "\n", + "# Calculation\n", + "\n", + "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", + "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", + "I_rms = I_m/sqrt(2)\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", + "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", + "I_rms1 = I_m1/sqrt(2)\n", + "P_rad1 = (I_rms1**2)*R_rad\n", + "P_rad2 = (I_rms1**2)*R_rad1\n", + "\n", + "# Result\n", + "\n", + "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", + "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", + "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.2,PAGE NO.-43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt\n", + "\n", + "\n", + "\n", + "#variable declaration \n", + "\n", + "\n", + "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", + "theta = pi/2 #observation angle\n", + "r = 500*(10**3) #distance in metrs\n", + "f = 50*(10**6) #frequency in Hertz\n", + "c = 3*(10**8) #speed of light in m/sec\n", + "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", + "\n", + "\n", + "# calculation\n", + "lamda = c/f\n", + "L = lamda/2 #L is the length of half wave dipole\n", + "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", + "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", + "I_rms = I_m/sqrt(2)\n", + "P_avg = (R_rad*(I_m**2))/2\n", + "\n", + "#Result\n", + "\n", + "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", + "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", + "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.3,PAGE NO.-44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 100 #effective hieght in m\n", + "f = 60*(10**3) #frequency in Hertz\n", + "r = 100*(10**3) #Distance in m\n", + "c = 3*(10**8) #Speed of light in m/sec\n", + "P_rad = 100*(10**3) #radiated power\n", + "\n", + "# calculation\n", + "\n", + "lamda = c/f\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "I_rms = sqrt(P_rad/R_rad)\n", + "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", + "\n", + "# Results\n", + "\n", + "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.4,PAGE NO.-45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 113.3 #Effective length in metres\n", + "lamda = 18.8 #Wavelength in metres\n", + "I_rms = 725 #Base current in Ampere\n", + "r = 175 #Distance in metre\n", + "Eta_o = 120*pi\n", + "\n", + "#Calculation\n", + "\n", + "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", + "H = E/Eta_o\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "P_rad = (I_rms**2)*(R_rad)\n", + "\n", + "#Result\n", + "\n", + "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", + "print \"The H field is\",round(H,2),\"uA/m\"\n", + "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.5,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin\n", + "\n", + "# variable declaration\n", + "\n", + "lamda = 10*(10**(-2)) # In cm\n", + "r = 200*(10**(-2)) # In cm\n", + "theta = 90 # In Degrees\n", + "phi = 0 # In Degrees\n", + "IdL = 3*(10**(-4)) # current distribution in Am\n", + "\n", + "#Calculation\n", + "\n", + "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", + "\n", + "#Result\n", + "\n", + "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.6,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "dL = lamda/12\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.7,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "I_m = 100 # uniform current in ampere\n", + "Lm = Symbol('Lm') #Taking Lm as lamda\n", + "dL = Lm/16\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", + "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.8,PAGE NO.-47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# variable declaration\n", + "\n", + "f = 30*(10**6) #Frequency in Hz\n", + "c = 3*(10**8) #speed of light in m/s\n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "\n", + "#Result\n", + "\n", + "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.10,PAGE NO.-48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin,sqrt \n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = 0.01*Lm # Length of dipole \n", + "theta = 45\n", + "P_rad = 1 # Power radiated in kW\n", + "phi = 90\n", + "r = 1 # Distance in Km\n", + "Eta_o=120*pi\n", + "\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", + "I_m = sqrt(2*P_rad*R_rad)\n", + "\n", + "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", + "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Power density is \",P,\"Watt/m^2\"\n", + "\n", + "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.11,PAGE NO.-49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi \n", + "\n", + "# variable declaration\n", + "\n", + "dL = 75 #Length of dipole in m\n", + "f = 800 # Frequency in kHz\n", + "I_rms = 10 #rms Current in Amp\n", + "c = 3*(10**8) #Speed of light in m/s \n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_4.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_4.ipynb new file mode 100755 index 00000000..e025dd86 --- /dev/null +++ b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_4.ipynb @@ -0,0 +1,462 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Radiation" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.7.1, PAGE NO.-30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "# Variable declaration\n", + "\n", + "I_m = 15 #Current in Ampere\n", + "P_rad = 6 #Power radiated in kW\n", + "\n", + "#Calculation\n", + "\n", + "# By formula\n", + "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", + "\n", + "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", + "\n", + "#Result\n", + "\n", + "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The radiation resistance of Antenna is 53.33 kW\n" + ] + } + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.1,PAGE NO.-42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt \n", + "from sympy import Symbol\n", + "\n", + "# Variable Declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = Lm/25 # Length of dipole for Hertian dipole\n", + "H_phi = 5 # Magnetic field strength in uA/m\n", + "theta = pi/2\n", + "r = 2 # Distance in Km\n", + "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", + "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", + "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", + "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", + "\n", + "# Calculation\n", + "\n", + "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", + "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", + "I_rms = I_m/sqrt(2)\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", + "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", + "I_rms1 = I_m1/sqrt(2)\n", + "P_rad1 = (I_rms1**2)*R_rad\n", + "P_rad2 = (I_rms1**2)*R_rad1\n", + "\n", + "# Result\n", + "\n", + "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", + "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", + "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.2,PAGE NO.-43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt\n", + "\n", + "\n", + "\n", + "#variable declaration \n", + "\n", + "\n", + "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", + "theta = pi/2 #observation angle\n", + "r = 500*(10**3) #distance in metrs\n", + "f = 50*(10**6) #frequency in Hertz\n", + "c = 3*(10**8) #speed of light in m/sec\n", + "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", + "\n", + "\n", + "# calculation\n", + "lamda = c/f\n", + "L = lamda/2 #L is the length of half wave dipole\n", + "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", + "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", + "I_rms = I_m/sqrt(2)\n", + "P_avg = (R_rad*(I_m**2))/2\n", + "\n", + "#Result\n", + "\n", + "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", + "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", + "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.3,PAGE NO.-44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 100 #effective hieght in m\n", + "f = 60*(10**3) #frequency in Hertz\n", + "r = 100*(10**3) #Distance in m\n", + "c = 3*(10**8) #Speed of light in m/sec\n", + "P_rad = 100*(10**3) #radiated power\n", + "\n", + "# calculation\n", + "\n", + "lamda = c/f\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "I_rms = sqrt(P_rad/R_rad)\n", + "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", + "\n", + "# Results\n", + "\n", + "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.4,PAGE NO.-45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 113.3 #Effective length in metres\n", + "lamda = 18.8 #Wavelength in metres\n", + "I_rms = 725 #Base current in Ampere\n", + "r = 175 #Distance in metre\n", + "Eta_o = 120*pi\n", + "\n", + "#Calculation\n", + "\n", + "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", + "H = E/Eta_o\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "P_rad = (I_rms**2)*(R_rad)\n", + "\n", + "#Result\n", + "\n", + "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", + "print \"The H field is\",round(H,2),\"uA/m\"\n", + "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.5,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin\n", + "\n", + "# variable declaration\n", + "\n", + "lamda = 10*(10**(-2)) # In cm\n", + "r = 200*(10**(-2)) # In cm\n", + "theta = 90 # In Degrees\n", + "phi = 0 # In Degrees\n", + "IdL = 3*(10**(-4)) # current distribution in Am\n", + "\n", + "#Calculation\n", + "\n", + "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", + "\n", + "#Result\n", + "\n", + "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.6,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "dL = lamda/12\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.7,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "I_m = 100 # uniform current in ampere\n", + "Lm = Symbol('Lm') #Taking Lm as lamda\n", + "dL = Lm/16\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", + "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.8,PAGE NO.-47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# variable declaration\n", + "\n", + "f = 30*(10**6) #Frequency in Hz\n", + "c = 3*(10**8) #speed of light in m/s\n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "\n", + "#Result\n", + "\n", + "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.10,PAGE NO.-48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin,sqrt \n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = 0.01*Lm # Length of dipole \n", + "theta = 45\n", + "P_rad = 1 # Power radiated in kW\n", + "phi = 90\n", + "r = 1 # Distance in Km\n", + "Eta_o=120*pi\n", + "\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", + "I_m = sqrt(2*P_rad*R_rad)\n", + "\n", + "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", + "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Power density is \",P,\"Watt/m^2\"\n", + "\n", + "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.11,PAGE NO.-49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi \n", + "\n", + "# variable declaration\n", + "\n", + "dL = 75 #Length of dipole in m\n", + "f = 800 # Frequency in kHz\n", + "I_rms = 10 #rms Current in Amp\n", + "c = 3*(10**8) #Speed of light in m/s \n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_5.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_5.ipynb new file mode 100755 index 00000000..e025dd86 --- /dev/null +++ b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_5.ipynb @@ -0,0 +1,462 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Radiation" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.7.1, PAGE NO.-30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "# Variable declaration\n", + "\n", + "I_m = 15 #Current in Ampere\n", + "P_rad = 6 #Power radiated in kW\n", + "\n", + "#Calculation\n", + "\n", + "# By formula\n", + "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", + "\n", + "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", + "\n", + "#Result\n", + "\n", + "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The radiation resistance of Antenna is 53.33 kW\n" + ] + } + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.1,PAGE NO.-42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt \n", + "from sympy import Symbol\n", + "\n", + "# Variable Declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = Lm/25 # Length of dipole for Hertian dipole\n", + "H_phi = 5 # Magnetic field strength in uA/m\n", + "theta = pi/2\n", + "r = 2 # Distance in Km\n", + "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", + "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", + "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", + "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", + "\n", + "# Calculation\n", + "\n", + "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", + "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", + "I_rms = I_m/sqrt(2)\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", + "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", + "I_rms1 = I_m1/sqrt(2)\n", + "P_rad1 = (I_rms1**2)*R_rad\n", + "P_rad2 = (I_rms1**2)*R_rad1\n", + "\n", + "# Result\n", + "\n", + "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", + "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", + "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.2,PAGE NO.-43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt\n", + "\n", + "\n", + "\n", + "#variable declaration \n", + "\n", + "\n", + "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", + "theta = pi/2 #observation angle\n", + "r = 500*(10**3) #distance in metrs\n", + "f = 50*(10**6) #frequency in Hertz\n", + "c = 3*(10**8) #speed of light in m/sec\n", + "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", + "\n", + "\n", + "# calculation\n", + "lamda = c/f\n", + "L = lamda/2 #L is the length of half wave dipole\n", + "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", + "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", + "I_rms = I_m/sqrt(2)\n", + "P_avg = (R_rad*(I_m**2))/2\n", + "\n", + "#Result\n", + "\n", + "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", + "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", + "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.3,PAGE NO.-44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 100 #effective hieght in m\n", + "f = 60*(10**3) #frequency in Hertz\n", + "r = 100*(10**3) #Distance in m\n", + "c = 3*(10**8) #Speed of light in m/sec\n", + "P_rad = 100*(10**3) #radiated power\n", + "\n", + "# calculation\n", + "\n", + "lamda = c/f\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "I_rms = sqrt(P_rad/R_rad)\n", + "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", + "\n", + "# Results\n", + "\n", + "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.4,PAGE NO.-45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 113.3 #Effective length in metres\n", + "lamda = 18.8 #Wavelength in metres\n", + "I_rms = 725 #Base current in Ampere\n", + "r = 175 #Distance in metre\n", + "Eta_o = 120*pi\n", + "\n", + "#Calculation\n", + "\n", + "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", + "H = E/Eta_o\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "P_rad = (I_rms**2)*(R_rad)\n", + "\n", + "#Result\n", + "\n", + "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", + "print \"The H field is\",round(H,2),\"uA/m\"\n", + "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.5,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin\n", + "\n", + "# variable declaration\n", + "\n", + "lamda = 10*(10**(-2)) # In cm\n", + "r = 200*(10**(-2)) # In cm\n", + "theta = 90 # In Degrees\n", + "phi = 0 # In Degrees\n", + "IdL = 3*(10**(-4)) # current distribution in Am\n", + "\n", + "#Calculation\n", + "\n", + "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", + "\n", + "#Result\n", + "\n", + "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.6,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "dL = lamda/12\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.7,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "I_m = 100 # uniform current in ampere\n", + "Lm = Symbol('Lm') #Taking Lm as lamda\n", + "dL = Lm/16\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", + "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.8,PAGE NO.-47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# variable declaration\n", + "\n", + "f = 30*(10**6) #Frequency in Hz\n", + "c = 3*(10**8) #speed of light in m/s\n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "\n", + "#Result\n", + "\n", + "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.10,PAGE NO.-48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin,sqrt \n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = 0.01*Lm # Length of dipole \n", + "theta = 45\n", + "P_rad = 1 # Power radiated in kW\n", + "phi = 90\n", + "r = 1 # Distance in Km\n", + "Eta_o=120*pi\n", + "\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", + "I_m = sqrt(2*P_rad*R_rad)\n", + "\n", + "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", + "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Power density is \",P,\"Watt/m^2\"\n", + "\n", + "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.11,PAGE NO.-49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi \n", + "\n", + "# variable declaration\n", + "\n", + "dL = 75 #Length of dipole in m\n", + "f = 800 # Frequency in kHz\n", + "I_rms = 10 #rms Current in Amp\n", + "c = 3*(10**8) #Speed of light in m/s \n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_6.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_6.ipynb new file mode 100755 index 00000000..e025dd86 --- /dev/null +++ b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_6.ipynb @@ -0,0 +1,462 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Radiation" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.7.1, PAGE NO.-30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "# Variable declaration\n", + "\n", + "I_m = 15 #Current in Ampere\n", + "P_rad = 6 #Power radiated in kW\n", + "\n", + "#Calculation\n", + "\n", + "# By formula\n", + "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", + "\n", + "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", + "\n", + "#Result\n", + "\n", + "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The radiation resistance of Antenna is 53.33 kW\n" + ] + } + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.1,PAGE NO.-42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt \n", + "from sympy import Symbol\n", + "\n", + "# Variable Declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = Lm/25 # Length of dipole for Hertian dipole\n", + "H_phi = 5 # Magnetic field strength in uA/m\n", + "theta = pi/2\n", + "r = 2 # Distance in Km\n", + "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", + "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", + "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", + "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", + "\n", + "# Calculation\n", + "\n", + "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", + "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", + "I_rms = I_m/sqrt(2)\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", + "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", + "I_rms1 = I_m1/sqrt(2)\n", + "P_rad1 = (I_rms1**2)*R_rad\n", + "P_rad2 = (I_rms1**2)*R_rad1\n", + "\n", + "# Result\n", + "\n", + "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", + "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", + "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.2,PAGE NO.-43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt\n", + "\n", + "\n", + "\n", + "#variable declaration \n", + "\n", + "\n", + "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", + "theta = pi/2 #observation angle\n", + "r = 500*(10**3) #distance in metrs\n", + "f = 50*(10**6) #frequency in Hertz\n", + "c = 3*(10**8) #speed of light in m/sec\n", + "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", + "\n", + "\n", + "# calculation\n", + "lamda = c/f\n", + "L = lamda/2 #L is the length of half wave dipole\n", + "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", + "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", + "I_rms = I_m/sqrt(2)\n", + "P_avg = (R_rad*(I_m**2))/2\n", + "\n", + "#Result\n", + "\n", + "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", + "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", + "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.3,PAGE NO.-44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 100 #effective hieght in m\n", + "f = 60*(10**3) #frequency in Hertz\n", + "r = 100*(10**3) #Distance in m\n", + "c = 3*(10**8) #Speed of light in m/sec\n", + "P_rad = 100*(10**3) #radiated power\n", + "\n", + "# calculation\n", + "\n", + "lamda = c/f\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "I_rms = sqrt(P_rad/R_rad)\n", + "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", + "\n", + "# Results\n", + "\n", + "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.4,PAGE NO.-45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 113.3 #Effective length in metres\n", + "lamda = 18.8 #Wavelength in metres\n", + "I_rms = 725 #Base current in Ampere\n", + "r = 175 #Distance in metre\n", + "Eta_o = 120*pi\n", + "\n", + "#Calculation\n", + "\n", + "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", + "H = E/Eta_o\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "P_rad = (I_rms**2)*(R_rad)\n", + "\n", + "#Result\n", + "\n", + "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", + "print \"The H field is\",round(H,2),\"uA/m\"\n", + "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.5,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin\n", + "\n", + "# variable declaration\n", + "\n", + "lamda = 10*(10**(-2)) # In cm\n", + "r = 200*(10**(-2)) # In cm\n", + "theta = 90 # In Degrees\n", + "phi = 0 # In Degrees\n", + "IdL = 3*(10**(-4)) # current distribution in Am\n", + "\n", + "#Calculation\n", + "\n", + "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", + "\n", + "#Result\n", + "\n", + "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.6,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "dL = lamda/12\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.7,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "I_m = 100 # uniform current in ampere\n", + "Lm = Symbol('Lm') #Taking Lm as lamda\n", + "dL = Lm/16\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", + "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.8,PAGE NO.-47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# variable declaration\n", + "\n", + "f = 30*(10**6) #Frequency in Hz\n", + "c = 3*(10**8) #speed of light in m/s\n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "\n", + "#Result\n", + "\n", + "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.10,PAGE NO.-48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin,sqrt \n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = 0.01*Lm # Length of dipole \n", + "theta = 45\n", + "P_rad = 1 # Power radiated in kW\n", + "phi = 90\n", + "r = 1 # Distance in Km\n", + "Eta_o=120*pi\n", + "\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", + "I_m = sqrt(2*P_rad*R_rad)\n", + "\n", + "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", + "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Power density is \",P,\"Watt/m^2\"\n", + "\n", + "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.11,PAGE NO.-49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi \n", + "\n", + "# variable declaration\n", + "\n", + "dL = 75 #Length of dipole in m\n", + "f = 800 # Frequency in kHz\n", + "I_rms = 10 #rms Current in Amp\n", + "c = 3*(10**8) #Speed of light in m/s \n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_7.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_7.ipynb new file mode 100755 index 00000000..e025dd86 --- /dev/null +++ b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_7.ipynb @@ -0,0 +1,462 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Radiation" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.7.1, PAGE NO.-30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "# Variable declaration\n", + "\n", + "I_m = 15 #Current in Ampere\n", + "P_rad = 6 #Power radiated in kW\n", + "\n", + "#Calculation\n", + "\n", + "# By formula\n", + "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", + "\n", + "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", + "\n", + "#Result\n", + "\n", + "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The radiation resistance of Antenna is 53.33 kW\n" + ] + } + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.1,PAGE NO.-42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt \n", + "from sympy import Symbol\n", + "\n", + "# Variable Declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = Lm/25 # Length of dipole for Hertian dipole\n", + "H_phi = 5 # Magnetic field strength in uA/m\n", + "theta = pi/2\n", + "r = 2 # Distance in Km\n", + "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", + "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", + "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", + "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", + "\n", + "# Calculation\n", + "\n", + "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", + "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", + "I_rms = I_m/sqrt(2)\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", + "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", + "I_rms1 = I_m1/sqrt(2)\n", + "P_rad1 = (I_rms1**2)*R_rad\n", + "P_rad2 = (I_rms1**2)*R_rad1\n", + "\n", + "# Result\n", + "\n", + "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", + "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", + "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.2,PAGE NO.-43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt\n", + "\n", + "\n", + "\n", + "#variable declaration \n", + "\n", + "\n", + "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", + "theta = pi/2 #observation angle\n", + "r = 500*(10**3) #distance in metrs\n", + "f = 50*(10**6) #frequency in Hertz\n", + "c = 3*(10**8) #speed of light in m/sec\n", + "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", + "\n", + "\n", + "# calculation\n", + "lamda = c/f\n", + "L = lamda/2 #L is the length of half wave dipole\n", + "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", + "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", + "I_rms = I_m/sqrt(2)\n", + "P_avg = (R_rad*(I_m**2))/2\n", + "\n", + "#Result\n", + "\n", + "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", + "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", + "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.3,PAGE NO.-44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 100 #effective hieght in m\n", + "f = 60*(10**3) #frequency in Hertz\n", + "r = 100*(10**3) #Distance in m\n", + "c = 3*(10**8) #Speed of light in m/sec\n", + "P_rad = 100*(10**3) #radiated power\n", + "\n", + "# calculation\n", + "\n", + "lamda = c/f\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "I_rms = sqrt(P_rad/R_rad)\n", + "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", + "\n", + "# Results\n", + "\n", + "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.4,PAGE NO.-45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 113.3 #Effective length in metres\n", + "lamda = 18.8 #Wavelength in metres\n", + "I_rms = 725 #Base current in Ampere\n", + "r = 175 #Distance in metre\n", + "Eta_o = 120*pi\n", + "\n", + "#Calculation\n", + "\n", + "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", + "H = E/Eta_o\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "P_rad = (I_rms**2)*(R_rad)\n", + "\n", + "#Result\n", + "\n", + "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", + "print \"The H field is\",round(H,2),\"uA/m\"\n", + "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.5,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin\n", + "\n", + "# variable declaration\n", + "\n", + "lamda = 10*(10**(-2)) # In cm\n", + "r = 200*(10**(-2)) # In cm\n", + "theta = 90 # In Degrees\n", + "phi = 0 # In Degrees\n", + "IdL = 3*(10**(-4)) # current distribution in Am\n", + "\n", + "#Calculation\n", + "\n", + "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", + "\n", + "#Result\n", + "\n", + "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.6,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "dL = lamda/12\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.7,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "I_m = 100 # uniform current in ampere\n", + "Lm = Symbol('Lm') #Taking Lm as lamda\n", + "dL = Lm/16\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", + "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.8,PAGE NO.-47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# variable declaration\n", + "\n", + "f = 30*(10**6) #Frequency in Hz\n", + "c = 3*(10**8) #speed of light in m/s\n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "\n", + "#Result\n", + "\n", + "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.10,PAGE NO.-48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin,sqrt \n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = 0.01*Lm # Length of dipole \n", + "theta = 45\n", + "P_rad = 1 # Power radiated in kW\n", + "phi = 90\n", + "r = 1 # Distance in Km\n", + "Eta_o=120*pi\n", + "\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", + "I_m = sqrt(2*P_rad*R_rad)\n", + "\n", + "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", + "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Power density is \",P,\"Watt/m^2\"\n", + "\n", + "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.11,PAGE NO.-49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi \n", + "\n", + "# variable declaration\n", + "\n", + "dL = 75 #Length of dipole in m\n", + "f = 800 # Frequency in kHz\n", + "I_rms = 10 #rms Current in Amp\n", + "c = 3*(10**8) #Speed of light in m/s \n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_8.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_8.ipynb new file mode 100755 index 00000000..e025dd86 --- /dev/null +++ b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_8.ipynb @@ -0,0 +1,462 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Radiation" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.7.1, PAGE NO.-30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "# Variable declaration\n", + "\n", + "I_m = 15 #Current in Ampere\n", + "P_rad = 6 #Power radiated in kW\n", + "\n", + "#Calculation\n", + "\n", + "# By formula\n", + "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", + "\n", + "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", + "\n", + "#Result\n", + "\n", + "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The radiation resistance of Antenna is 53.33 kW\n" + ] + } + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.1,PAGE NO.-42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt \n", + "from sympy import Symbol\n", + "\n", + "# Variable Declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = Lm/25 # Length of dipole for Hertian dipole\n", + "H_phi = 5 # Magnetic field strength in uA/m\n", + "theta = pi/2\n", + "r = 2 # Distance in Km\n", + "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", + "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", + "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", + "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", + "\n", + "# Calculation\n", + "\n", + "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", + "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", + "I_rms = I_m/sqrt(2)\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", + "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", + "I_rms1 = I_m1/sqrt(2)\n", + "P_rad1 = (I_rms1**2)*R_rad\n", + "P_rad2 = (I_rms1**2)*R_rad1\n", + "\n", + "# Result\n", + "\n", + "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", + "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", + "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.2,PAGE NO.-43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt\n", + "\n", + "\n", + "\n", + "#variable declaration \n", + "\n", + "\n", + "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", + "theta = pi/2 #observation angle\n", + "r = 500*(10**3) #distance in metrs\n", + "f = 50*(10**6) #frequency in Hertz\n", + "c = 3*(10**8) #speed of light in m/sec\n", + "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", + "\n", + "\n", + "# calculation\n", + "lamda = c/f\n", + "L = lamda/2 #L is the length of half wave dipole\n", + "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", + "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", + "I_rms = I_m/sqrt(2)\n", + "P_avg = (R_rad*(I_m**2))/2\n", + "\n", + "#Result\n", + "\n", + "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", + "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", + "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.3,PAGE NO.-44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 100 #effective hieght in m\n", + "f = 60*(10**3) #frequency in Hertz\n", + "r = 100*(10**3) #Distance in m\n", + "c = 3*(10**8) #Speed of light in m/sec\n", + "P_rad = 100*(10**3) #radiated power\n", + "\n", + "# calculation\n", + "\n", + "lamda = c/f\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "I_rms = sqrt(P_rad/R_rad)\n", + "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", + "\n", + "# Results\n", + "\n", + "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.4,PAGE NO.-45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 113.3 #Effective length in metres\n", + "lamda = 18.8 #Wavelength in metres\n", + "I_rms = 725 #Base current in Ampere\n", + "r = 175 #Distance in metre\n", + "Eta_o = 120*pi\n", + "\n", + "#Calculation\n", + "\n", + "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", + "H = E/Eta_o\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "P_rad = (I_rms**2)*(R_rad)\n", + "\n", + "#Result\n", + "\n", + "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", + "print \"The H field is\",round(H,2),\"uA/m\"\n", + "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.5,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin\n", + "\n", + "# variable declaration\n", + "\n", + "lamda = 10*(10**(-2)) # In cm\n", + "r = 200*(10**(-2)) # In cm\n", + "theta = 90 # In Degrees\n", + "phi = 0 # In Degrees\n", + "IdL = 3*(10**(-4)) # current distribution in Am\n", + "\n", + "#Calculation\n", + "\n", + "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", + "\n", + "#Result\n", + "\n", + "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.6,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "dL = lamda/12\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.7,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "I_m = 100 # uniform current in ampere\n", + "Lm = Symbol('Lm') #Taking Lm as lamda\n", + "dL = Lm/16\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", + "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.8,PAGE NO.-47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# variable declaration\n", + "\n", + "f = 30*(10**6) #Frequency in Hz\n", + "c = 3*(10**8) #speed of light in m/s\n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "\n", + "#Result\n", + "\n", + "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.10,PAGE NO.-48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin,sqrt \n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = 0.01*Lm # Length of dipole \n", + "theta = 45\n", + "P_rad = 1 # Power radiated in kW\n", + "phi = 90\n", + "r = 1 # Distance in Km\n", + "Eta_o=120*pi\n", + "\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", + "I_m = sqrt(2*P_rad*R_rad)\n", + "\n", + "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", + "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Power density is \",P,\"Watt/m^2\"\n", + "\n", + "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.11,PAGE NO.-49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi \n", + "\n", + "# variable declaration\n", + "\n", + "dL = 75 #Length of dipole in m\n", + "f = 800 # Frequency in kHz\n", + "I_rms = 10 #rms Current in Amp\n", + "c = 3*(10**8) #Speed of light in m/s \n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_9.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_9.ipynb new file mode 100755 index 00000000..e025dd86 --- /dev/null +++ b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_9.ipynb @@ -0,0 +1,462 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Radiation" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.7.1, PAGE NO.-30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "# Variable declaration\n", + "\n", + "I_m = 15 #Current in Ampere\n", + "P_rad = 6 #Power radiated in kW\n", + "\n", + "#Calculation\n", + "\n", + "# By formula\n", + "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", + "\n", + "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", + "\n", + "#Result\n", + "\n", + "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The radiation resistance of Antenna is 53.33 kW\n" + ] + } + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.1,PAGE NO.-42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt \n", + "from sympy import Symbol\n", + "\n", + "# Variable Declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = Lm/25 # Length of dipole for Hertian dipole\n", + "H_phi = 5 # Magnetic field strength in uA/m\n", + "theta = pi/2\n", + "r = 2 # Distance in Km\n", + "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", + "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", + "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", + "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", + "\n", + "# Calculation\n", + "\n", + "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", + "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", + "I_rms = I_m/sqrt(2)\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", + "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", + "I_rms1 = I_m1/sqrt(2)\n", + "P_rad1 = (I_rms1**2)*R_rad\n", + "P_rad2 = (I_rms1**2)*R_rad1\n", + "\n", + "# Result\n", + "\n", + "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", + "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", + "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.2,PAGE NO.-43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sin,cos,pi,sqrt\n", + "\n", + "\n", + "\n", + "#variable declaration \n", + "\n", + "\n", + "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", + "theta = pi/2 #observation angle\n", + "r = 500*(10**3) #distance in metrs\n", + "f = 50*(10**6) #frequency in Hertz\n", + "c = 3*(10**8) #speed of light in m/sec\n", + "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", + "\n", + "\n", + "# calculation\n", + "lamda = c/f\n", + "L = lamda/2 #L is the length of half wave dipole\n", + "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", + "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", + "I_rms = I_m/sqrt(2)\n", + "P_avg = (R_rad*(I_m**2))/2\n", + "\n", + "#Result\n", + "\n", + "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", + "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", + "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.3,PAGE NO.-44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 100 #effective hieght in m\n", + "f = 60*(10**3) #frequency in Hertz\n", + "r = 100*(10**3) #Distance in m\n", + "c = 3*(10**8) #Speed of light in m/sec\n", + "P_rad = 100*(10**3) #radiated power\n", + "\n", + "# calculation\n", + "\n", + "lamda = c/f\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "I_rms = sqrt(P_rad/R_rad)\n", + "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", + "\n", + "# Results\n", + "\n", + "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.4,PAGE NO.-45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "l_eff = 113.3 #Effective length in metres\n", + "lamda = 18.8 #Wavelength in metres\n", + "I_rms = 725 #Base current in Ampere\n", + "r = 175 #Distance in metre\n", + "Eta_o = 120*pi\n", + "\n", + "#Calculation\n", + "\n", + "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", + "H = E/Eta_o\n", + "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", + "P_rad = (I_rms**2)*(R_rad)\n", + "\n", + "#Result\n", + "\n", + "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", + "print \"The H field is\",round(H,2),\"uA/m\"\n", + "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.5,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin\n", + "\n", + "# variable declaration\n", + "\n", + "lamda = 10*(10**(-2)) # In cm\n", + "r = 200*(10**(-2)) # In cm\n", + "theta = 90 # In Degrees\n", + "phi = 0 # In Degrees\n", + "IdL = 3*(10**(-4)) # current distribution in Am\n", + "\n", + "#Calculation\n", + "\n", + "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", + "\n", + "#Result\n", + "\n", + "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.6,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi\n", + "\n", + "# variable declaration\n", + "\n", + "dL = lamda/12\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.7,PAGE NO.-46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "I_m = 100 # uniform current in ampere\n", + "Lm = Symbol('Lm') #Taking Lm as lamda\n", + "dL = Lm/16\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", + "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.8,PAGE NO.-47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# variable declaration\n", + "\n", + "f = 30*(10**6) #Frequency in Hz\n", + "c = 3*(10**8) #speed of light in m/s\n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "\n", + "#Result\n", + "\n", + "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.10,PAGE NO.-48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi,sin,sqrt \n", + "from sympy import Symbol\n", + "# variable declaration\n", + "\n", + "Lm = Symbol('Lm') # Taking lamda as Lm\n", + "dL = 0.01*Lm # Length of dipole \n", + "theta = 45\n", + "P_rad = 1 # Power radiated in kW\n", + "phi = 90\n", + "r = 1 # Distance in Km\n", + "Eta_o=120*pi\n", + "\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", + "I_m = sqrt(2*P_rad*R_rad)\n", + "\n", + "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", + "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Power density is \",P,\"Watt/m^2\"\n", + "\n", + "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9.11,PAGE NO.-49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import pi \n", + "\n", + "# variable declaration\n", + "\n", + "dL = 75 #Length of dipole in m\n", + "f = 800 # Frequency in kHz\n", + "I_rms = 10 #rms Current in Amp\n", + "c = 3*(10**8) #Speed of light in m/s \n", + "\n", + "#Calculation\n", + "\n", + "lamda = c/f\n", + "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", + "\n", + "#Result\n", + "\n", + "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI.ipynb deleted file mode 100755 index e025dd86..00000000 --- a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI.ipynb +++ /dev/null @@ -1,462 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Radiation" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.7.1, PAGE NO.-30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "I_m = 15 #Current in Ampere\n", - "P_rad = 6 #Power radiated in kW\n", - "\n", - "#Calculation\n", - "\n", - "# By formula\n", - "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", - "\n", - "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", - "\n", - "#Result\n", - "\n", - "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The radiation resistance of Antenna is 53.33 kW\n" - ] - } - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.1,PAGE NO.-42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt \n", - "from sympy import Symbol\n", - "\n", - "# Variable Declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = Lm/25 # Length of dipole for Hertian dipole\n", - "H_phi = 5 # Magnetic field strength in uA/m\n", - "theta = pi/2\n", - "r = 2 # Distance in Km\n", - "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", - "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", - "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", - "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", - "\n", - "# Calculation\n", - "\n", - "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", - "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", - "I_rms = I_m/sqrt(2)\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", - "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", - "I_rms1 = I_m1/sqrt(2)\n", - "P_rad1 = (I_rms1**2)*R_rad\n", - "P_rad2 = (I_rms1**2)*R_rad1\n", - "\n", - "# Result\n", - "\n", - "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", - "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", - "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.2,PAGE NO.-43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt\n", - "\n", - "\n", - "\n", - "#variable declaration \n", - "\n", - "\n", - "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", - "theta = pi/2 #observation angle\n", - "r = 500*(10**3) #distance in metrs\n", - "f = 50*(10**6) #frequency in Hertz\n", - "c = 3*(10**8) #speed of light in m/sec\n", - "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", - "\n", - "\n", - "# calculation\n", - "lamda = c/f\n", - "L = lamda/2 #L is the length of half wave dipole\n", - "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", - "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", - "I_rms = I_m/sqrt(2)\n", - "P_avg = (R_rad*(I_m**2))/2\n", - "\n", - "#Result\n", - "\n", - "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", - "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", - "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.3,PAGE NO.-44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 100 #effective hieght in m\n", - "f = 60*(10**3) #frequency in Hertz\n", - "r = 100*(10**3) #Distance in m\n", - "c = 3*(10**8) #Speed of light in m/sec\n", - "P_rad = 100*(10**3) #radiated power\n", - "\n", - "# calculation\n", - "\n", - "lamda = c/f\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "I_rms = sqrt(P_rad/R_rad)\n", - "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", - "\n", - "# Results\n", - "\n", - "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.4,PAGE NO.-45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 113.3 #Effective length in metres\n", - "lamda = 18.8 #Wavelength in metres\n", - "I_rms = 725 #Base current in Ampere\n", - "r = 175 #Distance in metre\n", - "Eta_o = 120*pi\n", - "\n", - "#Calculation\n", - "\n", - "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", - "H = E/Eta_o\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "P_rad = (I_rms**2)*(R_rad)\n", - "\n", - "#Result\n", - "\n", - "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", - "print \"The H field is\",round(H,2),\"uA/m\"\n", - "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.5,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin\n", - "\n", - "# variable declaration\n", - "\n", - "lamda = 10*(10**(-2)) # In cm\n", - "r = 200*(10**(-2)) # In cm\n", - "theta = 90 # In Degrees\n", - "phi = 0 # In Degrees\n", - "IdL = 3*(10**(-4)) # current distribution in Am\n", - "\n", - "#Calculation\n", - "\n", - "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", - "\n", - "#Result\n", - "\n", - "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.6,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "dL = lamda/12\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.7,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "I_m = 100 # uniform current in ampere\n", - "Lm = Symbol('Lm') #Taking Lm as lamda\n", - "dL = Lm/16\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", - "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.8,PAGE NO.-47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# variable declaration\n", - "\n", - "f = 30*(10**6) #Frequency in Hz\n", - "c = 3*(10**8) #speed of light in m/s\n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "\n", - "#Result\n", - "\n", - "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.10,PAGE NO.-48" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin,sqrt \n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = 0.01*Lm # Length of dipole \n", - "theta = 45\n", - "P_rad = 1 # Power radiated in kW\n", - "phi = 90\n", - "r = 1 # Distance in Km\n", - "Eta_o=120*pi\n", - "\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", - "I_m = sqrt(2*P_rad*R_rad)\n", - "\n", - "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", - "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Power density is \",P,\"Watt/m^2\"\n", - "\n", - "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.11,PAGE NO.-49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi \n", - "\n", - "# variable declaration\n", - "\n", - "dL = 75 #Length of dipole in m\n", - "f = 800 # Frequency in kHz\n", - "I_rms = 10 #rms Current in Amp\n", - "c = 3*(10**8) #Speed of light in m/s \n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_1.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_1.ipynb deleted file mode 100755 index e025dd86..00000000 --- a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_1.ipynb +++ /dev/null @@ -1,462 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Radiation" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.7.1, PAGE NO.-30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "I_m = 15 #Current in Ampere\n", - "P_rad = 6 #Power radiated in kW\n", - "\n", - "#Calculation\n", - "\n", - "# By formula\n", - "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", - "\n", - "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", - "\n", - "#Result\n", - "\n", - "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The radiation resistance of Antenna is 53.33 kW\n" - ] - } - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.1,PAGE NO.-42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt \n", - "from sympy import Symbol\n", - "\n", - "# Variable Declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = Lm/25 # Length of dipole for Hertian dipole\n", - "H_phi = 5 # Magnetic field strength in uA/m\n", - "theta = pi/2\n", - "r = 2 # Distance in Km\n", - "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", - "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", - "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", - "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", - "\n", - "# Calculation\n", - "\n", - "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", - "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", - "I_rms = I_m/sqrt(2)\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", - "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", - "I_rms1 = I_m1/sqrt(2)\n", - "P_rad1 = (I_rms1**2)*R_rad\n", - "P_rad2 = (I_rms1**2)*R_rad1\n", - "\n", - "# Result\n", - "\n", - "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", - "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", - "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.2,PAGE NO.-43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt\n", - "\n", - "\n", - "\n", - "#variable declaration \n", - "\n", - "\n", - "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", - "theta = pi/2 #observation angle\n", - "r = 500*(10**3) #distance in metrs\n", - "f = 50*(10**6) #frequency in Hertz\n", - "c = 3*(10**8) #speed of light in m/sec\n", - "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", - "\n", - "\n", - "# calculation\n", - "lamda = c/f\n", - "L = lamda/2 #L is the length of half wave dipole\n", - "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", - "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", - "I_rms = I_m/sqrt(2)\n", - "P_avg = (R_rad*(I_m**2))/2\n", - "\n", - "#Result\n", - "\n", - "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", - "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", - "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.3,PAGE NO.-44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 100 #effective hieght in m\n", - "f = 60*(10**3) #frequency in Hertz\n", - "r = 100*(10**3) #Distance in m\n", - "c = 3*(10**8) #Speed of light in m/sec\n", - "P_rad = 100*(10**3) #radiated power\n", - "\n", - "# calculation\n", - "\n", - "lamda = c/f\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "I_rms = sqrt(P_rad/R_rad)\n", - "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", - "\n", - "# Results\n", - "\n", - "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.4,PAGE NO.-45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 113.3 #Effective length in metres\n", - "lamda = 18.8 #Wavelength in metres\n", - "I_rms = 725 #Base current in Ampere\n", - "r = 175 #Distance in metre\n", - "Eta_o = 120*pi\n", - "\n", - "#Calculation\n", - "\n", - "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", - "H = E/Eta_o\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "P_rad = (I_rms**2)*(R_rad)\n", - "\n", - "#Result\n", - "\n", - "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", - "print \"The H field is\",round(H,2),\"uA/m\"\n", - "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.5,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin\n", - "\n", - "# variable declaration\n", - "\n", - "lamda = 10*(10**(-2)) # In cm\n", - "r = 200*(10**(-2)) # In cm\n", - "theta = 90 # In Degrees\n", - "phi = 0 # In Degrees\n", - "IdL = 3*(10**(-4)) # current distribution in Am\n", - "\n", - "#Calculation\n", - "\n", - "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", - "\n", - "#Result\n", - "\n", - "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.6,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "dL = lamda/12\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.7,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "I_m = 100 # uniform current in ampere\n", - "Lm = Symbol('Lm') #Taking Lm as lamda\n", - "dL = Lm/16\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", - "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.8,PAGE NO.-47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# variable declaration\n", - "\n", - "f = 30*(10**6) #Frequency in Hz\n", - "c = 3*(10**8) #speed of light in m/s\n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "\n", - "#Result\n", - "\n", - "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.10,PAGE NO.-48" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin,sqrt \n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = 0.01*Lm # Length of dipole \n", - "theta = 45\n", - "P_rad = 1 # Power radiated in kW\n", - "phi = 90\n", - "r = 1 # Distance in Km\n", - "Eta_o=120*pi\n", - "\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", - "I_m = sqrt(2*P_rad*R_rad)\n", - "\n", - "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", - "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Power density is \",P,\"Watt/m^2\"\n", - "\n", - "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.11,PAGE NO.-49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi \n", - "\n", - "# variable declaration\n", - "\n", - "dL = 75 #Length of dipole in m\n", - "f = 800 # Frequency in kHz\n", - "I_rms = 10 #rms Current in Amp\n", - "c = 3*(10**8) #Speed of light in m/s \n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_10.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_10.ipynb deleted file mode 100755 index e025dd86..00000000 --- a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_10.ipynb +++ /dev/null @@ -1,462 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Radiation" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.7.1, PAGE NO.-30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "I_m = 15 #Current in Ampere\n", - "P_rad = 6 #Power radiated in kW\n", - "\n", - "#Calculation\n", - "\n", - "# By formula\n", - "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", - "\n", - "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", - "\n", - "#Result\n", - "\n", - "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The radiation resistance of Antenna is 53.33 kW\n" - ] - } - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.1,PAGE NO.-42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt \n", - "from sympy import Symbol\n", - "\n", - "# Variable Declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = Lm/25 # Length of dipole for Hertian dipole\n", - "H_phi = 5 # Magnetic field strength in uA/m\n", - "theta = pi/2\n", - "r = 2 # Distance in Km\n", - "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", - "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", - "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", - "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", - "\n", - "# Calculation\n", - "\n", - "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", - "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", - "I_rms = I_m/sqrt(2)\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", - "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", - "I_rms1 = I_m1/sqrt(2)\n", - "P_rad1 = (I_rms1**2)*R_rad\n", - "P_rad2 = (I_rms1**2)*R_rad1\n", - "\n", - "# Result\n", - "\n", - "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", - "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", - "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.2,PAGE NO.-43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt\n", - "\n", - "\n", - "\n", - "#variable declaration \n", - "\n", - "\n", - "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", - "theta = pi/2 #observation angle\n", - "r = 500*(10**3) #distance in metrs\n", - "f = 50*(10**6) #frequency in Hertz\n", - "c = 3*(10**8) #speed of light in m/sec\n", - "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", - "\n", - "\n", - "# calculation\n", - "lamda = c/f\n", - "L = lamda/2 #L is the length of half wave dipole\n", - "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", - "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", - "I_rms = I_m/sqrt(2)\n", - "P_avg = (R_rad*(I_m**2))/2\n", - "\n", - "#Result\n", - "\n", - "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", - "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", - "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.3,PAGE NO.-44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 100 #effective hieght in m\n", - "f = 60*(10**3) #frequency in Hertz\n", - "r = 100*(10**3) #Distance in m\n", - "c = 3*(10**8) #Speed of light in m/sec\n", - "P_rad = 100*(10**3) #radiated power\n", - "\n", - "# calculation\n", - "\n", - "lamda = c/f\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "I_rms = sqrt(P_rad/R_rad)\n", - "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", - "\n", - "# Results\n", - "\n", - "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.4,PAGE NO.-45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 113.3 #Effective length in metres\n", - "lamda = 18.8 #Wavelength in metres\n", - "I_rms = 725 #Base current in Ampere\n", - "r = 175 #Distance in metre\n", - "Eta_o = 120*pi\n", - "\n", - "#Calculation\n", - "\n", - "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", - "H = E/Eta_o\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "P_rad = (I_rms**2)*(R_rad)\n", - "\n", - "#Result\n", - "\n", - "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", - "print \"The H field is\",round(H,2),\"uA/m\"\n", - "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.5,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin\n", - "\n", - "# variable declaration\n", - "\n", - "lamda = 10*(10**(-2)) # In cm\n", - "r = 200*(10**(-2)) # In cm\n", - "theta = 90 # In Degrees\n", - "phi = 0 # In Degrees\n", - "IdL = 3*(10**(-4)) # current distribution in Am\n", - "\n", - "#Calculation\n", - "\n", - "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", - "\n", - "#Result\n", - "\n", - "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.6,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "dL = lamda/12\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.7,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "I_m = 100 # uniform current in ampere\n", - "Lm = Symbol('Lm') #Taking Lm as lamda\n", - "dL = Lm/16\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", - "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.8,PAGE NO.-47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# variable declaration\n", - "\n", - "f = 30*(10**6) #Frequency in Hz\n", - "c = 3*(10**8) #speed of light in m/s\n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "\n", - "#Result\n", - "\n", - "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.10,PAGE NO.-48" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin,sqrt \n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = 0.01*Lm # Length of dipole \n", - "theta = 45\n", - "P_rad = 1 # Power radiated in kW\n", - "phi = 90\n", - "r = 1 # Distance in Km\n", - "Eta_o=120*pi\n", - "\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", - "I_m = sqrt(2*P_rad*R_rad)\n", - "\n", - "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", - "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Power density is \",P,\"Watt/m^2\"\n", - "\n", - "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.11,PAGE NO.-49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi \n", - "\n", - "# variable declaration\n", - "\n", - "dL = 75 #Length of dipole in m\n", - "f = 800 # Frequency in kHz\n", - "I_rms = 10 #rms Current in Amp\n", - "c = 3*(10**8) #Speed of light in m/s \n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_11.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_11.ipynb deleted file mode 100755 index e025dd86..00000000 --- a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_11.ipynb +++ /dev/null @@ -1,462 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Radiation" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.7.1, PAGE NO.-30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "I_m = 15 #Current in Ampere\n", - "P_rad = 6 #Power radiated in kW\n", - "\n", - "#Calculation\n", - "\n", - "# By formula\n", - "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", - "\n", - "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", - "\n", - "#Result\n", - "\n", - "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The radiation resistance of Antenna is 53.33 kW\n" - ] - } - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.1,PAGE NO.-42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt \n", - "from sympy import Symbol\n", - "\n", - "# Variable Declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = Lm/25 # Length of dipole for Hertian dipole\n", - "H_phi = 5 # Magnetic field strength in uA/m\n", - "theta = pi/2\n", - "r = 2 # Distance in Km\n", - "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", - "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", - "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", - "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", - "\n", - "# Calculation\n", - "\n", - "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", - "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", - "I_rms = I_m/sqrt(2)\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", - "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", - "I_rms1 = I_m1/sqrt(2)\n", - "P_rad1 = (I_rms1**2)*R_rad\n", - "P_rad2 = (I_rms1**2)*R_rad1\n", - "\n", - "# Result\n", - "\n", - "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", - "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", - "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.2,PAGE NO.-43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt\n", - "\n", - "\n", - "\n", - "#variable declaration \n", - "\n", - "\n", - "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", - "theta = pi/2 #observation angle\n", - "r = 500*(10**3) #distance in metrs\n", - "f = 50*(10**6) #frequency in Hertz\n", - "c = 3*(10**8) #speed of light in m/sec\n", - "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", - "\n", - "\n", - "# calculation\n", - "lamda = c/f\n", - "L = lamda/2 #L is the length of half wave dipole\n", - "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", - "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", - "I_rms = I_m/sqrt(2)\n", - "P_avg = (R_rad*(I_m**2))/2\n", - "\n", - "#Result\n", - "\n", - "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", - "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", - "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.3,PAGE NO.-44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 100 #effective hieght in m\n", - "f = 60*(10**3) #frequency in Hertz\n", - "r = 100*(10**3) #Distance in m\n", - "c = 3*(10**8) #Speed of light in m/sec\n", - "P_rad = 100*(10**3) #radiated power\n", - "\n", - "# calculation\n", - "\n", - "lamda = c/f\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "I_rms = sqrt(P_rad/R_rad)\n", - "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", - "\n", - "# Results\n", - "\n", - "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.4,PAGE NO.-45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 113.3 #Effective length in metres\n", - "lamda = 18.8 #Wavelength in metres\n", - "I_rms = 725 #Base current in Ampere\n", - "r = 175 #Distance in metre\n", - "Eta_o = 120*pi\n", - "\n", - "#Calculation\n", - "\n", - "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", - "H = E/Eta_o\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "P_rad = (I_rms**2)*(R_rad)\n", - "\n", - "#Result\n", - "\n", - "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", - "print \"The H field is\",round(H,2),\"uA/m\"\n", - "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.5,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin\n", - "\n", - "# variable declaration\n", - "\n", - "lamda = 10*(10**(-2)) # In cm\n", - "r = 200*(10**(-2)) # In cm\n", - "theta = 90 # In Degrees\n", - "phi = 0 # In Degrees\n", - "IdL = 3*(10**(-4)) # current distribution in Am\n", - "\n", - "#Calculation\n", - "\n", - "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", - "\n", - "#Result\n", - "\n", - "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.6,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "dL = lamda/12\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.7,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "I_m = 100 # uniform current in ampere\n", - "Lm = Symbol('Lm') #Taking Lm as lamda\n", - "dL = Lm/16\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", - "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.8,PAGE NO.-47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# variable declaration\n", - "\n", - "f = 30*(10**6) #Frequency in Hz\n", - "c = 3*(10**8) #speed of light in m/s\n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "\n", - "#Result\n", - "\n", - "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.10,PAGE NO.-48" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin,sqrt \n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = 0.01*Lm # Length of dipole \n", - "theta = 45\n", - "P_rad = 1 # Power radiated in kW\n", - "phi = 90\n", - "r = 1 # Distance in Km\n", - "Eta_o=120*pi\n", - "\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", - "I_m = sqrt(2*P_rad*R_rad)\n", - "\n", - "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", - "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Power density is \",P,\"Watt/m^2\"\n", - "\n", - "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.11,PAGE NO.-49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi \n", - "\n", - "# variable declaration\n", - "\n", - "dL = 75 #Length of dipole in m\n", - "f = 800 # Frequency in kHz\n", - "I_rms = 10 #rms Current in Amp\n", - "c = 3*(10**8) #Speed of light in m/s \n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_12.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_12.ipynb deleted file mode 100755 index e025dd86..00000000 --- a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_12.ipynb +++ /dev/null @@ -1,462 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Radiation" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.7.1, PAGE NO.-30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "I_m = 15 #Current in Ampere\n", - "P_rad = 6 #Power radiated in kW\n", - "\n", - "#Calculation\n", - "\n", - "# By formula\n", - "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", - "\n", - "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", - "\n", - "#Result\n", - "\n", - "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The radiation resistance of Antenna is 53.33 kW\n" - ] - } - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.1,PAGE NO.-42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt \n", - "from sympy import Symbol\n", - "\n", - "# Variable Declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = Lm/25 # Length of dipole for Hertian dipole\n", - "H_phi = 5 # Magnetic field strength in uA/m\n", - "theta = pi/2\n", - "r = 2 # Distance in Km\n", - "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", - "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", - "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", - "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", - "\n", - "# Calculation\n", - "\n", - "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", - "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", - "I_rms = I_m/sqrt(2)\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", - "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", - "I_rms1 = I_m1/sqrt(2)\n", - "P_rad1 = (I_rms1**2)*R_rad\n", - "P_rad2 = (I_rms1**2)*R_rad1\n", - "\n", - "# Result\n", - "\n", - "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", - "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", - "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.2,PAGE NO.-43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt\n", - "\n", - "\n", - "\n", - "#variable declaration \n", - "\n", - "\n", - "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", - "theta = pi/2 #observation angle\n", - "r = 500*(10**3) #distance in metrs\n", - "f = 50*(10**6) #frequency in Hertz\n", - "c = 3*(10**8) #speed of light in m/sec\n", - "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", - "\n", - "\n", - "# calculation\n", - "lamda = c/f\n", - "L = lamda/2 #L is the length of half wave dipole\n", - "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", - "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", - "I_rms = I_m/sqrt(2)\n", - "P_avg = (R_rad*(I_m**2))/2\n", - "\n", - "#Result\n", - "\n", - "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", - "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", - "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.3,PAGE NO.-44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 100 #effective hieght in m\n", - "f = 60*(10**3) #frequency in Hertz\n", - "r = 100*(10**3) #Distance in m\n", - "c = 3*(10**8) #Speed of light in m/sec\n", - "P_rad = 100*(10**3) #radiated power\n", - "\n", - "# calculation\n", - "\n", - "lamda = c/f\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "I_rms = sqrt(P_rad/R_rad)\n", - "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", - "\n", - "# Results\n", - "\n", - "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.4,PAGE NO.-45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 113.3 #Effective length in metres\n", - "lamda = 18.8 #Wavelength in metres\n", - "I_rms = 725 #Base current in Ampere\n", - "r = 175 #Distance in metre\n", - "Eta_o = 120*pi\n", - "\n", - "#Calculation\n", - "\n", - "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", - "H = E/Eta_o\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "P_rad = (I_rms**2)*(R_rad)\n", - "\n", - "#Result\n", - "\n", - "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", - "print \"The H field is\",round(H,2),\"uA/m\"\n", - "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.5,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin\n", - "\n", - "# variable declaration\n", - "\n", - "lamda = 10*(10**(-2)) # In cm\n", - "r = 200*(10**(-2)) # In cm\n", - "theta = 90 # In Degrees\n", - "phi = 0 # In Degrees\n", - "IdL = 3*(10**(-4)) # current distribution in Am\n", - "\n", - "#Calculation\n", - "\n", - "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", - "\n", - "#Result\n", - "\n", - "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.6,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "dL = lamda/12\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.7,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "I_m = 100 # uniform current in ampere\n", - "Lm = Symbol('Lm') #Taking Lm as lamda\n", - "dL = Lm/16\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", - "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.8,PAGE NO.-47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# variable declaration\n", - "\n", - "f = 30*(10**6) #Frequency in Hz\n", - "c = 3*(10**8) #speed of light in m/s\n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "\n", - "#Result\n", - "\n", - "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.10,PAGE NO.-48" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin,sqrt \n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = 0.01*Lm # Length of dipole \n", - "theta = 45\n", - "P_rad = 1 # Power radiated in kW\n", - "phi = 90\n", - "r = 1 # Distance in Km\n", - "Eta_o=120*pi\n", - "\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", - "I_m = sqrt(2*P_rad*R_rad)\n", - "\n", - "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", - "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Power density is \",P,\"Watt/m^2\"\n", - "\n", - "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.11,PAGE NO.-49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi \n", - "\n", - "# variable declaration\n", - "\n", - "dL = 75 #Length of dipole in m\n", - "f = 800 # Frequency in kHz\n", - "I_rms = 10 #rms Current in Amp\n", - "c = 3*(10**8) #Speed of light in m/s \n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_2.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_2.ipynb deleted file mode 100755 index e025dd86..00000000 --- a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_2.ipynb +++ /dev/null @@ -1,462 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Radiation" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.7.1, PAGE NO.-30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "I_m = 15 #Current in Ampere\n", - "P_rad = 6 #Power radiated in kW\n", - "\n", - "#Calculation\n", - "\n", - "# By formula\n", - "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", - "\n", - "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", - "\n", - "#Result\n", - "\n", - "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The radiation resistance of Antenna is 53.33 kW\n" - ] - } - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.1,PAGE NO.-42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt \n", - "from sympy import Symbol\n", - "\n", - "# Variable Declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = Lm/25 # Length of dipole for Hertian dipole\n", - "H_phi = 5 # Magnetic field strength in uA/m\n", - "theta = pi/2\n", - "r = 2 # Distance in Km\n", - "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", - "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", - "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", - "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", - "\n", - "# Calculation\n", - "\n", - "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", - "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", - "I_rms = I_m/sqrt(2)\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", - "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", - "I_rms1 = I_m1/sqrt(2)\n", - "P_rad1 = (I_rms1**2)*R_rad\n", - "P_rad2 = (I_rms1**2)*R_rad1\n", - "\n", - "# Result\n", - "\n", - "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", - "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", - "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.2,PAGE NO.-43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt\n", - "\n", - "\n", - "\n", - "#variable declaration \n", - "\n", - "\n", - "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", - "theta = pi/2 #observation angle\n", - "r = 500*(10**3) #distance in metrs\n", - "f = 50*(10**6) #frequency in Hertz\n", - "c = 3*(10**8) #speed of light in m/sec\n", - "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", - "\n", - "\n", - "# calculation\n", - "lamda = c/f\n", - "L = lamda/2 #L is the length of half wave dipole\n", - "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", - "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", - "I_rms = I_m/sqrt(2)\n", - "P_avg = (R_rad*(I_m**2))/2\n", - "\n", - "#Result\n", - "\n", - "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", - "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", - "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.3,PAGE NO.-44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 100 #effective hieght in m\n", - "f = 60*(10**3) #frequency in Hertz\n", - "r = 100*(10**3) #Distance in m\n", - "c = 3*(10**8) #Speed of light in m/sec\n", - "P_rad = 100*(10**3) #radiated power\n", - "\n", - "# calculation\n", - "\n", - "lamda = c/f\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "I_rms = sqrt(P_rad/R_rad)\n", - "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", - "\n", - "# Results\n", - "\n", - "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.4,PAGE NO.-45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 113.3 #Effective length in metres\n", - "lamda = 18.8 #Wavelength in metres\n", - "I_rms = 725 #Base current in Ampere\n", - "r = 175 #Distance in metre\n", - "Eta_o = 120*pi\n", - "\n", - "#Calculation\n", - "\n", - "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", - "H = E/Eta_o\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "P_rad = (I_rms**2)*(R_rad)\n", - "\n", - "#Result\n", - "\n", - "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", - "print \"The H field is\",round(H,2),\"uA/m\"\n", - "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.5,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin\n", - "\n", - "# variable declaration\n", - "\n", - "lamda = 10*(10**(-2)) # In cm\n", - "r = 200*(10**(-2)) # In cm\n", - "theta = 90 # In Degrees\n", - "phi = 0 # In Degrees\n", - "IdL = 3*(10**(-4)) # current distribution in Am\n", - "\n", - "#Calculation\n", - "\n", - "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", - "\n", - "#Result\n", - "\n", - "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.6,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "dL = lamda/12\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.7,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "I_m = 100 # uniform current in ampere\n", - "Lm = Symbol('Lm') #Taking Lm as lamda\n", - "dL = Lm/16\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", - "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.8,PAGE NO.-47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# variable declaration\n", - "\n", - "f = 30*(10**6) #Frequency in Hz\n", - "c = 3*(10**8) #speed of light in m/s\n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "\n", - "#Result\n", - "\n", - "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.10,PAGE NO.-48" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin,sqrt \n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = 0.01*Lm # Length of dipole \n", - "theta = 45\n", - "P_rad = 1 # Power radiated in kW\n", - "phi = 90\n", - "r = 1 # Distance in Km\n", - "Eta_o=120*pi\n", - "\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", - "I_m = sqrt(2*P_rad*R_rad)\n", - "\n", - "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", - "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Power density is \",P,\"Watt/m^2\"\n", - "\n", - "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.11,PAGE NO.-49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi \n", - "\n", - "# variable declaration\n", - "\n", - "dL = 75 #Length of dipole in m\n", - "f = 800 # Frequency in kHz\n", - "I_rms = 10 #rms Current in Amp\n", - "c = 3*(10**8) #Speed of light in m/s \n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_3.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_3.ipynb deleted file mode 100755 index e025dd86..00000000 --- a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_3.ipynb +++ /dev/null @@ -1,462 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Radiation" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.7.1, PAGE NO.-30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "I_m = 15 #Current in Ampere\n", - "P_rad = 6 #Power radiated in kW\n", - "\n", - "#Calculation\n", - "\n", - "# By formula\n", - "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", - "\n", - "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", - "\n", - "#Result\n", - "\n", - "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The radiation resistance of Antenna is 53.33 kW\n" - ] - } - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.1,PAGE NO.-42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt \n", - "from sympy import Symbol\n", - "\n", - "# Variable Declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = Lm/25 # Length of dipole for Hertian dipole\n", - "H_phi = 5 # Magnetic field strength in uA/m\n", - "theta = pi/2\n", - "r = 2 # Distance in Km\n", - "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", - "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", - "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", - "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", - "\n", - "# Calculation\n", - "\n", - "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", - "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", - "I_rms = I_m/sqrt(2)\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", - "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", - "I_rms1 = I_m1/sqrt(2)\n", - "P_rad1 = (I_rms1**2)*R_rad\n", - "P_rad2 = (I_rms1**2)*R_rad1\n", - "\n", - "# Result\n", - "\n", - "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", - "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", - "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.2,PAGE NO.-43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt\n", - "\n", - "\n", - "\n", - "#variable declaration \n", - "\n", - "\n", - "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", - "theta = pi/2 #observation angle\n", - "r = 500*(10**3) #distance in metrs\n", - "f = 50*(10**6) #frequency in Hertz\n", - "c = 3*(10**8) #speed of light in m/sec\n", - "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", - "\n", - "\n", - "# calculation\n", - "lamda = c/f\n", - "L = lamda/2 #L is the length of half wave dipole\n", - "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", - "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", - "I_rms = I_m/sqrt(2)\n", - "P_avg = (R_rad*(I_m**2))/2\n", - "\n", - "#Result\n", - "\n", - "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", - "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", - "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.3,PAGE NO.-44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 100 #effective hieght in m\n", - "f = 60*(10**3) #frequency in Hertz\n", - "r = 100*(10**3) #Distance in m\n", - "c = 3*(10**8) #Speed of light in m/sec\n", - "P_rad = 100*(10**3) #radiated power\n", - "\n", - "# calculation\n", - "\n", - "lamda = c/f\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "I_rms = sqrt(P_rad/R_rad)\n", - "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", - "\n", - "# Results\n", - "\n", - "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.4,PAGE NO.-45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 113.3 #Effective length in metres\n", - "lamda = 18.8 #Wavelength in metres\n", - "I_rms = 725 #Base current in Ampere\n", - "r = 175 #Distance in metre\n", - "Eta_o = 120*pi\n", - "\n", - "#Calculation\n", - "\n", - "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", - "H = E/Eta_o\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "P_rad = (I_rms**2)*(R_rad)\n", - "\n", - "#Result\n", - "\n", - "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", - "print \"The H field is\",round(H,2),\"uA/m\"\n", - "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.5,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin\n", - "\n", - "# variable declaration\n", - "\n", - "lamda = 10*(10**(-2)) # In cm\n", - "r = 200*(10**(-2)) # In cm\n", - "theta = 90 # In Degrees\n", - "phi = 0 # In Degrees\n", - "IdL = 3*(10**(-4)) # current distribution in Am\n", - "\n", - "#Calculation\n", - "\n", - "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", - "\n", - "#Result\n", - "\n", - "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.6,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "dL = lamda/12\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.7,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "I_m = 100 # uniform current in ampere\n", - "Lm = Symbol('Lm') #Taking Lm as lamda\n", - "dL = Lm/16\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", - "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.8,PAGE NO.-47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# variable declaration\n", - "\n", - "f = 30*(10**6) #Frequency in Hz\n", - "c = 3*(10**8) #speed of light in m/s\n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "\n", - "#Result\n", - "\n", - "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.10,PAGE NO.-48" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin,sqrt \n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = 0.01*Lm # Length of dipole \n", - "theta = 45\n", - "P_rad = 1 # Power radiated in kW\n", - "phi = 90\n", - "r = 1 # Distance in Km\n", - "Eta_o=120*pi\n", - "\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", - "I_m = sqrt(2*P_rad*R_rad)\n", - "\n", - "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", - "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Power density is \",P,\"Watt/m^2\"\n", - "\n", - "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.11,PAGE NO.-49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi \n", - "\n", - "# variable declaration\n", - "\n", - "dL = 75 #Length of dipole in m\n", - "f = 800 # Frequency in kHz\n", - "I_rms = 10 #rms Current in Amp\n", - "c = 3*(10**8) #Speed of light in m/s \n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_4.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_4.ipynb deleted file mode 100755 index e025dd86..00000000 --- a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_4.ipynb +++ /dev/null @@ -1,462 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Radiation" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.7.1, PAGE NO.-30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "I_m = 15 #Current in Ampere\n", - "P_rad = 6 #Power radiated in kW\n", - "\n", - "#Calculation\n", - "\n", - "# By formula\n", - "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", - "\n", - "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", - "\n", - "#Result\n", - "\n", - "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The radiation resistance of Antenna is 53.33 kW\n" - ] - } - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.1,PAGE NO.-42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt \n", - "from sympy import Symbol\n", - "\n", - "# Variable Declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = Lm/25 # Length of dipole for Hertian dipole\n", - "H_phi = 5 # Magnetic field strength in uA/m\n", - "theta = pi/2\n", - "r = 2 # Distance in Km\n", - "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", - "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", - "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", - "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", - "\n", - "# Calculation\n", - "\n", - "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", - "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", - "I_rms = I_m/sqrt(2)\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", - "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", - "I_rms1 = I_m1/sqrt(2)\n", - "P_rad1 = (I_rms1**2)*R_rad\n", - "P_rad2 = (I_rms1**2)*R_rad1\n", - "\n", - "# Result\n", - "\n", - "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", - "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", - "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.2,PAGE NO.-43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt\n", - "\n", - "\n", - "\n", - "#variable declaration \n", - "\n", - "\n", - "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", - "theta = pi/2 #observation angle\n", - "r = 500*(10**3) #distance in metrs\n", - "f = 50*(10**6) #frequency in Hertz\n", - "c = 3*(10**8) #speed of light in m/sec\n", - "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", - "\n", - "\n", - "# calculation\n", - "lamda = c/f\n", - "L = lamda/2 #L is the length of half wave dipole\n", - "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", - "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", - "I_rms = I_m/sqrt(2)\n", - "P_avg = (R_rad*(I_m**2))/2\n", - "\n", - "#Result\n", - "\n", - "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", - "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", - "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.3,PAGE NO.-44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 100 #effective hieght in m\n", - "f = 60*(10**3) #frequency in Hertz\n", - "r = 100*(10**3) #Distance in m\n", - "c = 3*(10**8) #Speed of light in m/sec\n", - "P_rad = 100*(10**3) #radiated power\n", - "\n", - "# calculation\n", - "\n", - "lamda = c/f\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "I_rms = sqrt(P_rad/R_rad)\n", - "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", - "\n", - "# Results\n", - "\n", - "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.4,PAGE NO.-45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 113.3 #Effective length in metres\n", - "lamda = 18.8 #Wavelength in metres\n", - "I_rms = 725 #Base current in Ampere\n", - "r = 175 #Distance in metre\n", - "Eta_o = 120*pi\n", - "\n", - "#Calculation\n", - "\n", - "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", - "H = E/Eta_o\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "P_rad = (I_rms**2)*(R_rad)\n", - "\n", - "#Result\n", - "\n", - "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", - "print \"The H field is\",round(H,2),\"uA/m\"\n", - "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.5,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin\n", - "\n", - "# variable declaration\n", - "\n", - "lamda = 10*(10**(-2)) # In cm\n", - "r = 200*(10**(-2)) # In cm\n", - "theta = 90 # In Degrees\n", - "phi = 0 # In Degrees\n", - "IdL = 3*(10**(-4)) # current distribution in Am\n", - "\n", - "#Calculation\n", - "\n", - "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", - "\n", - "#Result\n", - "\n", - "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.6,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "dL = lamda/12\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.7,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "I_m = 100 # uniform current in ampere\n", - "Lm = Symbol('Lm') #Taking Lm as lamda\n", - "dL = Lm/16\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", - "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.8,PAGE NO.-47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# variable declaration\n", - "\n", - "f = 30*(10**6) #Frequency in Hz\n", - "c = 3*(10**8) #speed of light in m/s\n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "\n", - "#Result\n", - "\n", - "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.10,PAGE NO.-48" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin,sqrt \n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = 0.01*Lm # Length of dipole \n", - "theta = 45\n", - "P_rad = 1 # Power radiated in kW\n", - "phi = 90\n", - "r = 1 # Distance in Km\n", - "Eta_o=120*pi\n", - "\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", - "I_m = sqrt(2*P_rad*R_rad)\n", - "\n", - "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", - "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Power density is \",P,\"Watt/m^2\"\n", - "\n", - "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.11,PAGE NO.-49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi \n", - "\n", - "# variable declaration\n", - "\n", - "dL = 75 #Length of dipole in m\n", - "f = 800 # Frequency in kHz\n", - "I_rms = 10 #rms Current in Amp\n", - "c = 3*(10**8) #Speed of light in m/s \n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_5.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_5.ipynb deleted file mode 100755 index e025dd86..00000000 --- a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_5.ipynb +++ /dev/null @@ -1,462 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Radiation" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.7.1, PAGE NO.-30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "I_m = 15 #Current in Ampere\n", - "P_rad = 6 #Power radiated in kW\n", - "\n", - "#Calculation\n", - "\n", - "# By formula\n", - "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", - "\n", - "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", - "\n", - "#Result\n", - "\n", - "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The radiation resistance of Antenna is 53.33 kW\n" - ] - } - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.1,PAGE NO.-42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt \n", - "from sympy import Symbol\n", - "\n", - "# Variable Declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = Lm/25 # Length of dipole for Hertian dipole\n", - "H_phi = 5 # Magnetic field strength in uA/m\n", - "theta = pi/2\n", - "r = 2 # Distance in Km\n", - "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", - "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", - "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", - "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", - "\n", - "# Calculation\n", - "\n", - "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", - "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", - "I_rms = I_m/sqrt(2)\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", - "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", - "I_rms1 = I_m1/sqrt(2)\n", - "P_rad1 = (I_rms1**2)*R_rad\n", - "P_rad2 = (I_rms1**2)*R_rad1\n", - "\n", - "# Result\n", - "\n", - "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", - "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", - "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.2,PAGE NO.-43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt\n", - "\n", - "\n", - "\n", - "#variable declaration \n", - "\n", - "\n", - "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", - "theta = pi/2 #observation angle\n", - "r = 500*(10**3) #distance in metrs\n", - "f = 50*(10**6) #frequency in Hertz\n", - "c = 3*(10**8) #speed of light in m/sec\n", - "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", - "\n", - "\n", - "# calculation\n", - "lamda = c/f\n", - "L = lamda/2 #L is the length of half wave dipole\n", - "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", - "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", - "I_rms = I_m/sqrt(2)\n", - "P_avg = (R_rad*(I_m**2))/2\n", - "\n", - "#Result\n", - "\n", - "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", - "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", - "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.3,PAGE NO.-44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 100 #effective hieght in m\n", - "f = 60*(10**3) #frequency in Hertz\n", - "r = 100*(10**3) #Distance in m\n", - "c = 3*(10**8) #Speed of light in m/sec\n", - "P_rad = 100*(10**3) #radiated power\n", - "\n", - "# calculation\n", - "\n", - "lamda = c/f\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "I_rms = sqrt(P_rad/R_rad)\n", - "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", - "\n", - "# Results\n", - "\n", - "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.4,PAGE NO.-45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 113.3 #Effective length in metres\n", - "lamda = 18.8 #Wavelength in metres\n", - "I_rms = 725 #Base current in Ampere\n", - "r = 175 #Distance in metre\n", - "Eta_o = 120*pi\n", - "\n", - "#Calculation\n", - "\n", - "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", - "H = E/Eta_o\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "P_rad = (I_rms**2)*(R_rad)\n", - "\n", - "#Result\n", - "\n", - "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", - "print \"The H field is\",round(H,2),\"uA/m\"\n", - "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.5,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin\n", - "\n", - "# variable declaration\n", - "\n", - "lamda = 10*(10**(-2)) # In cm\n", - "r = 200*(10**(-2)) # In cm\n", - "theta = 90 # In Degrees\n", - "phi = 0 # In Degrees\n", - "IdL = 3*(10**(-4)) # current distribution in Am\n", - "\n", - "#Calculation\n", - "\n", - "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", - "\n", - "#Result\n", - "\n", - "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.6,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "dL = lamda/12\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.7,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "I_m = 100 # uniform current in ampere\n", - "Lm = Symbol('Lm') #Taking Lm as lamda\n", - "dL = Lm/16\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", - "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.8,PAGE NO.-47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# variable declaration\n", - "\n", - "f = 30*(10**6) #Frequency in Hz\n", - "c = 3*(10**8) #speed of light in m/s\n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "\n", - "#Result\n", - "\n", - "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.10,PAGE NO.-48" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin,sqrt \n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = 0.01*Lm # Length of dipole \n", - "theta = 45\n", - "P_rad = 1 # Power radiated in kW\n", - "phi = 90\n", - "r = 1 # Distance in Km\n", - "Eta_o=120*pi\n", - "\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", - "I_m = sqrt(2*P_rad*R_rad)\n", - "\n", - "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", - "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Power density is \",P,\"Watt/m^2\"\n", - "\n", - "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.11,PAGE NO.-49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi \n", - "\n", - "# variable declaration\n", - "\n", - "dL = 75 #Length of dipole in m\n", - "f = 800 # Frequency in kHz\n", - "I_rms = 10 #rms Current in Amp\n", - "c = 3*(10**8) #Speed of light in m/s \n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_6.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_6.ipynb deleted file mode 100755 index e025dd86..00000000 --- a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_6.ipynb +++ /dev/null @@ -1,462 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Radiation" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.7.1, PAGE NO.-30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "I_m = 15 #Current in Ampere\n", - "P_rad = 6 #Power radiated in kW\n", - "\n", - "#Calculation\n", - "\n", - "# By formula\n", - "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", - "\n", - "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", - "\n", - "#Result\n", - "\n", - "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The radiation resistance of Antenna is 53.33 kW\n" - ] - } - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.1,PAGE NO.-42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt \n", - "from sympy import Symbol\n", - "\n", - "# Variable Declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = Lm/25 # Length of dipole for Hertian dipole\n", - "H_phi = 5 # Magnetic field strength in uA/m\n", - "theta = pi/2\n", - "r = 2 # Distance in Km\n", - "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", - "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", - "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", - "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", - "\n", - "# Calculation\n", - "\n", - "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", - "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", - "I_rms = I_m/sqrt(2)\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", - "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", - "I_rms1 = I_m1/sqrt(2)\n", - "P_rad1 = (I_rms1**2)*R_rad\n", - "P_rad2 = (I_rms1**2)*R_rad1\n", - "\n", - "# Result\n", - "\n", - "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", - "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", - "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.2,PAGE NO.-43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt\n", - "\n", - "\n", - "\n", - "#variable declaration \n", - "\n", - "\n", - "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", - "theta = pi/2 #observation angle\n", - "r = 500*(10**3) #distance in metrs\n", - "f = 50*(10**6) #frequency in Hertz\n", - "c = 3*(10**8) #speed of light in m/sec\n", - "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", - "\n", - "\n", - "# calculation\n", - "lamda = c/f\n", - "L = lamda/2 #L is the length of half wave dipole\n", - "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", - "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", - "I_rms = I_m/sqrt(2)\n", - "P_avg = (R_rad*(I_m**2))/2\n", - "\n", - "#Result\n", - "\n", - "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", - "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", - "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.3,PAGE NO.-44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 100 #effective hieght in m\n", - "f = 60*(10**3) #frequency in Hertz\n", - "r = 100*(10**3) #Distance in m\n", - "c = 3*(10**8) #Speed of light in m/sec\n", - "P_rad = 100*(10**3) #radiated power\n", - "\n", - "# calculation\n", - "\n", - "lamda = c/f\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "I_rms = sqrt(P_rad/R_rad)\n", - "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", - "\n", - "# Results\n", - "\n", - "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.4,PAGE NO.-45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 113.3 #Effective length in metres\n", - "lamda = 18.8 #Wavelength in metres\n", - "I_rms = 725 #Base current in Ampere\n", - "r = 175 #Distance in metre\n", - "Eta_o = 120*pi\n", - "\n", - "#Calculation\n", - "\n", - "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", - "H = E/Eta_o\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "P_rad = (I_rms**2)*(R_rad)\n", - "\n", - "#Result\n", - "\n", - "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", - "print \"The H field is\",round(H,2),\"uA/m\"\n", - "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.5,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin\n", - "\n", - "# variable declaration\n", - "\n", - "lamda = 10*(10**(-2)) # In cm\n", - "r = 200*(10**(-2)) # In cm\n", - "theta = 90 # In Degrees\n", - "phi = 0 # In Degrees\n", - "IdL = 3*(10**(-4)) # current distribution in Am\n", - "\n", - "#Calculation\n", - "\n", - "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", - "\n", - "#Result\n", - "\n", - "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.6,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "dL = lamda/12\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.7,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "I_m = 100 # uniform current in ampere\n", - "Lm = Symbol('Lm') #Taking Lm as lamda\n", - "dL = Lm/16\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", - "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.8,PAGE NO.-47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# variable declaration\n", - "\n", - "f = 30*(10**6) #Frequency in Hz\n", - "c = 3*(10**8) #speed of light in m/s\n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "\n", - "#Result\n", - "\n", - "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.10,PAGE NO.-48" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin,sqrt \n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = 0.01*Lm # Length of dipole \n", - "theta = 45\n", - "P_rad = 1 # Power radiated in kW\n", - "phi = 90\n", - "r = 1 # Distance in Km\n", - "Eta_o=120*pi\n", - "\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", - "I_m = sqrt(2*P_rad*R_rad)\n", - "\n", - "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", - "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Power density is \",P,\"Watt/m^2\"\n", - "\n", - "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.11,PAGE NO.-49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi \n", - "\n", - "# variable declaration\n", - "\n", - "dL = 75 #Length of dipole in m\n", - "f = 800 # Frequency in kHz\n", - "I_rms = 10 #rms Current in Amp\n", - "c = 3*(10**8) #Speed of light in m/s \n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_7.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_7.ipynb deleted file mode 100755 index e025dd86..00000000 --- a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_7.ipynb +++ /dev/null @@ -1,462 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Radiation" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.7.1, PAGE NO.-30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "I_m = 15 #Current in Ampere\n", - "P_rad = 6 #Power radiated in kW\n", - "\n", - "#Calculation\n", - "\n", - "# By formula\n", - "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", - "\n", - "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", - "\n", - "#Result\n", - "\n", - "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The radiation resistance of Antenna is 53.33 kW\n" - ] - } - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.1,PAGE NO.-42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt \n", - "from sympy import Symbol\n", - "\n", - "# Variable Declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = Lm/25 # Length of dipole for Hertian dipole\n", - "H_phi = 5 # Magnetic field strength in uA/m\n", - "theta = pi/2\n", - "r = 2 # Distance in Km\n", - "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", - "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", - "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", - "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", - "\n", - "# Calculation\n", - "\n", - "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", - "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", - "I_rms = I_m/sqrt(2)\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", - "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", - "I_rms1 = I_m1/sqrt(2)\n", - "P_rad1 = (I_rms1**2)*R_rad\n", - "P_rad2 = (I_rms1**2)*R_rad1\n", - "\n", - "# Result\n", - "\n", - "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", - "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", - "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.2,PAGE NO.-43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt\n", - "\n", - "\n", - "\n", - "#variable declaration \n", - "\n", - "\n", - "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", - "theta = pi/2 #observation angle\n", - "r = 500*(10**3) #distance in metrs\n", - "f = 50*(10**6) #frequency in Hertz\n", - "c = 3*(10**8) #speed of light in m/sec\n", - "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", - "\n", - "\n", - "# calculation\n", - "lamda = c/f\n", - "L = lamda/2 #L is the length of half wave dipole\n", - "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", - "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", - "I_rms = I_m/sqrt(2)\n", - "P_avg = (R_rad*(I_m**2))/2\n", - "\n", - "#Result\n", - "\n", - "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", - "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", - "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.3,PAGE NO.-44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 100 #effective hieght in m\n", - "f = 60*(10**3) #frequency in Hertz\n", - "r = 100*(10**3) #Distance in m\n", - "c = 3*(10**8) #Speed of light in m/sec\n", - "P_rad = 100*(10**3) #radiated power\n", - "\n", - "# calculation\n", - "\n", - "lamda = c/f\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "I_rms = sqrt(P_rad/R_rad)\n", - "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", - "\n", - "# Results\n", - "\n", - "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.4,PAGE NO.-45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 113.3 #Effective length in metres\n", - "lamda = 18.8 #Wavelength in metres\n", - "I_rms = 725 #Base current in Ampere\n", - "r = 175 #Distance in metre\n", - "Eta_o = 120*pi\n", - "\n", - "#Calculation\n", - "\n", - "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", - "H = E/Eta_o\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "P_rad = (I_rms**2)*(R_rad)\n", - "\n", - "#Result\n", - "\n", - "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", - "print \"The H field is\",round(H,2),\"uA/m\"\n", - "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.5,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin\n", - "\n", - "# variable declaration\n", - "\n", - "lamda = 10*(10**(-2)) # In cm\n", - "r = 200*(10**(-2)) # In cm\n", - "theta = 90 # In Degrees\n", - "phi = 0 # In Degrees\n", - "IdL = 3*(10**(-4)) # current distribution in Am\n", - "\n", - "#Calculation\n", - "\n", - "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", - "\n", - "#Result\n", - "\n", - "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.6,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "dL = lamda/12\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.7,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "I_m = 100 # uniform current in ampere\n", - "Lm = Symbol('Lm') #Taking Lm as lamda\n", - "dL = Lm/16\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", - "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.8,PAGE NO.-47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# variable declaration\n", - "\n", - "f = 30*(10**6) #Frequency in Hz\n", - "c = 3*(10**8) #speed of light in m/s\n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "\n", - "#Result\n", - "\n", - "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.10,PAGE NO.-48" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin,sqrt \n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = 0.01*Lm # Length of dipole \n", - "theta = 45\n", - "P_rad = 1 # Power radiated in kW\n", - "phi = 90\n", - "r = 1 # Distance in Km\n", - "Eta_o=120*pi\n", - "\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", - "I_m = sqrt(2*P_rad*R_rad)\n", - "\n", - "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", - "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Power density is \",P,\"Watt/m^2\"\n", - "\n", - "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.11,PAGE NO.-49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi \n", - "\n", - "# variable declaration\n", - "\n", - "dL = 75 #Length of dipole in m\n", - "f = 800 # Frequency in kHz\n", - "I_rms = 10 #rms Current in Amp\n", - "c = 3*(10**8) #Speed of light in m/s \n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_8.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_8.ipynb deleted file mode 100755 index e025dd86..00000000 --- a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_8.ipynb +++ /dev/null @@ -1,462 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Radiation" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.7.1, PAGE NO.-30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "I_m = 15 #Current in Ampere\n", - "P_rad = 6 #Power radiated in kW\n", - "\n", - "#Calculation\n", - "\n", - "# By formula\n", - "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", - "\n", - "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", - "\n", - "#Result\n", - "\n", - "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The radiation resistance of Antenna is 53.33 kW\n" - ] - } - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.1,PAGE NO.-42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt \n", - "from sympy import Symbol\n", - "\n", - "# Variable Declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = Lm/25 # Length of dipole for Hertian dipole\n", - "H_phi = 5 # Magnetic field strength in uA/m\n", - "theta = pi/2\n", - "r = 2 # Distance in Km\n", - "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", - "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", - "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", - "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", - "\n", - "# Calculation\n", - "\n", - "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", - "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", - "I_rms = I_m/sqrt(2)\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", - "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", - "I_rms1 = I_m1/sqrt(2)\n", - "P_rad1 = (I_rms1**2)*R_rad\n", - "P_rad2 = (I_rms1**2)*R_rad1\n", - "\n", - "# Result\n", - "\n", - "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", - "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", - "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.2,PAGE NO.-43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt\n", - "\n", - "\n", - "\n", - "#variable declaration \n", - "\n", - "\n", - "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", - "theta = pi/2 #observation angle\n", - "r = 500*(10**3) #distance in metrs\n", - "f = 50*(10**6) #frequency in Hertz\n", - "c = 3*(10**8) #speed of light in m/sec\n", - "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", - "\n", - "\n", - "# calculation\n", - "lamda = c/f\n", - "L = lamda/2 #L is the length of half wave dipole\n", - "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", - "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", - "I_rms = I_m/sqrt(2)\n", - "P_avg = (R_rad*(I_m**2))/2\n", - "\n", - "#Result\n", - "\n", - "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", - "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", - "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.3,PAGE NO.-44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 100 #effective hieght in m\n", - "f = 60*(10**3) #frequency in Hertz\n", - "r = 100*(10**3) #Distance in m\n", - "c = 3*(10**8) #Speed of light in m/sec\n", - "P_rad = 100*(10**3) #radiated power\n", - "\n", - "# calculation\n", - "\n", - "lamda = c/f\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "I_rms = sqrt(P_rad/R_rad)\n", - "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", - "\n", - "# Results\n", - "\n", - "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.4,PAGE NO.-45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 113.3 #Effective length in metres\n", - "lamda = 18.8 #Wavelength in metres\n", - "I_rms = 725 #Base current in Ampere\n", - "r = 175 #Distance in metre\n", - "Eta_o = 120*pi\n", - "\n", - "#Calculation\n", - "\n", - "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", - "H = E/Eta_o\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "P_rad = (I_rms**2)*(R_rad)\n", - "\n", - "#Result\n", - "\n", - "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", - "print \"The H field is\",round(H,2),\"uA/m\"\n", - "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.5,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin\n", - "\n", - "# variable declaration\n", - "\n", - "lamda = 10*(10**(-2)) # In cm\n", - "r = 200*(10**(-2)) # In cm\n", - "theta = 90 # In Degrees\n", - "phi = 0 # In Degrees\n", - "IdL = 3*(10**(-4)) # current distribution in Am\n", - "\n", - "#Calculation\n", - "\n", - "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", - "\n", - "#Result\n", - "\n", - "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.6,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "dL = lamda/12\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.7,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "I_m = 100 # uniform current in ampere\n", - "Lm = Symbol('Lm') #Taking Lm as lamda\n", - "dL = Lm/16\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", - "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.8,PAGE NO.-47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# variable declaration\n", - "\n", - "f = 30*(10**6) #Frequency in Hz\n", - "c = 3*(10**8) #speed of light in m/s\n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "\n", - "#Result\n", - "\n", - "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.10,PAGE NO.-48" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin,sqrt \n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = 0.01*Lm # Length of dipole \n", - "theta = 45\n", - "P_rad = 1 # Power radiated in kW\n", - "phi = 90\n", - "r = 1 # Distance in Km\n", - "Eta_o=120*pi\n", - "\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", - "I_m = sqrt(2*P_rad*R_rad)\n", - "\n", - "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", - "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Power density is \",P,\"Watt/m^2\"\n", - "\n", - "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.11,PAGE NO.-49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi \n", - "\n", - "# variable declaration\n", - "\n", - "dL = 75 #Length of dipole in m\n", - "f = 800 # Frequency in kHz\n", - "I_rms = 10 #rms Current in Amp\n", - "c = 3*(10**8) #Speed of light in m/s \n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_9.ipynb b/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_9.ipynb deleted file mode 100755 index e025dd86..00000000 --- a/sample_notebooks/NIKHILESH DAMLE/NIKHILESH DAMLE_version_backup/ANTENNAS_AND_WAVE_PROPAGATION_BY.A_BAKSHI,_A.V_BAKSHI,_K.A_BAKSHI_9.ipynb +++ /dev/null @@ -1,462 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:02197244985b7dfa2823dacf9fac72c0a7536b50c383ffa1801ccf3066222ec3" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Radiation" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.7.1, PAGE NO.-30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "I_m = 15 #Current in Ampere\n", - "P_rad = 6 #Power radiated in kW\n", - "\n", - "#Calculation\n", - "\n", - "# By formula\n", - "I_rms = I_m/math.sqrt(2) #I_rms is r.m.s. current\n", - "\n", - "R_rad = P_rad/(I_rms**2) #R_rad is radiation resistance\n", - "\n", - "#Result\n", - "\n", - "print \"The radiation resistance of Antenna is\",round(R_rad*1000,2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The radiation resistance of Antenna is 53.33 kW\n" - ] - } - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.1,PAGE NO.-42" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt \n", - "from sympy import Symbol\n", - "\n", - "# Variable Declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = Lm/25 # Length of dipole for Hertian dipole\n", - "H_phi = 5 # Magnetic field strength in uA/m\n", - "theta = pi/2\n", - "r = 2 # Distance in Km\n", - "dL_1 = Lm/2 # Length of dipole for Half wave dipole \n", - "R_rad = 73 # Radiation resistance for half wave dipole in ohm\n", - "R_rad1 = 36.5 # Radiation resistance for quarter wave monopole in ohm\n", - "dL_2 = Lm/4 # Length of dipole for quarter wave monopole \n", - "\n", - "# Calculation\n", - "\n", - "# By formula : H_phi = I_m*dL*sin(theta)/2*Lm*r\n", - "I_m = (H_phi*2*Lm*r)/(dL*sin(theta))\n", - "I_rms = I_m/sqrt(2)\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*(I_rms**2)\n", - "I_m1 = (H_phi*2*pi*r*sin(theta))/(cos(pi/2*cos(theta)))\n", - "I_rms1 = I_m1/sqrt(2)\n", - "P_rad1 = (I_rms1**2)*R_rad\n", - "P_rad2 = (I_rms1**2)*R_rad1\n", - "\n", - "# Result\n", - "\n", - "print \" The power radiated by hertzian dipole is \",round(P_rad*10**-3,2),\"mW\"\n", - "print \" The power radiated by half wave dipole is \",round(P_rad1*10**-3,2),\"mW\"\n", - "print \" The power radiated by Quarter wave monopole is \",round(P_rad2*10**-3,2),\"mW\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.2,PAGE NO.-43" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import sin,cos,pi,sqrt\n", - "\n", - "\n", - "\n", - "#variable declaration \n", - "\n", - "\n", - "E_theta = 10*(10**(-6)) #Electric field strength in V/m\n", - "theta = pi/2 #observation angle\n", - "r = 500*(10**3) #distance in metrs\n", - "f = 50*(10**6) #frequency in Hertz\n", - "c = 3*(10**8) #speed of light in m/sec\n", - "R_rad = 73 #for half wave dipole Radiation resistance in ohms\n", - "\n", - "\n", - "# calculation\n", - "lamda = c/f\n", - "L = lamda/2 #L is the length of half wave dipole\n", - "# formula : E=((60*I_m)/r)*((cos(pi/2*cos(theta)))*sin(theta))\n", - "I_m = (E_theta*r*sin(theta))/(60*cos(pi/2*cos(theta)))\n", - "I_rms = I_m/sqrt(2)\n", - "P_avg = (R_rad*(I_m**2))/2\n", - "\n", - "#Result\n", - "\n", - "print \"Length of Dipole is\" ,round(L,2),\"metres\"\n", - "print \"Current fed to Antenna\",round(I_rms*1000,2),\"mA\"\n", - "print \"Average Power\",round(P_avg*1000,2),\"mW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.3,PAGE NO.-44" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 100 #effective hieght in m\n", - "f = 60*(10**3) #frequency in Hertz\n", - "r = 100*(10**3) #Distance in m\n", - "c = 3*(10**8) #Speed of light in m/sec\n", - "P_rad = 100*(10**3) #radiated power\n", - "\n", - "# calculation\n", - "\n", - "lamda = c/f\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "I_rms = sqrt(P_rad/R_rad)\n", - "E_rms = (120*pi*l_eff*(I_rms**2))/(lamda*r)\n", - "\n", - "# Results\n", - "\n", - "print \"Strength of Electric field\",round(E_rms,2),\"V/m\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.4,PAGE NO.-45" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "l_eff = 113.3 #Effective length in metres\n", - "lamda = 18.8 #Wavelength in metres\n", - "I_rms = 725 #Base current in Ampere\n", - "r = 175 #Distance in metre\n", - "Eta_o = 120*pi\n", - "\n", - "#Calculation\n", - "\n", - "E = (120*pi*l_eff*I_rms)/(lamda*r)\n", - "H = E/Eta_o\n", - "R_rad = 160*(pi**2)*((l_eff/lamda)**2)\n", - "P_rad = (I_rms**2)*(R_rad)\n", - "\n", - "#Result\n", - "\n", - "print \"The electric field at a distance r is \",round(E*0.001,2),\"mV/m\"\n", - "print \"The H field is\",round(H,2),\"uA/m\"\n", - "print \"The power radiated by Antenna is \",round(P_rad*(10**(-9)),2),\"kW\"\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.5,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin\n", - "\n", - "# variable declaration\n", - "\n", - "lamda = 10*(10**(-2)) # In cm\n", - "r = 200*(10**(-2)) # In cm\n", - "theta = 90 # In Degrees\n", - "phi = 0 # In Degrees\n", - "IdL = 3*(10**(-4)) # current distribution in Am\n", - "\n", - "#Calculation\n", - "\n", - "E_theta = (60*pi*IdL*sin(theta))/(lamda*r)\n", - "\n", - "#Result\n", - "\n", - "print \"The magnitude of component E_theta is \",round(E_theta,2),\"V/m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.6,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi\n", - "\n", - "# variable declaration\n", - "\n", - "dL = lamda/12\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 80*(pi**2)*((dL/lamda)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole antenna is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.7,PAGE NO.-46" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sqrt\n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "I_m = 100 # uniform current in ampere\n", - "Lm = Symbol('Lm') #Taking Lm as lamda\n", - "dL = Lm/16\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "P_rad = 80*(pi**2)*((dL/Lm)**2)*((I_m/sqrt(2))**2)\n", - "R_rad = 80*(pi**2)*((dL/Lm)**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Radiation resistance of dipole is \",round(R_rad,2),\"ohm\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.8,PAGE NO.-47" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# variable declaration\n", - "\n", - "f = 30*(10**6) #Frequency in Hz\n", - "c = 3*(10**8) #speed of light in m/s\n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "\n", - "#Result\n", - "\n", - "print \"The Length of Half wave dipole is \",round((lamda/2),2),\"m\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.10,PAGE NO.-48" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi,sin,sqrt \n", - "from sympy import Symbol\n", - "# variable declaration\n", - "\n", - "Lm = Symbol('Lm') # Taking lamda as Lm\n", - "dL = 0.01*Lm # Length of dipole \n", - "theta = 45\n", - "P_rad = 1 # Power radiated in kW\n", - "phi = 90\n", - "r = 1 # Distance in Km\n", - "Eta_o=120*pi\n", - "\n", - "\n", - "\n", - "#Calculation\n", - "\n", - "R_rad = 20*(pi**2)*((dL/Lm)**2)\n", - "I_m = sqrt(2*P_rad*R_rad)\n", - "\n", - "# formula : P = (Eta_o/2)*(((Omega*I_m*dL*sin(theta))/(4*pi*r*v))**2)\n", - "P = (Eta_o/2)*(((I_m*dL*sin(theta))/(4*pi*(r**2)))**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Power density is \",P,\"Watt/m^2\"\n", - "\n", - "# Note : The Solving in the book is wrong they put 0.1 instead of 0.1*lamda \n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.9.11,PAGE NO.-49" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from __future__ import division\n", - "from math import pi \n", - "\n", - "# variable declaration\n", - "\n", - "dL = 75 #Length of dipole in m\n", - "f = 800 # Frequency in kHz\n", - "I_rms = 10 #rms Current in Amp\n", - "c = 3*(10**8) #Speed of light in m/s \n", - "\n", - "#Calculation\n", - "\n", - "lamda = c/f\n", - "P_rad = 80*(pi**2)*((dL/lamda)**2)*(I_rms**2)\n", - "\n", - "#Result\n", - "\n", - "print \"The Total Power radiated by Antenna is \",round(P_rad*1000,2),\"kW\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/NarasimhaMamidala/NarasimhaMamidala_version_backup/Chapter_4.ipynb b/sample_notebooks/NarasimhaMamidala/NarasimhaMamidala_version_backup/Chapter_4.ipynb new file mode 100755 index 00000000..c7db6367 --- /dev/null +++ b/sample_notebooks/NarasimhaMamidala/NarasimhaMamidala_version_backup/Chapter_4.ipynb @@ -0,0 +1,544 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4 BJT Fundamentals" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4−1 in page 208" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(a)The value of the Base Current is 3.85e-04 A\n", + "\n", + "(b)The value of the Collector Current is 3.615e-03 A \n", + "\n" + ] + } + ], + "source": [ + "#Calculate Base and Collector Currents\n", + "# Given Data\n", + "alpha=0.90; # Current Gain in CB mode\n", + "Ico=15*10**-6; # Reverse saturation Current in micro−A\n", + "Ie=4*10**-3; # Emitter Current in mA\n", + "# Calculations\n", + "Ic=Ico+(alpha*Ie);\n", + "Ib=Ie-Ic;\n", + "print \"(a)The value of the Base Current is %0.2e A\\n\" %Ib;\n", + "print \"(b)The value of the Collector Current is %0 .3e A \\n\" %Ic" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4−2 in page 209" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(a)The Current gain alpha for BJT is 0.989 \n", + "\n", + "(b)The value of the base Current is 4.44e-05 A\n", + "\n", + "(c)The value of the Emitter Current is 4.04e-03 A \n", + "\n" + ] + } + ], + "source": [ + "#Calculate alpha using beta\n", + "# Given Data\n", + "\n", + "beta_bjt=90.; # beta gain for the BJT\n", + "Ic=4*10**-3; # Collector Current in mA\n", + "# Calculations\n", + "alpha=beta_bjt/(1.+beta_bjt);\n", + "Ib=Ic/beta_bjt;\n", + "Ie=Ic+Ib;\n", + "print \"(a)The Current gain alpha for BJT is %0.3f \\n\"%alpha\n", + "print \"(b)The value of the base Current is %0.2e A\\n\"%Ib\n", + "print \"(c)The value of the Emitter Current is %0.2e A \\n\"%Ie" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4−3 in page 20" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(a)The value of Current gain beta for BJT is 9 \n", + "\n", + "(b)The value of the Collector Current is 4.65e-03 A \n", + "\n" + ] + } + ], + "source": [ + "#Collector Current in C E mode\n", + "# Given Data\n", + "alpha=0.90; # Current Gain of BJT\n", + "Ico=15*10**-6; # Reverse Saturation Current of BJT in micro−A\n", + "Ib=0.5*10**-3; # Base Current in C−E mode in mA\n", + "# Calculations\n", + "beta_bjt=alpha/(1-alpha);\n", + "Ic=(beta_bjt*Ib)+(beta_bjt+1)*Ico;\n", + "print \"(a)The value of Current gain beta for BJT is %0.0f \\n\"%beta_bjt\n", + "print \"(b)The value of the Collector Current is %0.2e A \\n\"%Ic" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4−4 in page 20" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The Current gain beta for the Device is 250 \n", + "\n" + ] + } + ], + "source": [ + "#Calculate beta for the BJT\n", + "Ib=20*10**-6; # Base current in micro−A\n", + "Ic=5*10**-3; # Collector Current in mA\n", + "# Calculations\n", + "beta_bjt=Ic/Ib;\n", + "print \"The Current gain beta for the Device is %0.0f \\n\"%beta_bjt;\n", + "# The Current Gain beta for the Device is 250" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4−5 in page 209" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(a)The value of the Emitter Current is 5.05e-03A \n", + "\n", + "(b)The value of beta gain of the BJT is 100 \n", + "\n", + "(c)The value of alpha gain of the BJT is 0.990 \n", + "\n" + ] + } + ], + "source": [ + "#To Compute Alpha Beta and Emitter Current\n", + "# Given Data\n", + "Ib=50*10**-6; # Base Current in mu−A\n", + "Ic=5*10**-3; # Collector Current in mA\n", + "# Calculations\n", + "Ie=Ic+Ib;\n", + "beta_bjt=Ic/Ib;\n", + "alpha=Ic/Ie;\n", + "print \"(a)The value of the Emitter Current is %0.2eA \\n\"%Ie\n", + "print \"(b)The value of beta gain of the BJT is %0.0f \\n\"%beta_bjt\n", + "print \"(c)The value of alpha gain of the BJT is %0.3f \\n\"%alpha" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4−6 in page 210" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of inverse beta of the BJT is 1 \n", + "\n", + "The value of inverse alpha of the BJT is 2 \n", + "\n" + ] + } + ], + "source": [ + "#Calculate alpha reverse and beta reverse\n", + "# Given Data\n", + "Ie=10.*10**-3; # Emitter Current in mA\n", + "Ib=5*10**-3; # Base Current in mu−A\n", + "# Calculations\n", + "Ic=Ie-Ib;\n", + "beta_reverse=Ib/Ic;\n", + "alpha_reverse=Ie/Ic;\n", + "print \"The value of inverse beta of the BJT is %0.0f \\n\"%beta_reverse\n", + "print \"The value of inverse alpha of the BJT is %0.0f \\n\"%alpha_reverse" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4−7 in page 210" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Circuit 1:\n", + "(a)Emitter Current=9.30e-04 A\n", + "(b)Base Current=9.21e-06 A\n", + "(c)Collector Voltage=0.792 V\n", + "\n", + "\n", + "Circuit 2:\n", + "(a)Emitter Current=1.86e-03 A\n", + "(b) Collector Current=1.842e-03 A\n", + "(c)Collector Voltage=-5.700 V\n", + "\n" + ] + } + ], + "source": [ + "# Calculate Labeled Currents and Voltages\n", + "# Given Data\n", + "beta_bjt=100.; # beta gain of BJT\n", + "Vbe=0.7; # Base−Emitter voltage of BJT in V\n", + "#Calculation\n", + "Vcc1=10.;\n", + "Vee1=-10.;\n", + "Ve1=-0.7;\n", + "R1=10*10**3;\n", + "Ie1=(Vcc1-Vbe)/R1;\n", + "Ib1=Ie1/(beta_bjt+1);\n", + "Vc1=Vcc1-R1*(Ie1-Ib1);\n", + "Vcc2=10.;\n", + "Vee2=-15.;\n", + "Ve2=-0.7;\n", + "R2 =5*10**3;\n", + "Ie2=(Vcc2-Vbe)/R2;\n", + "Ic2=(beta_bjt/(beta_bjt+1.))*Ie2;\n", + "Vc2=Vee2+R2*(Ie2);\n", + "print \"Circuit 1:\\n(a)Emitter Current=%0.2e A\\n(b)Base Current=%0.2e A\\n(c)Collector Voltage=%0.3f V\\n\\n\"%(Ie1,Ib1,Vc1);\n", + "print \"Circuit 2:\\n(a)Emitter Current=%0.2e A\\n(b) Collector Current=%0.3e A\\n(c)Collector Voltage=%0.3f V\\n\"%(Ie2,Ic2,Vc2);" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4−8 in page 211" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Circuit 1:\n", + "(a)Base Voltage = 0.0 V\n", + "(b)Emitter Voltage = -0.7 V\n", + "\n", + "Circuit 2:\n", + "(a)Emitter Voltage = 0.7 V\n", + "(b) Collector Voltage = -5.7 V\n", + "\n" + ] + } + ], + "source": [ + "#Calculate labeled Voltages\n", + "# Given Data\n", + "Vbe=0.7; # Base−Emitter voltage of BJT in V\n", + "Vcc2=10; # DC voltage across Collector in V\n", + "Vee2=-15; # DC voltage across Emitter in V\n", + "Rc2=5*10**3; # Collector Resistance in K−ohms\n", + "# Beta Current Gain of BJT is Infinity\n", + "# Calculations\n", + "Vb1=0;\n", + "Ve1=-0.7;\n", + "Ve2=0.7;\n", + "Vc2=Vee2+Rc2*((Vcc2-Vbe)/Rc2);\n", + "print \"Circuit 1:\\n(a)Base Voltage = %0.1f V\\n(b)Emitter Voltage = %0.1f V\\n\"%(Vb1,Ve1);\n", + "print \"Circuit 2:\\n(a)Emitter Voltage = %0.1f V\\n(b) Collector Voltage = %0.1f V\\n\"%(Ve2,Vc2);" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4−9 in page 211" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Circuit Parameters:\n", + "(a)Base Voltage = 0.300V\n", + "(b)Base Current = 1.500e-05 A\n", + "(c)Emitter Current= 8.000e-04 A\n", + "(d)Collector Current = 7.850e-04 A\n", + "(e) Collector Voltage = -1.075 V\n", + "(f) beta gain = 52.333\n", + "(g)alpha gain = 0.981\n", + "\n" + ] + } + ], + "source": [ + "#Calculating BJT parameters assuming Vbe\n", + "# Given Data\n", + "Ve=1.; # Emitter Voltage of BJT in V\n", + "Vbe=0.7; # Base−Emitter Voltage of BJT in V\n", + "Rb=20*10**3; # Base Resistance of Circuit in K−ohms\n", + "Rc=5*10**3; # Collector Resistance of Circuit in K−ohms\n", + "Re=5*10**3; # Emitter Resistance of Circuit in K−ohms\n", + "Vcc=5.; # DC voltage across Collector in V\n", + "Vee=-5; # DC voltage across Emitter in V\n", + "# Calculations\n", + "Vb=Ve-Vbe;\n", + "Ib=Vb/Rb;\n", + "Ie=(Vcc -1)/Re;\n", + "Ic=Ie-Ib;\n", + "Vc=(Rc*Ic)-Vcc;\n", + "beta_bjt=Ic/Ib;\n", + "alpha=Ic/Ie;\n", + "print \"Circuit Parameters:\\n(a)Base Voltage = %0.3fV\\n(b)Base Current = %0.3e A\\n(c)Emitter Current= %0.3e A\\n(d)Collector Current = %0.3e A\\n(e) Collector Voltage = %0.3f V\\n(f) beta gain = %0.3f\\n(g)alpha gain = %0.3f\\n\"%(Vb,Ib,Ie,Ic,Vc, beta_bjt ,alpha);" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4−10 in page 211" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(a)Change in Emitter voltage is +0.40 V\n", + "\n", + "(b)Change in Collector Voltage is 0.00 V\n", + "\n" + ] + } + ], + "source": [ + "# Measurement of Circuit Voltage changes\n", + "# Given Data\n", + "Vb=-5; # Base Voltage of BJT in V\n", + "Rc=1*10**3; # Collector Resistance in K−ohms\n", + "Ie=2*10**-3; # Emitter Current of BJT in mA\n", + "delB=+0.4; # Change in Base Voltage\n", + "# Calculations\n", + "delE =+0.4;\n", + "delC=0;\n", + "print \"(a)Change in Emitter voltage is +%0.2f V\\n\"%delE\n", + "print \"(b)Change in Collector Voltage is %0.2f V\\n\"%delC" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4−11 in page 212" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Assume active mode for circuit 1\n", + "(a)Ve = 1.30 V\n", + "(b)Ic = 0.00e+00 A\n", + "(c)Ve = 3.03 V\n", + "\n", + "Thus the circuit operates in an active mode\n", + "\n", + "\n", + "For circuit 2,assume active mode\n", + "\n", + "(a)Ve = 1.7 V\n", + "(b)Ie = 4.30e-04 A\n", + "(c)Vc = 4.30 V\n", + "\n", + "This circuit operates in a saturated mode\n", + "\n", + "\n", + "For circuit 3,assume active mode\n", + "\n", + "(a)Ve = -4.3 V\n", + "(b)Ie = 6.9000e-05 A\n", + "(c)Ic = 0.000e+00 A\n", + "(d)Vc = -40.2 V\n", + "\n", + "The circuit operates in an active mode\n", + "\n", + "\n", + "For circuit 4,assume active mode\n", + "\n", + "(a)Ie = 1.86e-03 A\n", + "(b)Vc = -10.00 V\n", + "\n", + "The circuit operates in an active mode\n" + ] + } + ], + "source": [ + "# Determine mode of operation of BJT\n", + "# Given Data\n", + "Vbe=0.7; # Base−Emitter Voltage in V\n", + "beta_bjt=100; # beta gain of BJ\n", + "# Calculation\n", + "print \"Assume active mode for circuit 1\"\n", + "Vb1=2;\n", + "Ve_1=Vb1-Vbe;\n", + "Ie1 =1*10** -3;\n", + "Ic1=Ie1*(beta_bjt/(1+beta_bjt));\n", + "Ve1=6-(3*0.99);\n", + "print \"(a)Ve = %0.2f V\\n(b)Ic = %0.2e A\\n(c)Ve = %0.2f V\\n\"%(Ve_1,Ic1,Ve1);\n", + "print \"Thus the circuit operates in an active mode\\n\\n\"\n", + "print \"For circuit 2,assume active mode\\n\"\n", + "Vcc=1;\n", + "Ve2=Vcc+Vbe;\n", + "Ie2=(6-Ve2)/(10*10**3);\n", + "Vc=0+(10*0.43);\n", + "print \"(a)Ve = %0.1f V\\n(b)Ie = %0.2e A\\n(c)Vc = %0.2f V\\n\"%(Ve2,Ie2,Vc);\n", + "print \"This circuit operates in a saturated mode\\n\\n\"\n", + "print \"For circuit 3,assume active mode\\n\"\n", + "Ve3=-5+Vbe;\n", + "Ie3=(9.5-Ve3)/(200*10**3);\n", + "Ic=Ie3*(beta_bjt/(1+beta_bjt));\n", + "Vc3=-50+(0.492*20);\n", + "print \"(a)Ve = %0.1f V\\n(b)Ie = %0.4e A\\n(c)Ic = %0.3e A\\n(d)Vc = %0.1f V\\n\"%(Ve3,Ie3,Ic,Vc3);\n", + "print \"The circuit operates in an active mode\\n\\n\"\n", + "print \"For circuit 4,assume active mode\\n\"\n", + "Ve4 = -20.7;\n", + "Ie4=(30+Ve4)/(5*10**3);\n", + "Vc4=(-Ie4*(beta_bjt/(1+beta_bjt))*(2*10**3))-10;\n", + "print \"(a)Ie = %0.2e A\\n(b)Vc = %0.2f V\\n\"%(Ie4,Vc4)\n", + "print \"The circuit operates in an active mode\"" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/NarasimhaMamidala/NarasimhaMamidala_version_backup/Chapter_4_BJT.ipynb b/sample_notebooks/NarasimhaMamidala/NarasimhaMamidala_version_backup/Chapter_4_BJT.ipynb deleted file mode 100755 index c7db6367..00000000 --- a/sample_notebooks/NarasimhaMamidala/NarasimhaMamidala_version_backup/Chapter_4_BJT.ipynb +++ /dev/null @@ -1,544 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 4 BJT Fundamentals" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4−1 in page 208" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(a)The value of the Base Current is 3.85e-04 A\n", - "\n", - "(b)The value of the Collector Current is 3.615e-03 A \n", - "\n" - ] - } - ], - "source": [ - "#Calculate Base and Collector Currents\n", - "# Given Data\n", - "alpha=0.90; # Current Gain in CB mode\n", - "Ico=15*10**-6; # Reverse saturation Current in micro−A\n", - "Ie=4*10**-3; # Emitter Current in mA\n", - "# Calculations\n", - "Ic=Ico+(alpha*Ie);\n", - "Ib=Ie-Ic;\n", - "print \"(a)The value of the Base Current is %0.2e A\\n\" %Ib;\n", - "print \"(b)The value of the Collector Current is %0 .3e A \\n\" %Ic" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4−2 in page 209" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(a)The Current gain alpha for BJT is 0.989 \n", - "\n", - "(b)The value of the base Current is 4.44e-05 A\n", - "\n", - "(c)The value of the Emitter Current is 4.04e-03 A \n", - "\n" - ] - } - ], - "source": [ - "#Calculate alpha using beta\n", - "# Given Data\n", - "\n", - "beta_bjt=90.; # beta gain for the BJT\n", - "Ic=4*10**-3; # Collector Current in mA\n", - "# Calculations\n", - "alpha=beta_bjt/(1.+beta_bjt);\n", - "Ib=Ic/beta_bjt;\n", - "Ie=Ic+Ib;\n", - "print \"(a)The Current gain alpha for BJT is %0.3f \\n\"%alpha\n", - "print \"(b)The value of the base Current is %0.2e A\\n\"%Ib\n", - "print \"(c)The value of the Emitter Current is %0.2e A \\n\"%Ie" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4−3 in page 20" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(a)The value of Current gain beta for BJT is 9 \n", - "\n", - "(b)The value of the Collector Current is 4.65e-03 A \n", - "\n" - ] - } - ], - "source": [ - "#Collector Current in C E mode\n", - "# Given Data\n", - "alpha=0.90; # Current Gain of BJT\n", - "Ico=15*10**-6; # Reverse Saturation Current of BJT in micro−A\n", - "Ib=0.5*10**-3; # Base Current in C−E mode in mA\n", - "# Calculations\n", - "beta_bjt=alpha/(1-alpha);\n", - "Ic=(beta_bjt*Ib)+(beta_bjt+1)*Ico;\n", - "print \"(a)The value of Current gain beta for BJT is %0.0f \\n\"%beta_bjt\n", - "print \"(b)The value of the Collector Current is %0.2e A \\n\"%Ic" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4−4 in page 20" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The Current gain beta for the Device is 250 \n", - "\n" - ] - } - ], - "source": [ - "#Calculate beta for the BJT\n", - "Ib=20*10**-6; # Base current in micro−A\n", - "Ic=5*10**-3; # Collector Current in mA\n", - "# Calculations\n", - "beta_bjt=Ic/Ib;\n", - "print \"The Current gain beta for the Device is %0.0f \\n\"%beta_bjt;\n", - "# The Current Gain beta for the Device is 250" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4−5 in page 209" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(a)The value of the Emitter Current is 5.05e-03A \n", - "\n", - "(b)The value of beta gain of the BJT is 100 \n", - "\n", - "(c)The value of alpha gain of the BJT is 0.990 \n", - "\n" - ] - } - ], - "source": [ - "#To Compute Alpha Beta and Emitter Current\n", - "# Given Data\n", - "Ib=50*10**-6; # Base Current in mu−A\n", - "Ic=5*10**-3; # Collector Current in mA\n", - "# Calculations\n", - "Ie=Ic+Ib;\n", - "beta_bjt=Ic/Ib;\n", - "alpha=Ic/Ie;\n", - "print \"(a)The value of the Emitter Current is %0.2eA \\n\"%Ie\n", - "print \"(b)The value of beta gain of the BJT is %0.0f \\n\"%beta_bjt\n", - "print \"(c)The value of alpha gain of the BJT is %0.3f \\n\"%alpha" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4−6 in page 210" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value of inverse beta of the BJT is 1 \n", - "\n", - "The value of inverse alpha of the BJT is 2 \n", - "\n" - ] - } - ], - "source": [ - "#Calculate alpha reverse and beta reverse\n", - "# Given Data\n", - "Ie=10.*10**-3; # Emitter Current in mA\n", - "Ib=5*10**-3; # Base Current in mu−A\n", - "# Calculations\n", - "Ic=Ie-Ib;\n", - "beta_reverse=Ib/Ic;\n", - "alpha_reverse=Ie/Ic;\n", - "print \"The value of inverse beta of the BJT is %0.0f \\n\"%beta_reverse\n", - "print \"The value of inverse alpha of the BJT is %0.0f \\n\"%alpha_reverse" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4−7 in page 210" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Circuit 1:\n", - "(a)Emitter Current=9.30e-04 A\n", - "(b)Base Current=9.21e-06 A\n", - "(c)Collector Voltage=0.792 V\n", - "\n", - "\n", - "Circuit 2:\n", - "(a)Emitter Current=1.86e-03 A\n", - "(b) Collector Current=1.842e-03 A\n", - "(c)Collector Voltage=-5.700 V\n", - "\n" - ] - } - ], - "source": [ - "# Calculate Labeled Currents and Voltages\n", - "# Given Data\n", - "beta_bjt=100.; # beta gain of BJT\n", - "Vbe=0.7; # Base−Emitter voltage of BJT in V\n", - "#Calculation\n", - "Vcc1=10.;\n", - "Vee1=-10.;\n", - "Ve1=-0.7;\n", - "R1=10*10**3;\n", - "Ie1=(Vcc1-Vbe)/R1;\n", - "Ib1=Ie1/(beta_bjt+1);\n", - "Vc1=Vcc1-R1*(Ie1-Ib1);\n", - "Vcc2=10.;\n", - "Vee2=-15.;\n", - "Ve2=-0.7;\n", - "R2 =5*10**3;\n", - "Ie2=(Vcc2-Vbe)/R2;\n", - "Ic2=(beta_bjt/(beta_bjt+1.))*Ie2;\n", - "Vc2=Vee2+R2*(Ie2);\n", - "print \"Circuit 1:\\n(a)Emitter Current=%0.2e A\\n(b)Base Current=%0.2e A\\n(c)Collector Voltage=%0.3f V\\n\\n\"%(Ie1,Ib1,Vc1);\n", - "print \"Circuit 2:\\n(a)Emitter Current=%0.2e A\\n(b) Collector Current=%0.3e A\\n(c)Collector Voltage=%0.3f V\\n\"%(Ie2,Ic2,Vc2);" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4−8 in page 211" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Circuit 1:\n", - "(a)Base Voltage = 0.0 V\n", - "(b)Emitter Voltage = -0.7 V\n", - "\n", - "Circuit 2:\n", - "(a)Emitter Voltage = 0.7 V\n", - "(b) Collector Voltage = -5.7 V\n", - "\n" - ] - } - ], - "source": [ - "#Calculate labeled Voltages\n", - "# Given Data\n", - "Vbe=0.7; # Base−Emitter voltage of BJT in V\n", - "Vcc2=10; # DC voltage across Collector in V\n", - "Vee2=-15; # DC voltage across Emitter in V\n", - "Rc2=5*10**3; # Collector Resistance in K−ohms\n", - "# Beta Current Gain of BJT is Infinity\n", - "# Calculations\n", - "Vb1=0;\n", - "Ve1=-0.7;\n", - "Ve2=0.7;\n", - "Vc2=Vee2+Rc2*((Vcc2-Vbe)/Rc2);\n", - "print \"Circuit 1:\\n(a)Base Voltage = %0.1f V\\n(b)Emitter Voltage = %0.1f V\\n\"%(Vb1,Ve1);\n", - "print \"Circuit 2:\\n(a)Emitter Voltage = %0.1f V\\n(b) Collector Voltage = %0.1f V\\n\"%(Ve2,Vc2);" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4−9 in page 211" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Circuit Parameters:\n", - "(a)Base Voltage = 0.300V\n", - "(b)Base Current = 1.500e-05 A\n", - "(c)Emitter Current= 8.000e-04 A\n", - "(d)Collector Current = 7.850e-04 A\n", - "(e) Collector Voltage = -1.075 V\n", - "(f) beta gain = 52.333\n", - "(g)alpha gain = 0.981\n", - "\n" - ] - } - ], - "source": [ - "#Calculating BJT parameters assuming Vbe\n", - "# Given Data\n", - "Ve=1.; # Emitter Voltage of BJT in V\n", - "Vbe=0.7; # Base−Emitter Voltage of BJT in V\n", - "Rb=20*10**3; # Base Resistance of Circuit in K−ohms\n", - "Rc=5*10**3; # Collector Resistance of Circuit in K−ohms\n", - "Re=5*10**3; # Emitter Resistance of Circuit in K−ohms\n", - "Vcc=5.; # DC voltage across Collector in V\n", - "Vee=-5; # DC voltage across Emitter in V\n", - "# Calculations\n", - "Vb=Ve-Vbe;\n", - "Ib=Vb/Rb;\n", - "Ie=(Vcc -1)/Re;\n", - "Ic=Ie-Ib;\n", - "Vc=(Rc*Ic)-Vcc;\n", - "beta_bjt=Ic/Ib;\n", - "alpha=Ic/Ie;\n", - "print \"Circuit Parameters:\\n(a)Base Voltage = %0.3fV\\n(b)Base Current = %0.3e A\\n(c)Emitter Current= %0.3e A\\n(d)Collector Current = %0.3e A\\n(e) Collector Voltage = %0.3f V\\n(f) beta gain = %0.3f\\n(g)alpha gain = %0.3f\\n\"%(Vb,Ib,Ie,Ic,Vc, beta_bjt ,alpha);" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4−10 in page 211" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(a)Change in Emitter voltage is +0.40 V\n", - "\n", - "(b)Change in Collector Voltage is 0.00 V\n", - "\n" - ] - } - ], - "source": [ - "# Measurement of Circuit Voltage changes\n", - "# Given Data\n", - "Vb=-5; # Base Voltage of BJT in V\n", - "Rc=1*10**3; # Collector Resistance in K−ohms\n", - "Ie=2*10**-3; # Emitter Current of BJT in mA\n", - "delB=+0.4; # Change in Base Voltage\n", - "# Calculations\n", - "delE =+0.4;\n", - "delC=0;\n", - "print \"(a)Change in Emitter voltage is +%0.2f V\\n\"%delE\n", - "print \"(b)Change in Collector Voltage is %0.2f V\\n\"%delC" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4−11 in page 212" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Assume active mode for circuit 1\n", - "(a)Ve = 1.30 V\n", - "(b)Ic = 0.00e+00 A\n", - "(c)Ve = 3.03 V\n", - "\n", - "Thus the circuit operates in an active mode\n", - "\n", - "\n", - "For circuit 2,assume active mode\n", - "\n", - "(a)Ve = 1.7 V\n", - "(b)Ie = 4.30e-04 A\n", - "(c)Vc = 4.30 V\n", - "\n", - "This circuit operates in a saturated mode\n", - "\n", - "\n", - "For circuit 3,assume active mode\n", - "\n", - "(a)Ve = -4.3 V\n", - "(b)Ie = 6.9000e-05 A\n", - "(c)Ic = 0.000e+00 A\n", - "(d)Vc = -40.2 V\n", - "\n", - "The circuit operates in an active mode\n", - "\n", - "\n", - "For circuit 4,assume active mode\n", - "\n", - "(a)Ie = 1.86e-03 A\n", - "(b)Vc = -10.00 V\n", - "\n", - "The circuit operates in an active mode\n" - ] - } - ], - "source": [ - "# Determine mode of operation of BJT\n", - "# Given Data\n", - "Vbe=0.7; # Base−Emitter Voltage in V\n", - "beta_bjt=100; # beta gain of BJ\n", - "# Calculation\n", - "print \"Assume active mode for circuit 1\"\n", - "Vb1=2;\n", - "Ve_1=Vb1-Vbe;\n", - "Ie1 =1*10** -3;\n", - "Ic1=Ie1*(beta_bjt/(1+beta_bjt));\n", - "Ve1=6-(3*0.99);\n", - "print \"(a)Ve = %0.2f V\\n(b)Ic = %0.2e A\\n(c)Ve = %0.2f V\\n\"%(Ve_1,Ic1,Ve1);\n", - "print \"Thus the circuit operates in an active mode\\n\\n\"\n", - "print \"For circuit 2,assume active mode\\n\"\n", - "Vcc=1;\n", - "Ve2=Vcc+Vbe;\n", - "Ie2=(6-Ve2)/(10*10**3);\n", - "Vc=0+(10*0.43);\n", - "print \"(a)Ve = %0.1f V\\n(b)Ie = %0.2e A\\n(c)Vc = %0.2f V\\n\"%(Ve2,Ie2,Vc);\n", - "print \"This circuit operates in a saturated mode\\n\\n\"\n", - "print \"For circuit 3,assume active mode\\n\"\n", - "Ve3=-5+Vbe;\n", - "Ie3=(9.5-Ve3)/(200*10**3);\n", - "Ic=Ie3*(beta_bjt/(1+beta_bjt));\n", - "Vc3=-50+(0.492*20);\n", - "print \"(a)Ve = %0.1f V\\n(b)Ie = %0.4e A\\n(c)Ic = %0.3e A\\n(d)Vc = %0.1f V\\n\"%(Ve3,Ie3,Ic,Vc3);\n", - "print \"The circuit operates in an active mode\\n\\n\"\n", - "print \"For circuit 4,assume active mode\\n\"\n", - "Ve4 = -20.7;\n", - "Ie4=(30+Ve4)/(5*10**3);\n", - "Vc4=(-Ie4*(beta_bjt/(1+beta_bjt))*(2*10**3))-10;\n", - "print \"(a)Ie = %0.2e A\\n(b)Vc = %0.2f V\\n\"%(Ie4,Vc4)\n", - "print \"The circuit operates in an active mode\"" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8.ipynb b/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8.ipynb new file mode 100755 index 00000000..7eb86cba --- /dev/null +++ b/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8.ipynb @@ -0,0 +1,809 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:cceaf517d4ab644356e85522addd8c655c7a27bbc143387c58a9d5656be364df" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.1, page no: 208" + ] + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8: Data Abstraction through Classes and User-Defined Data Types " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Super:\n", + " def __init__(self):\n", + " self.__IntegerData=None #private member\n", + " #public functions\n", + " def SetData(self,i):\n", + " self.__IntegerData=i #refer to IntegerData\n", + " def ShowData(self):\n", + " print \"Data is \",self.__IntegerData,' '\n", + "\n", + "ob1=Super()\n", + "ob2=Super()\n", + "ob1.SetData(1000)\n", + "ob2.SetData(2000)\n", + "ob1.ShowData()\n", + "ob2.ShowData()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Data is 1000 \n", + "Data is 2000 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.2, page no:211" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class X:\n", + " def __init__(self):\n", + " self.a=None #private members\n", + " self.b=None #private members\n", + " \n", + "#no structure type present in python \n", + "x = X()\n", + "\n", + "x.a=0\n", + "x.b=1\n", + "print \"x.a=\",x.a,\",x.b=\",x.b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x.a= 0 ,x.b= 1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.3, page no:214" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction:\n", + " \n", + " def SetValue(self,a,b): #public functions\n", + " self.__num=a \n", + " self.__denom=b \n", + " def GetValue(self,a,b):\n", + " a=self.__num\n", + " b=self.__denom\n", + " \n", + "f=Fraction()\n", + "n=input(\"Enter n: \") #user input\n", + "d=input(\"Enter d: \") #user input\n", + "print \"enter the numerator and denominator: \", ' ',n,d\n", + "\n", + "f.SetValue(n,d) #call function SetValue\n", + "print \"Numerator value set: \", ' ',n\n", + "print \"Denominator value set: \", ' ',d\n", + "f.GetValue(n,d) #call function GetData\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter n: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter d: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "enter the numerator and denominator: 3 4\n", + "Numerator value set: 3\n", + "Denominator value set: 4\n", + "Numerator value retrieved: 3\n", + "Denominator value retrieved: 4\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.4, page no:216" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class SimpleClass:\n", + " def __init__(self):\n", + " self.__i=None #private member\n", + " \n", + " def __init__(self):\n", + " self.__i=500 #constructor\n", + " \n", + " def SetData(self,d):\n", + " self.__i=d\n", + " \n", + " def GetData(self):\n", + " return self.__i\n", + " \n", + "#Initializing\n", + "s1=SimpleClass()\n", + "s2=SimpleClass()\n", + "print \"s1 has data: \",s1.GetData()\n", + "print \"s2 has data: \",s2.GetData()\n", + "s1.SetData(1000) #function call\n", + "s2.SetData(2000)\n", + "print \"s1 has data: \",s1.GetData(),' '\n", + "print \"s2 has data: \", s2.GetData(),' '\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "s1 has data: 500\n", + "s2 has data: 500\n", + "s1 has data: 1000 \n", + "s2 has data: 2000 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.5, page no:217" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class SimpleClass:\n", + " __IntegerData=None\n", + " def __init__(self,data=None):\n", + " if data==None:\n", + " self.__IntegerData=500 #default constructor\n", + " else:\n", + " self.__IntegerData=data #parameterised constructor\n", + " \n", + " def SetData(self,d):\n", + " self.__IntegerData=d\n", + " \n", + " def GetData(self):\n", + " return self.__IntegerData\n", + " \n", + "#Initializing\n", + "s1=SimpleClass()\n", + "s2=SimpleClass()\n", + "s3=SimpleClass(400)\n", + "s4=SimpleClass(600)\n", + "print \"s1 has data: \",s1.GetData(),' '\n", + "print \"s2 has data: \",s2.GetData(),' '\n", + "print \"s3 has data: \",s3.GetData(),' '\n", + "print \"s4 has data: \",s4.GetData(),' '\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "s1 has data: 500 \n", + "s2 has data: 500 \n", + "s3 has data: 400 \n", + "s4 has data: 600 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.6, page no:218" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction: \n", + " def_init_num=None #private members\n", + " def_init_denom=None #private members\n", + " def __init__(self,a=0,b=1):\n", + " self.__num=a\n", + " self.__denom=b\n", + " print \"Numerator set inside constructor\",' ',n\n", + " print \"Denominator set inside constructor\",' ',d\n", + " \n", + " def SetValue(self,a,b):\n", + " self.__num=a\n", + " self.__denom=b\n", + " def GetValue(self,a,b):\n", + " a= self.__num\n", + " b= self.__denom\n", + " return a,b\n", + " \n", + " def __del__(self): #destructor\n", + " pass\n", + " \n", + "n=input(\"Enter n: \") #user input\n", + "d=input(\"Enter d: \") #user input\n", + "print \"Please enter value of numerator and denominator: \",' ',n,d\n", + "f=Fraction(n,d)\n", + "f.GetValue(n,d)\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter n: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter d: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter value of numerator and denominator: 3 4\n", + "Numerator set inside constructor 3\n", + "Denominator set inside constructor 4\n", + "Numerator value retrieved: 3\n", + "Denominator value retrieved: 4\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.7, page no:221" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction:\n", + " \n", + " def __init__(self,a=0,b=1): #constructor\n", + " self.__num=a\n", + " self.__denom=b\n", + " print \"Numerator set inside constructor: \",self.__num\n", + " print \"Denominator set inside constructor: \",self.__denom \n", + " \n", + " def GetValue(self,a,b):\n", + " return self.__num,self.__denom\n", + "n=input(\"Enter n: \") #user input\n", + "d=input(\"Enter d: \") #user input\n", + "print \"Please enter the value of the numerator and denominator: \",n,d\n", + "f=Fraction(n,d)\n", + "n,d=f.GetValue(n,d)\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d\n", + "n=input(\"Please enter the value of numerator only: \")\n", + "f1=Fraction(n)\n", + "n,d=f1.GetValue(n,d)\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d\n", + "print 'ok..now I will create a fraction-no input please'\n", + "f2=Fraction()\n", + "n,d=f2.GetValue(n,d)\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter n: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter d: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter the value of the numerator and denominator: 3 4\n", + "Numerator set inside constructor: 3\n", + "Denominator set inside constructor: 4\n", + "Numerator value retrieved: 3\n", + "Denominator value retrieved: 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter the value of numerator only: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Numerator set inside constructor: 3\n", + "Denominator set inside constructor: 1\n", + "Numerator value retrieved: 3\n", + "Denominator value retrieved: 1\n", + "ok..now I will create a fraction-no input please\n", + "Numerator set inside constructor: 0\n", + "Denominator set inside constructor: 1\n", + "Numerator value retrieved: 0\n", + "Denominator value retrieved: 1\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.8, page no:223" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction:\n", + " def_init_num=None #private members\n", + " def_init_denom=None #private members\n", + " \n", + " def __init__(self,anotherFraction=None): \n", + " if anotherFraction==None: #normal constructor\n", + " self.__num=anotherFraction\n", + " self.__denom=anotherFraction\n", + " else: #copy constructor\n", + " self.__num=anotherFraction.self.__num\n", + " self.__denom=anotherFraction.self.__denom\n", + " \n", + " \n", + " #public functions\n", + " def SetValue(self,a,b):\n", + " self.__num=a\n", + " self.__denom=b#refer to IntegerData\n", + " def GetValue(self,a,b):\n", + " a=self.__num\n", + " b=self.__denom\n", + " return a,b\n", + " \n", + "f=Fraction()\n", + "n=input(\"Enter n: \") #user input\n", + "d=input(\"Enter d: \") #user input\n", + "print \"enter the numerator and denominator: \", ' ',n,d\n", + "\n", + "f.SetValue(n,d) #call function SetValue\n", + "print \"Numerator value set: \", ' ',n\n", + "print \"Denominator value set: \", ' ',d\n", + "f.GetValue(n,d) #call function GetData\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d\n", + "print \"Now a second clone copy is being created: \",''\n", + "f1=f\n", + "f1.GetValue(n,d)\n", + "print \"Clone's numerator value retrieved: \", ' ',n\n", + "print \"Clone's denominator value retrieved: \", ' ',d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter n: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter d: 6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "enter the numerator and denominator: 5 6\n", + "Numerator value set: 5\n", + "Denominator value set: 6\n", + "Numerator value retrieved: 5\n", + "Denominator value retrieved: 6\n", + "Now a second clone copy is being created: \n", + "Clone's numerator value retrieved: 5\n", + "Clone's denominator value retrieved: 6\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.9, page no:229" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def MyNewHandler():\n", + " print \"Sorry operator new failed to allocate memory\"\n", + " exit(0)\n", + " \n", + "def _set_new_handler(s):\n", + " s()\n", + "#In python there is no in-built _set_new_handler function, so i made this function and passed MyNewHandler function as a parameters\n", + "_set_new_handler(MyNewHandler)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sorry operator new failed to allocate memory\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.10, page no:230" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import * \n", + "class Fraction: \n", + " def __init__(self,a=0,b=1): \n", + " if isinstance(a,int): \n", + " c = c_int(a) \n", + " d = c_int(b) \n", + " self.__num = pointer(c) \n", + " self.__denom = pointer(d) \n", + " print 'constructor sets numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", + " else:\n", + " c=c_int(a.__num[0])\n", + " d = c_int(a.__denom[0])\n", + " self.__num = pointer(c) \n", + " self.__denom = pointer(d)\n", + " print 'copy constructor sets numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", + " \n", + " def __del__(self): \n", + " print 'destructor deallocates numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", + " \n", + "n = input(\"Please enter values of numerator: \") \n", + "d = input(\"Please enter values of denominator: \") \n", + "f = Fraction(n,d) \n", + "print 'Please enter another set of ' \n", + "n = input(\"numerator: \") \n", + "d = input(\"denominator: \") \n", + "print 'Creating fraction *pf : ' \n", + "pf = Fraction(n,d) \n", + "print 'Now a clone copy (f2) created from *pf: ' \n", + "f2 = Fraction(pf)\n", + "print 'Now another clone copy (*pf2) created from f:' \n", + "pf2 = Fraction(f) \n", + "print '*pf2 is being destroyed:' \n", + "del pf2\n", + "print '*pf is being destroyed:' \n", + "del pf \n", + "print 'now objects f2 and f automatically destroyed : '" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter values of numerator: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter values of denominator: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "constructor sets numerator = 3 , denominator = 4\n", + "Please enter another set of \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "numerator: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "denominator: 6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Creating fraction *pf : \n", + "constructor sets numerator = 5 , denominator = 6\n", + "Now a clone copy (f2) created from *pf: \n", + "copy constructor sets numerator = 5 , denominator = 6\n", + "Now another clone copy (*pf2) created from f:\n", + "copy constructor sets numerator = 3 , denominator = 4\n", + "*pf2 is being destroyed:\n", + "*pf is being destroyed:\n", + "now objects f2 and f automatically destroyed : \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.11, page no:234" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Memfail(self,s):\n", + " print \"Sorry Unable to allocate memory\"\n", + " sys.exit(0)\n", + "\n", + "MAX_SIZE = 60 + 1\n", + "\n", + "MAX_SIZE=[[0 for col in range(MAX_SIZE)]for row in range(MAX_SIZE)]\n", + "nChar=0\n", + "chArr=\"Hello\"\n", + "\n", + "print \"Please input a string( 60 characters max.): \",chArr\n", + "\n", + "nChar=len(chArr)+1\n", + "szStr=chArr\n", + "print \"required memory space for\",nChar,\n", + "print \"characters\"\n", + "chArr=szStr #string copy\n", + "szStr=chArr\n", + "print \"String copied in allocated space: \",szStr\n", + "print \"Memory space dellocated\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please input a string( 60 characters max.): Hello\n", + "required memory space for 6 characters\n", + "String copied in allocated space: Hello\n", + "Memory space dellocated\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.12, page no:236" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction:\n", + " \n", + " def __init__(self,a=0,b=1): #constructor\n", + " self.__num=a\n", + " self.__denom=b\n", + " \n", + " def __del__(self): #destructor\n", + " pass\n", + " \n", + " def GetValue(self,a,b):\n", + " a=self.__num\n", + " b=self.__denom\n", + " return self.__num,self.__denom\n", + "n=4\n", + "d=5\n", + "f=Fraction(4,5)\n", + "n,d=f.GetValue(n,d)" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.13, page no:239" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class X:\n", + " __sa=20 #initialising static member\n", + " a = None\n", + " def __init__(self):\n", + " self.a=None #public member\n", + " def f(self,b):\n", + " a=30\n", + " print \"Global a= \",b\n", + " print \"Local a= \",a\n", + " print \"Nonstatic member a= \",self.a\n", + " print \"static member sa= \",self.__sa\n", + "\n", + "a=10\n", + "\n", + "aXobj=X()\n", + "aXobj.a=40\n", + "aXobj.f(a)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Global a= 10\n", + "Local a= 30\n", + "Nonstatic member a= 40\n", + "static member sa= 20\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8_Abstraction_through_Classes_and_User-Defined.ipynb b/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8_Abstraction_through_Classes_and_User-Defined.ipynb new file mode 100755 index 00000000..a7c3a90a --- /dev/null +++ b/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8_Abstraction_through_Classes_and_User-Defined.ipynb @@ -0,0 +1,809 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:da354bb89e19562e65167a0447837d31b8126b13ef9a65d132ea4ce7ac74a2e3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8: Data Abstraction through Classes and User-Defined Data Types" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.1, page no:208" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Super:\n", + " def __init__(self):\n", + " self.__IntegerData=None #private member\n", + " #public functions\n", + " def SetData(self,i):\n", + " self.__IntegerData=i #refer to IntegerData\n", + " def ShowData(self):\n", + " print \"Data is \",self.__IntegerData,' '\n", + "\n", + "ob1=Super()\n", + "ob2=Super()\n", + "ob1.SetData(1000)\n", + "ob2.SetData(2000)\n", + "ob1.ShowData()\n", + "ob2.ShowData()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Data is 1000 \n", + "Data is 2000 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.2, page no:211" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class X:\n", + " def __init__(self):\n", + " self.a=None #private members\n", + " self.b=None #private members\n", + " \n", + "#no structure type present in python \n", + "x = X()\n", + "\n", + "x.a=0\n", + "x.b=1\n", + "print \"x.a=\",x.a,\",x.b=\",x.b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x.a= 0 ,x.b= 1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.3, page no:214" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction:\n", + " \n", + " def SetValue(self,a,b): #public functions\n", + " self.__num=a \n", + " self.__denom=b \n", + " def GetValue(self,a,b):\n", + " a=self.__num\n", + " b=self.__denom\n", + " \n", + "f=Fraction()\n", + "n=input(\"Enter n: \") #user input\n", + "d=input(\"Enter d: \") #user input\n", + "print \"enter the numerator and denominator: \", ' ',n,d\n", + "\n", + "f.SetValue(n,d) #call function SetValue\n", + "print \"Numerator value set: \", ' ',n\n", + "print \"Denominator value set: \", ' ',d\n", + "f.GetValue(n,d) #call function GetData\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter n: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter d: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "enter the numerator and denominator: 3 4\n", + "Numerator value set: 3\n", + "Denominator value set: 4\n", + "Numerator value retrieved: 3\n", + "Denominator value retrieved: 4\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.4, page no:216" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class SimpleClass:\n", + " def __init__(self):\n", + " self.__i=None #private member\n", + " \n", + " def __init__(self):\n", + " self.__i=500 #constructor\n", + " \n", + " def SetData(self,d):\n", + " self.__i=d\n", + " \n", + " def GetData(self):\n", + " return self.__i\n", + " \n", + "#Initializing\n", + "s1=SimpleClass()\n", + "s2=SimpleClass()\n", + "print \"s1 has data: \",s1.GetData()\n", + "print \"s2 has data: \",s2.GetData()\n", + "s1.SetData(1000) #function call\n", + "s2.SetData(2000)\n", + "print \"s1 has data: \",s1.GetData(),' '\n", + "print \"s2 has data: \", s2.GetData(),' '\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "s1 has data: 500\n", + "s2 has data: 500\n", + "s1 has data: 1000 \n", + "s2 has data: 2000 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.5, page no:217" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class SimpleClass:\n", + " __IntegerData=None\n", + " def __init__(self,data=None):\n", + " if data==None:\n", + " self.__IntegerData=500 #default constructor\n", + " else:\n", + " self.__IntegerData=data #parameterised constructor\n", + " \n", + " def SetData(self,d):\n", + " self.__IntegerData=d\n", + " \n", + " def GetData(self):\n", + " return self.__IntegerData\n", + " \n", + "#Initializing\n", + "s1=SimpleClass()\n", + "s2=SimpleClass()\n", + "s3=SimpleClass(400)\n", + "s4=SimpleClass(600)\n", + "print \"s1 has data: \",s1.GetData(),' '\n", + "print \"s2 has data: \",s2.GetData(),' '\n", + "print \"s3 has data: \",s3.GetData(),' '\n", + "print \"s4 has data: \",s4.GetData(),' '\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "s1 has data: 500 \n", + "s2 has data: 500 \n", + "s3 has data: 400 \n", + "s4 has data: 600 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.6, page no:218" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction: \n", + " def_init_num=None #private members\n", + " def_init_denom=None #private members\n", + " def __init__(self,a=0,b=1):\n", + " self.__num=a\n", + " self.__denom=b\n", + " print \"Numerator set inside constructor\",' ',n\n", + " print \"Denominator set inside constructor\",' ',d\n", + " \n", + " def SetValue(self,a,b):\n", + " self.__num=a\n", + " self.__denom=b\n", + " def GetValue(self,a,b):\n", + " a= self.__num\n", + " b= self.__denom\n", + " return a,b\n", + " \n", + " def __del__(self): #destructor\n", + " pass\n", + " \n", + "n=input(\"Enter n: \") #user input\n", + "d=input(\"Enter d: \") #user input\n", + "print \"Please enter value of numerator and denominator: \",' ',n,d\n", + "f=Fraction(n,d)\n", + "f.GetValue(n,d)\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter n: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter d: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter value of numerator and denominator: 3 4\n", + "Numerator set inside constructor 3\n", + "Denominator set inside constructor 4\n", + "Numerator value retrieved: 3\n", + "Denominator value retrieved: 4\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.7, page no:221" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction:\n", + " \n", + " def __init__(self,a=0,b=1): #constructor\n", + " self.__num=a\n", + " self.__denom=b\n", + " print \"Numerator set inside constructor: \",self.__num\n", + " print \"Denominator set inside constructor: \",self.__denom \n", + " \n", + " def GetValue(self,a,b):\n", + " return self.__num,self.__denom\n", + "n=input(\"Enter n: \") #user input\n", + "d=input(\"Enter d: \") #user input\n", + "print \"Please enter the value of the numerator and denominator: \",n,d\n", + "f=Fraction(n,d)\n", + "n,d=f.GetValue(n,d)\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d\n", + "n=input(\"Please enter the value of numerator only: \")\n", + "f1=Fraction(n)\n", + "n,d=f1.GetValue(n,d)\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d\n", + "print 'ok..now I will create a fraction-no input please'\n", + "f2=Fraction()\n", + "n,d=f2.GetValue(n,d)\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter n: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter d: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter the value of the numerator and denominator: 3 4\n", + "Numerator set inside constructor: 3\n", + "Denominator set inside constructor: 4\n", + "Numerator value retrieved: 3\n", + "Denominator value retrieved: 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter the value of numerator only: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Numerator set inside constructor: 3\n", + "Denominator set inside constructor: 1\n", + "Numerator value retrieved: 3\n", + "Denominator value retrieved: 1\n", + "ok..now I will create a fraction-no input please\n", + "Numerator set inside constructor: 0\n", + "Denominator set inside constructor: 1\n", + "Numerator value retrieved: 0\n", + "Denominator value retrieved: 1\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.8, page no:223" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction:\n", + " def_init_num=None #private members\n", + " def_init_denom=None #private members\n", + " \n", + " def __init__(self,anotherFraction=None): \n", + " if anotherFraction==None: #normal constructor\n", + " self.__num=anotherFraction\n", + " self.__denom=anotherFraction\n", + " else: #copy constructor\n", + " self.__num=anotherFraction.self.__num\n", + " self.__denom=anotherFraction.self.__denom\n", + " \n", + " \n", + " #public functions\n", + " def SetValue(self,a,b):\n", + " self.__num=a\n", + " self.__denom=b#refer to IntegerData\n", + " def GetValue(self,a,b):\n", + " a=self.__num\n", + " b=self.__denom\n", + " return a,b\n", + " \n", + "f=Fraction()\n", + "n=input(\"Enter n: \") #user input\n", + "d=input(\"Enter d: \") #user input\n", + "print \"enter the numerator and denominator: \", ' ',n,d\n", + "\n", + "f.SetValue(n,d) #call function SetValue\n", + "print \"Numerator value set: \", ' ',n\n", + "print \"Denominator value set: \", ' ',d\n", + "f.GetValue(n,d) #call function GetData\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d\n", + "print \"Now a second clone copy is being created: \",''\n", + "f1=f\n", + "f1.GetValue(n,d)\n", + "print \"Clone's numerator value retrieved: \", ' ',n\n", + "print \"Clone's denominator value retrieved: \", ' ',d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter n: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter d: 6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "enter the numerator and denominator: 5 6\n", + "Numerator value set: 5\n", + "Denominator value set: 6\n", + "Numerator value retrieved: 5\n", + "Denominator value retrieved: 6\n", + "Now a second clone copy is being created: \n", + "Clone's numerator value retrieved: 5\n", + "Clone's denominator value retrieved: 6\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.9, page no:229" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def MyNewHandler():\n", + " print \"Sorry operator new failed to allocate memory\"\n", + " exit(0)\n", + " \n", + "def _set_new_handler(s):\n", + " s()\n", + "#In python there is no in-built _set_new_handler function, so i made this function and passed MyNewHandler function as a parameters\n", + "_set_new_handler(MyNewHandler)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sorry operator new failed to allocate memory\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.10, page no:230" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import * \n", + "class Fraction: \n", + " def __init__(self,a=0,b=1): \n", + " if isinstance(a,int): \n", + " c = c_int(a) \n", + " d = c_int(b) \n", + " self.__num = pointer(c) \n", + " self.__denom = pointer(d) \n", + " print 'constructor sets numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", + " else:\n", + " c=c_int(a.__num[0])\n", + " d = c_int(a.__denom[0])\n", + " self.__num = pointer(c) \n", + " self.__denom = pointer(d)\n", + " print 'copy constructor sets numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", + " \n", + " def __del__(self): \n", + " print 'destructor deallocates numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", + " \n", + "n = input(\"Please enter values of numerator: \") \n", + "d = input(\"Please enter values of denominator: \") \n", + "f = Fraction(n,d) \n", + "print 'Please enter another set of ' \n", + "n = input(\"numerator: \") \n", + "d = input(\"denominator: \") \n", + "print 'Creating fraction *pf : ' \n", + "pf = Fraction(n,d) \n", + "print 'Now a clone copy (f2) created from *pf: ' \n", + "f2 = Fraction(pf)\n", + "print 'Now another clone copy (*pf2) created from f:' \n", + "pf2 = Fraction(f) \n", + "print '*pf2 is being destroyed:' \n", + "del pf2\n", + "print '*pf is being destroyed:' \n", + "del pf \n", + "print 'now objects f2 and f automatically destroyed : '" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter values of numerator: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter values of denominator: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "constructor sets numerator = 3 , denominator = 4\n", + "Please enter another set of \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "numerator: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "denominator: 6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Creating fraction *pf : \n", + "constructor sets numerator = 5 , denominator = 6\n", + "Now a clone copy (f2) created from *pf: \n", + "copy constructor sets numerator = 5 , denominator = 6\n", + "Now another clone copy (*pf2) created from f:\n", + "copy constructor sets numerator = 3 , denominator = 4\n", + "*pf2 is being destroyed:\n", + "*pf is being destroyed:\n", + "now objects f2 and f automatically destroyed : \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.11, page no:234" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Memfail(self,s):\n", + " print \"Sorry Unable to allocate memory\"\n", + " sys.exit(0)\n", + "\n", + "MAX_SIZE = 60 + 1\n", + "\n", + "MAX_SIZE=[[0 for col in range(MAX_SIZE)]for row in range(MAX_SIZE)]\n", + "nChar=0\n", + "chArr=\"Hello\"\n", + "\n", + "print \"Please input a string( 60 characters max.): \",chArr\n", + "\n", + "nChar=len(chArr)+1\n", + "szStr=chArr\n", + "print \"required memory space for\",nChar,\n", + "print \"characters\"\n", + "chArr=szStr #string copy\n", + "szStr=chArr\n", + "print \"String copied in allocated space: \",szStr\n", + "print \"Memory space dellocated\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please input a string( 60 characters max.): Hello\n", + "required memory space for 6 characters\n", + "String copied in allocated space: Hello\n", + "Memory space dellocated\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.12, page no:236" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction:\n", + " \n", + " def __init__(self,a=0,b=1): #constructor\n", + " self.__num=a\n", + " self.__denom=b\n", + " \n", + " def __del__(self): #destructor\n", + " pass\n", + " \n", + " def GetValue(self,a,b):\n", + " a=self.__num\n", + " b=self.__denom\n", + " return self.__num,self.__denom\n", + "n=4\n", + "d=5\n", + "f=Fraction(4,5)\n", + "n,d=f.GetValue(n,d)" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.13, page no:239" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class X:\n", + " __sa=20 #initialising static member\n", + " a = None\n", + " def __init__(self):\n", + " self.a=None #public member\n", + " def f(self,b):\n", + " a=30\n", + " print \"Global a= \",b\n", + " print \"Local a= \",a\n", + " print \"Nonstatic member a= \",self.a\n", + " print \"static member sa= \",self.__sa\n", + "\n", + "a=10\n", + "\n", + "aXobj=X()\n", + "aXobj.a=40\n", + "aXobj.f(a)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Global a= 10\n", + "Local a= 30\n", + "Nonstatic member a= 40\n", + "static member sa= 20\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8_Abstraction_through_Classes_and_User_Defined.ipynb b/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8_Abstraction_through_Classes_and_User_Defined.ipynb new file mode 100755 index 00000000..7eb86cba --- /dev/null +++ b/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8_Abstraction_through_Classes_and_User_Defined.ipynb @@ -0,0 +1,809 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:cceaf517d4ab644356e85522addd8c655c7a27bbc143387c58a9d5656be364df" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.1, page no: 208" + ] + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8: Data Abstraction through Classes and User-Defined Data Types " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Super:\n", + " def __init__(self):\n", + " self.__IntegerData=None #private member\n", + " #public functions\n", + " def SetData(self,i):\n", + " self.__IntegerData=i #refer to IntegerData\n", + " def ShowData(self):\n", + " print \"Data is \",self.__IntegerData,' '\n", + "\n", + "ob1=Super()\n", + "ob2=Super()\n", + "ob1.SetData(1000)\n", + "ob2.SetData(2000)\n", + "ob1.ShowData()\n", + "ob2.ShowData()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Data is 1000 \n", + "Data is 2000 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.2, page no:211" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class X:\n", + " def __init__(self):\n", + " self.a=None #private members\n", + " self.b=None #private members\n", + " \n", + "#no structure type present in python \n", + "x = X()\n", + "\n", + "x.a=0\n", + "x.b=1\n", + "print \"x.a=\",x.a,\",x.b=\",x.b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x.a= 0 ,x.b= 1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.3, page no:214" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction:\n", + " \n", + " def SetValue(self,a,b): #public functions\n", + " self.__num=a \n", + " self.__denom=b \n", + " def GetValue(self,a,b):\n", + " a=self.__num\n", + " b=self.__denom\n", + " \n", + "f=Fraction()\n", + "n=input(\"Enter n: \") #user input\n", + "d=input(\"Enter d: \") #user input\n", + "print \"enter the numerator and denominator: \", ' ',n,d\n", + "\n", + "f.SetValue(n,d) #call function SetValue\n", + "print \"Numerator value set: \", ' ',n\n", + "print \"Denominator value set: \", ' ',d\n", + "f.GetValue(n,d) #call function GetData\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter n: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter d: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "enter the numerator and denominator: 3 4\n", + "Numerator value set: 3\n", + "Denominator value set: 4\n", + "Numerator value retrieved: 3\n", + "Denominator value retrieved: 4\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.4, page no:216" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class SimpleClass:\n", + " def __init__(self):\n", + " self.__i=None #private member\n", + " \n", + " def __init__(self):\n", + " self.__i=500 #constructor\n", + " \n", + " def SetData(self,d):\n", + " self.__i=d\n", + " \n", + " def GetData(self):\n", + " return self.__i\n", + " \n", + "#Initializing\n", + "s1=SimpleClass()\n", + "s2=SimpleClass()\n", + "print \"s1 has data: \",s1.GetData()\n", + "print \"s2 has data: \",s2.GetData()\n", + "s1.SetData(1000) #function call\n", + "s2.SetData(2000)\n", + "print \"s1 has data: \",s1.GetData(),' '\n", + "print \"s2 has data: \", s2.GetData(),' '\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "s1 has data: 500\n", + "s2 has data: 500\n", + "s1 has data: 1000 \n", + "s2 has data: 2000 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.5, page no:217" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class SimpleClass:\n", + " __IntegerData=None\n", + " def __init__(self,data=None):\n", + " if data==None:\n", + " self.__IntegerData=500 #default constructor\n", + " else:\n", + " self.__IntegerData=data #parameterised constructor\n", + " \n", + " def SetData(self,d):\n", + " self.__IntegerData=d\n", + " \n", + " def GetData(self):\n", + " return self.__IntegerData\n", + " \n", + "#Initializing\n", + "s1=SimpleClass()\n", + "s2=SimpleClass()\n", + "s3=SimpleClass(400)\n", + "s4=SimpleClass(600)\n", + "print \"s1 has data: \",s1.GetData(),' '\n", + "print \"s2 has data: \",s2.GetData(),' '\n", + "print \"s3 has data: \",s3.GetData(),' '\n", + "print \"s4 has data: \",s4.GetData(),' '\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "s1 has data: 500 \n", + "s2 has data: 500 \n", + "s3 has data: 400 \n", + "s4 has data: 600 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.6, page no:218" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction: \n", + " def_init_num=None #private members\n", + " def_init_denom=None #private members\n", + " def __init__(self,a=0,b=1):\n", + " self.__num=a\n", + " self.__denom=b\n", + " print \"Numerator set inside constructor\",' ',n\n", + " print \"Denominator set inside constructor\",' ',d\n", + " \n", + " def SetValue(self,a,b):\n", + " self.__num=a\n", + " self.__denom=b\n", + " def GetValue(self,a,b):\n", + " a= self.__num\n", + " b= self.__denom\n", + " return a,b\n", + " \n", + " def __del__(self): #destructor\n", + " pass\n", + " \n", + "n=input(\"Enter n: \") #user input\n", + "d=input(\"Enter d: \") #user input\n", + "print \"Please enter value of numerator and denominator: \",' ',n,d\n", + "f=Fraction(n,d)\n", + "f.GetValue(n,d)\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter n: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter d: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter value of numerator and denominator: 3 4\n", + "Numerator set inside constructor 3\n", + "Denominator set inside constructor 4\n", + "Numerator value retrieved: 3\n", + "Denominator value retrieved: 4\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.7, page no:221" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction:\n", + " \n", + " def __init__(self,a=0,b=1): #constructor\n", + " self.__num=a\n", + " self.__denom=b\n", + " print \"Numerator set inside constructor: \",self.__num\n", + " print \"Denominator set inside constructor: \",self.__denom \n", + " \n", + " def GetValue(self,a,b):\n", + " return self.__num,self.__denom\n", + "n=input(\"Enter n: \") #user input\n", + "d=input(\"Enter d: \") #user input\n", + "print \"Please enter the value of the numerator and denominator: \",n,d\n", + "f=Fraction(n,d)\n", + "n,d=f.GetValue(n,d)\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d\n", + "n=input(\"Please enter the value of numerator only: \")\n", + "f1=Fraction(n)\n", + "n,d=f1.GetValue(n,d)\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d\n", + "print 'ok..now I will create a fraction-no input please'\n", + "f2=Fraction()\n", + "n,d=f2.GetValue(n,d)\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter n: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter d: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter the value of the numerator and denominator: 3 4\n", + "Numerator set inside constructor: 3\n", + "Denominator set inside constructor: 4\n", + "Numerator value retrieved: 3\n", + "Denominator value retrieved: 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter the value of numerator only: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Numerator set inside constructor: 3\n", + "Denominator set inside constructor: 1\n", + "Numerator value retrieved: 3\n", + "Denominator value retrieved: 1\n", + "ok..now I will create a fraction-no input please\n", + "Numerator set inside constructor: 0\n", + "Denominator set inside constructor: 1\n", + "Numerator value retrieved: 0\n", + "Denominator value retrieved: 1\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.8, page no:223" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction:\n", + " def_init_num=None #private members\n", + " def_init_denom=None #private members\n", + " \n", + " def __init__(self,anotherFraction=None): \n", + " if anotherFraction==None: #normal constructor\n", + " self.__num=anotherFraction\n", + " self.__denom=anotherFraction\n", + " else: #copy constructor\n", + " self.__num=anotherFraction.self.__num\n", + " self.__denom=anotherFraction.self.__denom\n", + " \n", + " \n", + " #public functions\n", + " def SetValue(self,a,b):\n", + " self.__num=a\n", + " self.__denom=b#refer to IntegerData\n", + " def GetValue(self,a,b):\n", + " a=self.__num\n", + " b=self.__denom\n", + " return a,b\n", + " \n", + "f=Fraction()\n", + "n=input(\"Enter n: \") #user input\n", + "d=input(\"Enter d: \") #user input\n", + "print \"enter the numerator and denominator: \", ' ',n,d\n", + "\n", + "f.SetValue(n,d) #call function SetValue\n", + "print \"Numerator value set: \", ' ',n\n", + "print \"Denominator value set: \", ' ',d\n", + "f.GetValue(n,d) #call function GetData\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d\n", + "print \"Now a second clone copy is being created: \",''\n", + "f1=f\n", + "f1.GetValue(n,d)\n", + "print \"Clone's numerator value retrieved: \", ' ',n\n", + "print \"Clone's denominator value retrieved: \", ' ',d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter n: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter d: 6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "enter the numerator and denominator: 5 6\n", + "Numerator value set: 5\n", + "Denominator value set: 6\n", + "Numerator value retrieved: 5\n", + "Denominator value retrieved: 6\n", + "Now a second clone copy is being created: \n", + "Clone's numerator value retrieved: 5\n", + "Clone's denominator value retrieved: 6\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.9, page no:229" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def MyNewHandler():\n", + " print \"Sorry operator new failed to allocate memory\"\n", + " exit(0)\n", + " \n", + "def _set_new_handler(s):\n", + " s()\n", + "#In python there is no in-built _set_new_handler function, so i made this function and passed MyNewHandler function as a parameters\n", + "_set_new_handler(MyNewHandler)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sorry operator new failed to allocate memory\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.10, page no:230" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import * \n", + "class Fraction: \n", + " def __init__(self,a=0,b=1): \n", + " if isinstance(a,int): \n", + " c = c_int(a) \n", + " d = c_int(b) \n", + " self.__num = pointer(c) \n", + " self.__denom = pointer(d) \n", + " print 'constructor sets numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", + " else:\n", + " c=c_int(a.__num[0])\n", + " d = c_int(a.__denom[0])\n", + " self.__num = pointer(c) \n", + " self.__denom = pointer(d)\n", + " print 'copy constructor sets numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", + " \n", + " def __del__(self): \n", + " print 'destructor deallocates numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", + " \n", + "n = input(\"Please enter values of numerator: \") \n", + "d = input(\"Please enter values of denominator: \") \n", + "f = Fraction(n,d) \n", + "print 'Please enter another set of ' \n", + "n = input(\"numerator: \") \n", + "d = input(\"denominator: \") \n", + "print 'Creating fraction *pf : ' \n", + "pf = Fraction(n,d) \n", + "print 'Now a clone copy (f2) created from *pf: ' \n", + "f2 = Fraction(pf)\n", + "print 'Now another clone copy (*pf2) created from f:' \n", + "pf2 = Fraction(f) \n", + "print '*pf2 is being destroyed:' \n", + "del pf2\n", + "print '*pf is being destroyed:' \n", + "del pf \n", + "print 'now objects f2 and f automatically destroyed : '" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter values of numerator: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter values of denominator: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "constructor sets numerator = 3 , denominator = 4\n", + "Please enter another set of \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "numerator: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "denominator: 6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Creating fraction *pf : \n", + "constructor sets numerator = 5 , denominator = 6\n", + "Now a clone copy (f2) created from *pf: \n", + "copy constructor sets numerator = 5 , denominator = 6\n", + "Now another clone copy (*pf2) created from f:\n", + "copy constructor sets numerator = 3 , denominator = 4\n", + "*pf2 is being destroyed:\n", + "*pf is being destroyed:\n", + "now objects f2 and f automatically destroyed : \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.11, page no:234" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Memfail(self,s):\n", + " print \"Sorry Unable to allocate memory\"\n", + " sys.exit(0)\n", + "\n", + "MAX_SIZE = 60 + 1\n", + "\n", + "MAX_SIZE=[[0 for col in range(MAX_SIZE)]for row in range(MAX_SIZE)]\n", + "nChar=0\n", + "chArr=\"Hello\"\n", + "\n", + "print \"Please input a string( 60 characters max.): \",chArr\n", + "\n", + "nChar=len(chArr)+1\n", + "szStr=chArr\n", + "print \"required memory space for\",nChar,\n", + "print \"characters\"\n", + "chArr=szStr #string copy\n", + "szStr=chArr\n", + "print \"String copied in allocated space: \",szStr\n", + "print \"Memory space dellocated\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please input a string( 60 characters max.): Hello\n", + "required memory space for 6 characters\n", + "String copied in allocated space: Hello\n", + "Memory space dellocated\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.12, page no:236" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction:\n", + " \n", + " def __init__(self,a=0,b=1): #constructor\n", + " self.__num=a\n", + " self.__denom=b\n", + " \n", + " def __del__(self): #destructor\n", + " pass\n", + " \n", + " def GetValue(self,a,b):\n", + " a=self.__num\n", + " b=self.__denom\n", + " return self.__num,self.__denom\n", + "n=4\n", + "d=5\n", + "f=Fraction(4,5)\n", + "n,d=f.GetValue(n,d)" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.13, page no:239" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class X:\n", + " __sa=20 #initialising static member\n", + " a = None\n", + " def __init__(self):\n", + " self.a=None #public member\n", + " def f(self,b):\n", + " a=30\n", + " print \"Global a= \",b\n", + " print \"Local a= \",a\n", + " print \"Nonstatic member a= \",self.a\n", + " print \"static member sa= \",self.__sa\n", + "\n", + "a=10\n", + "\n", + "aXobj=X()\n", + "aXobj.a=40\n", + "aXobj.f(a)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Global a= 10\n", + "Local a= 30\n", + "Nonstatic member a= 40\n", + "static member sa= 20\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8_Data.ipynb b/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8_Data.ipynb deleted file mode 100755 index 7eb86cba..00000000 --- a/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8_Data.ipynb +++ /dev/null @@ -1,809 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:cceaf517d4ab644356e85522addd8c655c7a27bbc143387c58a9d5656be364df" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.1, page no: 208" - ] - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 8: Data Abstraction through Classes and User-Defined Data Types " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Super:\n", - " def __init__(self):\n", - " self.__IntegerData=None #private member\n", - " #public functions\n", - " def SetData(self,i):\n", - " self.__IntegerData=i #refer to IntegerData\n", - " def ShowData(self):\n", - " print \"Data is \",self.__IntegerData,' '\n", - "\n", - "ob1=Super()\n", - "ob2=Super()\n", - "ob1.SetData(1000)\n", - "ob2.SetData(2000)\n", - "ob1.ShowData()\n", - "ob2.ShowData()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Data is 1000 \n", - "Data is 2000 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.2, page no:211" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class X:\n", - " def __init__(self):\n", - " self.a=None #private members\n", - " self.b=None #private members\n", - " \n", - "#no structure type present in python \n", - "x = X()\n", - "\n", - "x.a=0\n", - "x.b=1\n", - "print \"x.a=\",x.a,\",x.b=\",x.b" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "x.a= 0 ,x.b= 1\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.3, page no:214" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " \n", - " def SetValue(self,a,b): #public functions\n", - " self.__num=a \n", - " self.__denom=b \n", - " def GetValue(self,a,b):\n", - " a=self.__num\n", - " b=self.__denom\n", - " \n", - "f=Fraction()\n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"enter the numerator and denominator: \", ' ',n,d\n", - "\n", - "f.SetValue(n,d) #call function SetValue\n", - "print \"Numerator value set: \", ' ',n\n", - "print \"Denominator value set: \", ' ',d\n", - "f.GetValue(n,d) #call function GetData\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "enter the numerator and denominator: 3 4\n", - "Numerator value set: 3\n", - "Denominator value set: 4\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 4\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.4, page no:216" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class SimpleClass:\n", - " def __init__(self):\n", - " self.__i=None #private member\n", - " \n", - " def __init__(self):\n", - " self.__i=500 #constructor\n", - " \n", - " def SetData(self,d):\n", - " self.__i=d\n", - " \n", - " def GetData(self):\n", - " return self.__i\n", - " \n", - "#Initializing\n", - "s1=SimpleClass()\n", - "s2=SimpleClass()\n", - "print \"s1 has data: \",s1.GetData()\n", - "print \"s2 has data: \",s2.GetData()\n", - "s1.SetData(1000) #function call\n", - "s2.SetData(2000)\n", - "print \"s1 has data: \",s1.GetData(),' '\n", - "print \"s2 has data: \", s2.GetData(),' '\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "s1 has data: 500\n", - "s2 has data: 500\n", - "s1 has data: 1000 \n", - "s2 has data: 2000 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.5, page no:217" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class SimpleClass:\n", - " __IntegerData=None\n", - " def __init__(self,data=None):\n", - " if data==None:\n", - " self.__IntegerData=500 #default constructor\n", - " else:\n", - " self.__IntegerData=data #parameterised constructor\n", - " \n", - " def SetData(self,d):\n", - " self.__IntegerData=d\n", - " \n", - " def GetData(self):\n", - " return self.__IntegerData\n", - " \n", - "#Initializing\n", - "s1=SimpleClass()\n", - "s2=SimpleClass()\n", - "s3=SimpleClass(400)\n", - "s4=SimpleClass(600)\n", - "print \"s1 has data: \",s1.GetData(),' '\n", - "print \"s2 has data: \",s2.GetData(),' '\n", - "print \"s3 has data: \",s3.GetData(),' '\n", - "print \"s4 has data: \",s4.GetData(),' '\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "s1 has data: 500 \n", - "s2 has data: 500 \n", - "s3 has data: 400 \n", - "s4 has data: 600 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.6, page no:218" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction: \n", - " def_init_num=None #private members\n", - " def_init_denom=None #private members\n", - " def __init__(self,a=0,b=1):\n", - " self.__num=a\n", - " self.__denom=b\n", - " print \"Numerator set inside constructor\",' ',n\n", - " print \"Denominator set inside constructor\",' ',d\n", - " \n", - " def SetValue(self,a,b):\n", - " self.__num=a\n", - " self.__denom=b\n", - " def GetValue(self,a,b):\n", - " a= self.__num\n", - " b= self.__denom\n", - " return a,b\n", - " \n", - " def __del__(self): #destructor\n", - " pass\n", - " \n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"Please enter value of numerator and denominator: \",' ',n,d\n", - "f=Fraction(n,d)\n", - "f.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter value of numerator and denominator: 3 4\n", - "Numerator set inside constructor 3\n", - "Denominator set inside constructor 4\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 4\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.7, page no:221" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " \n", - " def __init__(self,a=0,b=1): #constructor\n", - " self.__num=a\n", - " self.__denom=b\n", - " print \"Numerator set inside constructor: \",self.__num\n", - " print \"Denominator set inside constructor: \",self.__denom \n", - " \n", - " def GetValue(self,a,b):\n", - " return self.__num,self.__denom\n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"Please enter the value of the numerator and denominator: \",n,d\n", - "f=Fraction(n,d)\n", - "n,d=f.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d\n", - "n=input(\"Please enter the value of numerator only: \")\n", - "f1=Fraction(n)\n", - "n,d=f1.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d\n", - "print 'ok..now I will create a fraction-no input please'\n", - "f2=Fraction()\n", - "n,d=f2.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter the value of the numerator and denominator: 3 4\n", - "Numerator set inside constructor: 3\n", - "Denominator set inside constructor: 4\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter the value of numerator only: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Numerator set inside constructor: 3\n", - "Denominator set inside constructor: 1\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 1\n", - "ok..now I will create a fraction-no input please\n", - "Numerator set inside constructor: 0\n", - "Denominator set inside constructor: 1\n", - "Numerator value retrieved: 0\n", - "Denominator value retrieved: 1\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.8, page no:223" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " def_init_num=None #private members\n", - " def_init_denom=None #private members\n", - " \n", - " def __init__(self,anotherFraction=None): \n", - " if anotherFraction==None: #normal constructor\n", - " self.__num=anotherFraction\n", - " self.__denom=anotherFraction\n", - " else: #copy constructor\n", - " self.__num=anotherFraction.self.__num\n", - " self.__denom=anotherFraction.self.__denom\n", - " \n", - " \n", - " #public functions\n", - " def SetValue(self,a,b):\n", - " self.__num=a\n", - " self.__denom=b#refer to IntegerData\n", - " def GetValue(self,a,b):\n", - " a=self.__num\n", - " b=self.__denom\n", - " return a,b\n", - " \n", - "f=Fraction()\n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"enter the numerator and denominator: \", ' ',n,d\n", - "\n", - "f.SetValue(n,d) #call function SetValue\n", - "print \"Numerator value set: \", ' ',n\n", - "print \"Denominator value set: \", ' ',d\n", - "f.GetValue(n,d) #call function GetData\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d\n", - "print \"Now a second clone copy is being created: \",''\n", - "f1=f\n", - "f1.GetValue(n,d)\n", - "print \"Clone's numerator value retrieved: \", ' ',n\n", - "print \"Clone's denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "enter the numerator and denominator: 5 6\n", - "Numerator value set: 5\n", - "Denominator value set: 6\n", - "Numerator value retrieved: 5\n", - "Denominator value retrieved: 6\n", - "Now a second clone copy is being created: \n", - "Clone's numerator value retrieved: 5\n", - "Clone's denominator value retrieved: 6\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.9, page no:229" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def MyNewHandler():\n", - " print \"Sorry operator new failed to allocate memory\"\n", - " exit(0)\n", - " \n", - "def _set_new_handler(s):\n", - " s()\n", - "#In python there is no in-built _set_new_handler function, so i made this function and passed MyNewHandler function as a parameters\n", - "_set_new_handler(MyNewHandler)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sorry operator new failed to allocate memory\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.10, page no:230" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import * \n", - "class Fraction: \n", - " def __init__(self,a=0,b=1): \n", - " if isinstance(a,int): \n", - " c = c_int(a) \n", - " d = c_int(b) \n", - " self.__num = pointer(c) \n", - " self.__denom = pointer(d) \n", - " print 'constructor sets numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", - " else:\n", - " c=c_int(a.__num[0])\n", - " d = c_int(a.__denom[0])\n", - " self.__num = pointer(c) \n", - " self.__denom = pointer(d)\n", - " print 'copy constructor sets numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", - " \n", - " def __del__(self): \n", - " print 'destructor deallocates numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", - " \n", - "n = input(\"Please enter values of numerator: \") \n", - "d = input(\"Please enter values of denominator: \") \n", - "f = Fraction(n,d) \n", - "print 'Please enter another set of ' \n", - "n = input(\"numerator: \") \n", - "d = input(\"denominator: \") \n", - "print 'Creating fraction *pf : ' \n", - "pf = Fraction(n,d) \n", - "print 'Now a clone copy (f2) created from *pf: ' \n", - "f2 = Fraction(pf)\n", - "print 'Now another clone copy (*pf2) created from f:' \n", - "pf2 = Fraction(f) \n", - "print '*pf2 is being destroyed:' \n", - "del pf2\n", - "print '*pf is being destroyed:' \n", - "del pf \n", - "print 'now objects f2 and f automatically destroyed : '" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter values of numerator: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter values of denominator: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "constructor sets numerator = 3 , denominator = 4\n", - "Please enter another set of \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "numerator: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "denominator: 6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Creating fraction *pf : \n", - "constructor sets numerator = 5 , denominator = 6\n", - "Now a clone copy (f2) created from *pf: \n", - "copy constructor sets numerator = 5 , denominator = 6\n", - "Now another clone copy (*pf2) created from f:\n", - "copy constructor sets numerator = 3 , denominator = 4\n", - "*pf2 is being destroyed:\n", - "*pf is being destroyed:\n", - "now objects f2 and f automatically destroyed : \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.11, page no:234" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Memfail(self,s):\n", - " print \"Sorry Unable to allocate memory\"\n", - " sys.exit(0)\n", - "\n", - "MAX_SIZE = 60 + 1\n", - "\n", - "MAX_SIZE=[[0 for col in range(MAX_SIZE)]for row in range(MAX_SIZE)]\n", - "nChar=0\n", - "chArr=\"Hello\"\n", - "\n", - "print \"Please input a string( 60 characters max.): \",chArr\n", - "\n", - "nChar=len(chArr)+1\n", - "szStr=chArr\n", - "print \"required memory space for\",nChar,\n", - "print \"characters\"\n", - "chArr=szStr #string copy\n", - "szStr=chArr\n", - "print \"String copied in allocated space: \",szStr\n", - "print \"Memory space dellocated\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please input a string( 60 characters max.): Hello\n", - "required memory space for 6 characters\n", - "String copied in allocated space: Hello\n", - "Memory space dellocated\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.12, page no:236" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " \n", - " def __init__(self,a=0,b=1): #constructor\n", - " self.__num=a\n", - " self.__denom=b\n", - " \n", - " def __del__(self): #destructor\n", - " pass\n", - " \n", - " def GetValue(self,a,b):\n", - " a=self.__num\n", - " b=self.__denom\n", - " return self.__num,self.__denom\n", - "n=4\n", - "d=5\n", - "f=Fraction(4,5)\n", - "n,d=f.GetValue(n,d)" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.13, page no:239" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class X:\n", - " __sa=20 #initialising static member\n", - " a = None\n", - " def __init__(self):\n", - " self.a=None #public member\n", - " def f(self,b):\n", - " a=30\n", - " print \"Global a= \",b\n", - " print \"Local a= \",a\n", - " print \"Nonstatic member a= \",self.a\n", - " print \"static member sa= \",self.__sa\n", - "\n", - "a=10\n", - "\n", - "aXobj=X()\n", - "aXobj.a=40\n", - "aXobj.f(a)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Global a= 10\n", - "Local a= 30\n", - "Nonstatic member a= 40\n", - "static member sa= 20\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8_Data_Abstraction_through_Classes_and_User-Defined_Data.ipynb b/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8_Data_Abstraction_through_Classes_and_User-Defined_Data.ipynb deleted file mode 100755 index a7c3a90a..00000000 --- a/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8_Data_Abstraction_through_Classes_and_User-Defined_Data.ipynb +++ /dev/null @@ -1,809 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:da354bb89e19562e65167a0447837d31b8126b13ef9a65d132ea4ce7ac74a2e3" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 8: Data Abstraction through Classes and User-Defined Data Types" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.1, page no:208" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Super:\n", - " def __init__(self):\n", - " self.__IntegerData=None #private member\n", - " #public functions\n", - " def SetData(self,i):\n", - " self.__IntegerData=i #refer to IntegerData\n", - " def ShowData(self):\n", - " print \"Data is \",self.__IntegerData,' '\n", - "\n", - "ob1=Super()\n", - "ob2=Super()\n", - "ob1.SetData(1000)\n", - "ob2.SetData(2000)\n", - "ob1.ShowData()\n", - "ob2.ShowData()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Data is 1000 \n", - "Data is 2000 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.2, page no:211" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class X:\n", - " def __init__(self):\n", - " self.a=None #private members\n", - " self.b=None #private members\n", - " \n", - "#no structure type present in python \n", - "x = X()\n", - "\n", - "x.a=0\n", - "x.b=1\n", - "print \"x.a=\",x.a,\",x.b=\",x.b" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "x.a= 0 ,x.b= 1\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.3, page no:214" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " \n", - " def SetValue(self,a,b): #public functions\n", - " self.__num=a \n", - " self.__denom=b \n", - " def GetValue(self,a,b):\n", - " a=self.__num\n", - " b=self.__denom\n", - " \n", - "f=Fraction()\n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"enter the numerator and denominator: \", ' ',n,d\n", - "\n", - "f.SetValue(n,d) #call function SetValue\n", - "print \"Numerator value set: \", ' ',n\n", - "print \"Denominator value set: \", ' ',d\n", - "f.GetValue(n,d) #call function GetData\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "enter the numerator and denominator: 3 4\n", - "Numerator value set: 3\n", - "Denominator value set: 4\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 4\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.4, page no:216" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class SimpleClass:\n", - " def __init__(self):\n", - " self.__i=None #private member\n", - " \n", - " def __init__(self):\n", - " self.__i=500 #constructor\n", - " \n", - " def SetData(self,d):\n", - " self.__i=d\n", - " \n", - " def GetData(self):\n", - " return self.__i\n", - " \n", - "#Initializing\n", - "s1=SimpleClass()\n", - "s2=SimpleClass()\n", - "print \"s1 has data: \",s1.GetData()\n", - "print \"s2 has data: \",s2.GetData()\n", - "s1.SetData(1000) #function call\n", - "s2.SetData(2000)\n", - "print \"s1 has data: \",s1.GetData(),' '\n", - "print \"s2 has data: \", s2.GetData(),' '\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "s1 has data: 500\n", - "s2 has data: 500\n", - "s1 has data: 1000 \n", - "s2 has data: 2000 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.5, page no:217" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class SimpleClass:\n", - " __IntegerData=None\n", - " def __init__(self,data=None):\n", - " if data==None:\n", - " self.__IntegerData=500 #default constructor\n", - " else:\n", - " self.__IntegerData=data #parameterised constructor\n", - " \n", - " def SetData(self,d):\n", - " self.__IntegerData=d\n", - " \n", - " def GetData(self):\n", - " return self.__IntegerData\n", - " \n", - "#Initializing\n", - "s1=SimpleClass()\n", - "s2=SimpleClass()\n", - "s3=SimpleClass(400)\n", - "s4=SimpleClass(600)\n", - "print \"s1 has data: \",s1.GetData(),' '\n", - "print \"s2 has data: \",s2.GetData(),' '\n", - "print \"s3 has data: \",s3.GetData(),' '\n", - "print \"s4 has data: \",s4.GetData(),' '\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "s1 has data: 500 \n", - "s2 has data: 500 \n", - "s3 has data: 400 \n", - "s4 has data: 600 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.6, page no:218" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction: \n", - " def_init_num=None #private members\n", - " def_init_denom=None #private members\n", - " def __init__(self,a=0,b=1):\n", - " self.__num=a\n", - " self.__denom=b\n", - " print \"Numerator set inside constructor\",' ',n\n", - " print \"Denominator set inside constructor\",' ',d\n", - " \n", - " def SetValue(self,a,b):\n", - " self.__num=a\n", - " self.__denom=b\n", - " def GetValue(self,a,b):\n", - " a= self.__num\n", - " b= self.__denom\n", - " return a,b\n", - " \n", - " def __del__(self): #destructor\n", - " pass\n", - " \n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"Please enter value of numerator and denominator: \",' ',n,d\n", - "f=Fraction(n,d)\n", - "f.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter value of numerator and denominator: 3 4\n", - "Numerator set inside constructor 3\n", - "Denominator set inside constructor 4\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 4\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.7, page no:221" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " \n", - " def __init__(self,a=0,b=1): #constructor\n", - " self.__num=a\n", - " self.__denom=b\n", - " print \"Numerator set inside constructor: \",self.__num\n", - " print \"Denominator set inside constructor: \",self.__denom \n", - " \n", - " def GetValue(self,a,b):\n", - " return self.__num,self.__denom\n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"Please enter the value of the numerator and denominator: \",n,d\n", - "f=Fraction(n,d)\n", - "n,d=f.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d\n", - "n=input(\"Please enter the value of numerator only: \")\n", - "f1=Fraction(n)\n", - "n,d=f1.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d\n", - "print 'ok..now I will create a fraction-no input please'\n", - "f2=Fraction()\n", - "n,d=f2.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter the value of the numerator and denominator: 3 4\n", - "Numerator set inside constructor: 3\n", - "Denominator set inside constructor: 4\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter the value of numerator only: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Numerator set inside constructor: 3\n", - "Denominator set inside constructor: 1\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 1\n", - "ok..now I will create a fraction-no input please\n", - "Numerator set inside constructor: 0\n", - "Denominator set inside constructor: 1\n", - "Numerator value retrieved: 0\n", - "Denominator value retrieved: 1\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.8, page no:223" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " def_init_num=None #private members\n", - " def_init_denom=None #private members\n", - " \n", - " def __init__(self,anotherFraction=None): \n", - " if anotherFraction==None: #normal constructor\n", - " self.__num=anotherFraction\n", - " self.__denom=anotherFraction\n", - " else: #copy constructor\n", - " self.__num=anotherFraction.self.__num\n", - " self.__denom=anotherFraction.self.__denom\n", - " \n", - " \n", - " #public functions\n", - " def SetValue(self,a,b):\n", - " self.__num=a\n", - " self.__denom=b#refer to IntegerData\n", - " def GetValue(self,a,b):\n", - " a=self.__num\n", - " b=self.__denom\n", - " return a,b\n", - " \n", - "f=Fraction()\n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"enter the numerator and denominator: \", ' ',n,d\n", - "\n", - "f.SetValue(n,d) #call function SetValue\n", - "print \"Numerator value set: \", ' ',n\n", - "print \"Denominator value set: \", ' ',d\n", - "f.GetValue(n,d) #call function GetData\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d\n", - "print \"Now a second clone copy is being created: \",''\n", - "f1=f\n", - "f1.GetValue(n,d)\n", - "print \"Clone's numerator value retrieved: \", ' ',n\n", - "print \"Clone's denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "enter the numerator and denominator: 5 6\n", - "Numerator value set: 5\n", - "Denominator value set: 6\n", - "Numerator value retrieved: 5\n", - "Denominator value retrieved: 6\n", - "Now a second clone copy is being created: \n", - "Clone's numerator value retrieved: 5\n", - "Clone's denominator value retrieved: 6\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.9, page no:229" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def MyNewHandler():\n", - " print \"Sorry operator new failed to allocate memory\"\n", - " exit(0)\n", - " \n", - "def _set_new_handler(s):\n", - " s()\n", - "#In python there is no in-built _set_new_handler function, so i made this function and passed MyNewHandler function as a parameters\n", - "_set_new_handler(MyNewHandler)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sorry operator new failed to allocate memory\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.10, page no:230" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import * \n", - "class Fraction: \n", - " def __init__(self,a=0,b=1): \n", - " if isinstance(a,int): \n", - " c = c_int(a) \n", - " d = c_int(b) \n", - " self.__num = pointer(c) \n", - " self.__denom = pointer(d) \n", - " print 'constructor sets numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", - " else:\n", - " c=c_int(a.__num[0])\n", - " d = c_int(a.__denom[0])\n", - " self.__num = pointer(c) \n", - " self.__denom = pointer(d)\n", - " print 'copy constructor sets numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", - " \n", - " def __del__(self): \n", - " print 'destructor deallocates numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", - " \n", - "n = input(\"Please enter values of numerator: \") \n", - "d = input(\"Please enter values of denominator: \") \n", - "f = Fraction(n,d) \n", - "print 'Please enter another set of ' \n", - "n = input(\"numerator: \") \n", - "d = input(\"denominator: \") \n", - "print 'Creating fraction *pf : ' \n", - "pf = Fraction(n,d) \n", - "print 'Now a clone copy (f2) created from *pf: ' \n", - "f2 = Fraction(pf)\n", - "print 'Now another clone copy (*pf2) created from f:' \n", - "pf2 = Fraction(f) \n", - "print '*pf2 is being destroyed:' \n", - "del pf2\n", - "print '*pf is being destroyed:' \n", - "del pf \n", - "print 'now objects f2 and f automatically destroyed : '" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter values of numerator: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter values of denominator: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "constructor sets numerator = 3 , denominator = 4\n", - "Please enter another set of \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "numerator: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "denominator: 6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Creating fraction *pf : \n", - "constructor sets numerator = 5 , denominator = 6\n", - "Now a clone copy (f2) created from *pf: \n", - "copy constructor sets numerator = 5 , denominator = 6\n", - "Now another clone copy (*pf2) created from f:\n", - "copy constructor sets numerator = 3 , denominator = 4\n", - "*pf2 is being destroyed:\n", - "*pf is being destroyed:\n", - "now objects f2 and f automatically destroyed : \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.11, page no:234" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Memfail(self,s):\n", - " print \"Sorry Unable to allocate memory\"\n", - " sys.exit(0)\n", - "\n", - "MAX_SIZE = 60 + 1\n", - "\n", - "MAX_SIZE=[[0 for col in range(MAX_SIZE)]for row in range(MAX_SIZE)]\n", - "nChar=0\n", - "chArr=\"Hello\"\n", - "\n", - "print \"Please input a string( 60 characters max.): \",chArr\n", - "\n", - "nChar=len(chArr)+1\n", - "szStr=chArr\n", - "print \"required memory space for\",nChar,\n", - "print \"characters\"\n", - "chArr=szStr #string copy\n", - "szStr=chArr\n", - "print \"String copied in allocated space: \",szStr\n", - "print \"Memory space dellocated\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please input a string( 60 characters max.): Hello\n", - "required memory space for 6 characters\n", - "String copied in allocated space: Hello\n", - "Memory space dellocated\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.12, page no:236" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " \n", - " def __init__(self,a=0,b=1): #constructor\n", - " self.__num=a\n", - " self.__denom=b\n", - " \n", - " def __del__(self): #destructor\n", - " pass\n", - " \n", - " def GetValue(self,a,b):\n", - " a=self.__num\n", - " b=self.__denom\n", - " return self.__num,self.__denom\n", - "n=4\n", - "d=5\n", - "f=Fraction(4,5)\n", - "n,d=f.GetValue(n,d)" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.13, page no:239" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class X:\n", - " __sa=20 #initialising static member\n", - " a = None\n", - " def __init__(self):\n", - " self.a=None #public member\n", - " def f(self,b):\n", - " a=30\n", - " print \"Global a= \",b\n", - " print \"Local a= \",a\n", - " print \"Nonstatic member a= \",self.a\n", - " print \"static member sa= \",self.__sa\n", - "\n", - "a=10\n", - "\n", - "aXobj=X()\n", - "aXobj.a=40\n", - "aXobj.f(a)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Global a= 10\n", - "Local a= 30\n", - "Nonstatic member a= 40\n", - "static member sa= 20\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8_Data_Abstraction_through_Classes_and_User_Defined_Data.ipynb b/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8_Data_Abstraction_through_Classes_and_User_Defined_Data.ipynb deleted file mode 100755 index 7eb86cba..00000000 --- a/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/Chapter_8_Data_Abstraction_through_Classes_and_User_Defined_Data.ipynb +++ /dev/null @@ -1,809 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:cceaf517d4ab644356e85522addd8c655c7a27bbc143387c58a9d5656be364df" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.1, page no: 208" - ] - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 8: Data Abstraction through Classes and User-Defined Data Types " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Super:\n", - " def __init__(self):\n", - " self.__IntegerData=None #private member\n", - " #public functions\n", - " def SetData(self,i):\n", - " self.__IntegerData=i #refer to IntegerData\n", - " def ShowData(self):\n", - " print \"Data is \",self.__IntegerData,' '\n", - "\n", - "ob1=Super()\n", - "ob2=Super()\n", - "ob1.SetData(1000)\n", - "ob2.SetData(2000)\n", - "ob1.ShowData()\n", - "ob2.ShowData()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Data is 1000 \n", - "Data is 2000 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.2, page no:211" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class X:\n", - " def __init__(self):\n", - " self.a=None #private members\n", - " self.b=None #private members\n", - " \n", - "#no structure type present in python \n", - "x = X()\n", - "\n", - "x.a=0\n", - "x.b=1\n", - "print \"x.a=\",x.a,\",x.b=\",x.b" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "x.a= 0 ,x.b= 1\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.3, page no:214" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " \n", - " def SetValue(self,a,b): #public functions\n", - " self.__num=a \n", - " self.__denom=b \n", - " def GetValue(self,a,b):\n", - " a=self.__num\n", - " b=self.__denom\n", - " \n", - "f=Fraction()\n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"enter the numerator and denominator: \", ' ',n,d\n", - "\n", - "f.SetValue(n,d) #call function SetValue\n", - "print \"Numerator value set: \", ' ',n\n", - "print \"Denominator value set: \", ' ',d\n", - "f.GetValue(n,d) #call function GetData\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "enter the numerator and denominator: 3 4\n", - "Numerator value set: 3\n", - "Denominator value set: 4\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 4\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.4, page no:216" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class SimpleClass:\n", - " def __init__(self):\n", - " self.__i=None #private member\n", - " \n", - " def __init__(self):\n", - " self.__i=500 #constructor\n", - " \n", - " def SetData(self,d):\n", - " self.__i=d\n", - " \n", - " def GetData(self):\n", - " return self.__i\n", - " \n", - "#Initializing\n", - "s1=SimpleClass()\n", - "s2=SimpleClass()\n", - "print \"s1 has data: \",s1.GetData()\n", - "print \"s2 has data: \",s2.GetData()\n", - "s1.SetData(1000) #function call\n", - "s2.SetData(2000)\n", - "print \"s1 has data: \",s1.GetData(),' '\n", - "print \"s2 has data: \", s2.GetData(),' '\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "s1 has data: 500\n", - "s2 has data: 500\n", - "s1 has data: 1000 \n", - "s2 has data: 2000 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.5, page no:217" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class SimpleClass:\n", - " __IntegerData=None\n", - " def __init__(self,data=None):\n", - " if data==None:\n", - " self.__IntegerData=500 #default constructor\n", - " else:\n", - " self.__IntegerData=data #parameterised constructor\n", - " \n", - " def SetData(self,d):\n", - " self.__IntegerData=d\n", - " \n", - " def GetData(self):\n", - " return self.__IntegerData\n", - " \n", - "#Initializing\n", - "s1=SimpleClass()\n", - "s2=SimpleClass()\n", - "s3=SimpleClass(400)\n", - "s4=SimpleClass(600)\n", - "print \"s1 has data: \",s1.GetData(),' '\n", - "print \"s2 has data: \",s2.GetData(),' '\n", - "print \"s3 has data: \",s3.GetData(),' '\n", - "print \"s4 has data: \",s4.GetData(),' '\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "s1 has data: 500 \n", - "s2 has data: 500 \n", - "s3 has data: 400 \n", - "s4 has data: 600 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.6, page no:218" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction: \n", - " def_init_num=None #private members\n", - " def_init_denom=None #private members\n", - " def __init__(self,a=0,b=1):\n", - " self.__num=a\n", - " self.__denom=b\n", - " print \"Numerator set inside constructor\",' ',n\n", - " print \"Denominator set inside constructor\",' ',d\n", - " \n", - " def SetValue(self,a,b):\n", - " self.__num=a\n", - " self.__denom=b\n", - " def GetValue(self,a,b):\n", - " a= self.__num\n", - " b= self.__denom\n", - " return a,b\n", - " \n", - " def __del__(self): #destructor\n", - " pass\n", - " \n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"Please enter value of numerator and denominator: \",' ',n,d\n", - "f=Fraction(n,d)\n", - "f.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter value of numerator and denominator: 3 4\n", - "Numerator set inside constructor 3\n", - "Denominator set inside constructor 4\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 4\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.7, page no:221" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " \n", - " def __init__(self,a=0,b=1): #constructor\n", - " self.__num=a\n", - " self.__denom=b\n", - " print \"Numerator set inside constructor: \",self.__num\n", - " print \"Denominator set inside constructor: \",self.__denom \n", - " \n", - " def GetValue(self,a,b):\n", - " return self.__num,self.__denom\n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"Please enter the value of the numerator and denominator: \",n,d\n", - "f=Fraction(n,d)\n", - "n,d=f.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d\n", - "n=input(\"Please enter the value of numerator only: \")\n", - "f1=Fraction(n)\n", - "n,d=f1.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d\n", - "print 'ok..now I will create a fraction-no input please'\n", - "f2=Fraction()\n", - "n,d=f2.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter the value of the numerator and denominator: 3 4\n", - "Numerator set inside constructor: 3\n", - "Denominator set inside constructor: 4\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter the value of numerator only: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Numerator set inside constructor: 3\n", - "Denominator set inside constructor: 1\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 1\n", - "ok..now I will create a fraction-no input please\n", - "Numerator set inside constructor: 0\n", - "Denominator set inside constructor: 1\n", - "Numerator value retrieved: 0\n", - "Denominator value retrieved: 1\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.8, page no:223" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " def_init_num=None #private members\n", - " def_init_denom=None #private members\n", - " \n", - " def __init__(self,anotherFraction=None): \n", - " if anotherFraction==None: #normal constructor\n", - " self.__num=anotherFraction\n", - " self.__denom=anotherFraction\n", - " else: #copy constructor\n", - " self.__num=anotherFraction.self.__num\n", - " self.__denom=anotherFraction.self.__denom\n", - " \n", - " \n", - " #public functions\n", - " def SetValue(self,a,b):\n", - " self.__num=a\n", - " self.__denom=b#refer to IntegerData\n", - " def GetValue(self,a,b):\n", - " a=self.__num\n", - " b=self.__denom\n", - " return a,b\n", - " \n", - "f=Fraction()\n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"enter the numerator and denominator: \", ' ',n,d\n", - "\n", - "f.SetValue(n,d) #call function SetValue\n", - "print \"Numerator value set: \", ' ',n\n", - "print \"Denominator value set: \", ' ',d\n", - "f.GetValue(n,d) #call function GetData\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d\n", - "print \"Now a second clone copy is being created: \",''\n", - "f1=f\n", - "f1.GetValue(n,d)\n", - "print \"Clone's numerator value retrieved: \", ' ',n\n", - "print \"Clone's denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "enter the numerator and denominator: 5 6\n", - "Numerator value set: 5\n", - "Denominator value set: 6\n", - "Numerator value retrieved: 5\n", - "Denominator value retrieved: 6\n", - "Now a second clone copy is being created: \n", - "Clone's numerator value retrieved: 5\n", - "Clone's denominator value retrieved: 6\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.9, page no:229" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def MyNewHandler():\n", - " print \"Sorry operator new failed to allocate memory\"\n", - " exit(0)\n", - " \n", - "def _set_new_handler(s):\n", - " s()\n", - "#In python there is no in-built _set_new_handler function, so i made this function and passed MyNewHandler function as a parameters\n", - "_set_new_handler(MyNewHandler)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sorry operator new failed to allocate memory\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.10, page no:230" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import * \n", - "class Fraction: \n", - " def __init__(self,a=0,b=1): \n", - " if isinstance(a,int): \n", - " c = c_int(a) \n", - " d = c_int(b) \n", - " self.__num = pointer(c) \n", - " self.__denom = pointer(d) \n", - " print 'constructor sets numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", - " else:\n", - " c=c_int(a.__num[0])\n", - " d = c_int(a.__denom[0])\n", - " self.__num = pointer(c) \n", - " self.__denom = pointer(d)\n", - " print 'copy constructor sets numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", - " \n", - " def __del__(self): \n", - " print 'destructor deallocates numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", - " \n", - "n = input(\"Please enter values of numerator: \") \n", - "d = input(\"Please enter values of denominator: \") \n", - "f = Fraction(n,d) \n", - "print 'Please enter another set of ' \n", - "n = input(\"numerator: \") \n", - "d = input(\"denominator: \") \n", - "print 'Creating fraction *pf : ' \n", - "pf = Fraction(n,d) \n", - "print 'Now a clone copy (f2) created from *pf: ' \n", - "f2 = Fraction(pf)\n", - "print 'Now another clone copy (*pf2) created from f:' \n", - "pf2 = Fraction(f) \n", - "print '*pf2 is being destroyed:' \n", - "del pf2\n", - "print '*pf is being destroyed:' \n", - "del pf \n", - "print 'now objects f2 and f automatically destroyed : '" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter values of numerator: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter values of denominator: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "constructor sets numerator = 3 , denominator = 4\n", - "Please enter another set of \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "numerator: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "denominator: 6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Creating fraction *pf : \n", - "constructor sets numerator = 5 , denominator = 6\n", - "Now a clone copy (f2) created from *pf: \n", - "copy constructor sets numerator = 5 , denominator = 6\n", - "Now another clone copy (*pf2) created from f:\n", - "copy constructor sets numerator = 3 , denominator = 4\n", - "*pf2 is being destroyed:\n", - "*pf is being destroyed:\n", - "now objects f2 and f automatically destroyed : \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.11, page no:234" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Memfail(self,s):\n", - " print \"Sorry Unable to allocate memory\"\n", - " sys.exit(0)\n", - "\n", - "MAX_SIZE = 60 + 1\n", - "\n", - "MAX_SIZE=[[0 for col in range(MAX_SIZE)]for row in range(MAX_SIZE)]\n", - "nChar=0\n", - "chArr=\"Hello\"\n", - "\n", - "print \"Please input a string( 60 characters max.): \",chArr\n", - "\n", - "nChar=len(chArr)+1\n", - "szStr=chArr\n", - "print \"required memory space for\",nChar,\n", - "print \"characters\"\n", - "chArr=szStr #string copy\n", - "szStr=chArr\n", - "print \"String copied in allocated space: \",szStr\n", - "print \"Memory space dellocated\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please input a string( 60 characters max.): Hello\n", - "required memory space for 6 characters\n", - "String copied in allocated space: Hello\n", - "Memory space dellocated\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.12, page no:236" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " \n", - " def __init__(self,a=0,b=1): #constructor\n", - " self.__num=a\n", - " self.__denom=b\n", - " \n", - " def __del__(self): #destructor\n", - " pass\n", - " \n", - " def GetValue(self,a,b):\n", - " a=self.__num\n", - " b=self.__denom\n", - " return self.__num,self.__denom\n", - "n=4\n", - "d=5\n", - "f=Fraction(4,5)\n", - "n,d=f.GetValue(n,d)" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.13, page no:239" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class X:\n", - " __sa=20 #initialising static member\n", - " a = None\n", - " def __init__(self):\n", - " self.a=None #public member\n", - " def f(self,b):\n", - " a=30\n", - " print \"Global a= \",b\n", - " print \"Local a= \",a\n", - " print \"Nonstatic member a= \",self.a\n", - " print \"static member sa= \",self.__sa\n", - "\n", - "a=10\n", - "\n", - "aXobj=X()\n", - "aXobj.a=40\n", - "aXobj.f(a)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Global a= 10\n", - "Local a= 30\n", - "Nonstatic member a= 40\n", - "static member sa= 20\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/chapter_8_Abstraction_through_Classes_and_User-Defined.ipynb b/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/chapter_8_Abstraction_through_Classes_and_User-Defined.ipynb new file mode 100755 index 00000000..1083b19a --- /dev/null +++ b/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/chapter_8_Abstraction_through_Classes_and_User-Defined.ipynb @@ -0,0 +1,809 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:dbbd8ed92141bcc804ff2fbeacf8bb85f122dc6e196e1d830291a4a449a3a439" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8: Data Abstraction through Classes and User-Defined Data Types " + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.1, page no: 208" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Super:\n", + " def __init__(self):\n", + " self.__IntegerData=None #private member\n", + " #public functions\n", + " def SetData(self,i):\n", + " self.__IntegerData=i #refer to IntegerData\n", + " def ShowData(self):\n", + " print \"Data is \",self.__IntegerData,' '\n", + "\n", + "ob1=Super()\n", + "ob2=Super()\n", + "ob1.SetData(1000)\n", + "ob2.SetData(2000)\n", + "ob1.ShowData()\n", + "ob2.ShowData()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Data is 1000 \n", + "Data is 2000 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.2, page no:211" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class X:\n", + " def __init__(self):\n", + " self.a=None #private members\n", + " self.b=None #private members\n", + " \n", + "#no structure type present in python \n", + "x = X()\n", + "\n", + "x.a=0\n", + "x.b=1\n", + "print \"x.a=\",x.a,\",x.b=\",x.b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x.a= 0 ,x.b= 1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.3, page no:214" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction:\n", + " \n", + " def SetValue(self,a,b): #public functions\n", + " self.__num=a \n", + " self.__denom=b \n", + " def GetValue(self,a,b):\n", + " a=self.__num\n", + " b=self.__denom\n", + " \n", + "f=Fraction()\n", + "n=input(\"Enter n: \") #user input\n", + "d=input(\"Enter d: \") #user input\n", + "print \"enter the numerator and denominator: \", ' ',n,d\n", + "\n", + "f.SetValue(n,d) #call function SetValue\n", + "print \"Numerator value set: \", ' ',n\n", + "print \"Denominator value set: \", ' ',d\n", + "f.GetValue(n,d) #call function GetData\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter n: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter d: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "enter the numerator and denominator: 3 4\n", + "Numerator value set: 3\n", + "Denominator value set: 4\n", + "Numerator value retrieved: 3\n", + "Denominator value retrieved: 4\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.4, page no:216" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class SimpleClass:\n", + " def __init__(self):\n", + " self.__i=None #private member\n", + " \n", + " def __init__(self):\n", + " self.__i=500 #constructor\n", + " \n", + " def SetData(self,d):\n", + " self.__i=d\n", + " \n", + " def GetData(self):\n", + " return self.__i\n", + " \n", + "#Initializing\n", + "s1=SimpleClass()\n", + "s2=SimpleClass()\n", + "print \"s1 has data: \",s1.GetData()\n", + "print \"s2 has data: \",s2.GetData()\n", + "s1.SetData(1000) #function call\n", + "s2.SetData(2000)\n", + "print \"s1 has data: \",s1.GetData(),' '\n", + "print \"s2 has data: \", s2.GetData(),' '\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "s1 has data: 500\n", + "s2 has data: 500\n", + "s1 has data: 1000 \n", + "s2 has data: 2000 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.5, page no:217" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class SimpleClass:\n", + " __IntegerData=None\n", + " def __init__(self,data=None):\n", + " if data==None:\n", + " self.__IntegerData=500 #default constructor\n", + " else:\n", + " self.__IntegerData=data #parameterised constructor\n", + " \n", + " def SetData(self,d):\n", + " self.__IntegerData=d\n", + " \n", + " def GetData(self):\n", + " return self.__IntegerData\n", + " \n", + "#Initializing\n", + "s1=SimpleClass()\n", + "s2=SimpleClass()\n", + "s3=SimpleClass(400)\n", + "s4=SimpleClass(600)\n", + "print \"s1 has data: \",s1.GetData(),' '\n", + "print \"s2 has data: \",s2.GetData(),' '\n", + "print \"s3 has data: \",s3.GetData(),' '\n", + "print \"s4 has data: \",s4.GetData(),' '\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "s1 has data: 500 \n", + "s2 has data: 500 \n", + "s3 has data: 400 \n", + "s4 has data: 600 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.6, page no:218" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction: \n", + " def_init_num=None #private members\n", + " def_init_denom=None #private members\n", + " def __init__(self,a=0,b=1):\n", + " self.__num=a\n", + " self.__denom=b\n", + " print \"Numerator set inside constructor\",' ',n\n", + " print \"Denominator set inside constructor\",' ',d\n", + " \n", + " def SetValue(self,a,b):\n", + " self.__num=a\n", + " self.__denom=b\n", + " def GetValue(self,a,b):\n", + " a= self.__num\n", + " b= self.__denom\n", + " return a,b\n", + " \n", + " def __del__(self): #destructor\n", + " pass\n", + " \n", + "n=input(\"Enter n: \") #user input\n", + "d=input(\"Enter d: \") #user input\n", + "print \"Please enter value of numerator and denominator: \",' ',n,d\n", + "f=Fraction(n,d)\n", + "f.GetValue(n,d)\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter n: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter d: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter value of numerator and denominator: 3 4\n", + "Numerator set inside constructor 3\n", + "Denominator set inside constructor 4\n", + "Numerator value retrieved: 3\n", + "Denominator value retrieved: 4\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.7, page no:221" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction:\n", + " \n", + " def __init__(self,a=0,b=1): #constructor\n", + " self.__num=a\n", + " self.__denom=b\n", + " print \"Numerator set inside constructor: \",self.__num\n", + " print \"Denominator set inside constructor: \",self.__denom \n", + " \n", + " def GetValue(self,a,b):\n", + " return self.__num,self.__denom\n", + "n=input(\"Enter n: \") #user input\n", + "d=input(\"Enter d: \") #user input\n", + "print \"Please enter the value of the numerator and denominator: \",n,d\n", + "f=Fraction(n,d)\n", + "n,d=f.GetValue(n,d)\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d\n", + "n=input(\"Please enter the value of numerator only: \")\n", + "f1=Fraction(n)\n", + "n,d=f1.GetValue(n,d)\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d\n", + "print 'ok..now I will create a fraction-no input please'\n", + "f2=Fraction()\n", + "n,d=f2.GetValue(n,d)\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter n: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter d: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter the value of the numerator and denominator: 3 4\n", + "Numerator set inside constructor: 3\n", + "Denominator set inside constructor: 4\n", + "Numerator value retrieved: 3\n", + "Denominator value retrieved: 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter the value of numerator only: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Numerator set inside constructor: 3\n", + "Denominator set inside constructor: 1\n", + "Numerator value retrieved: 3\n", + "Denominator value retrieved: 1\n", + "ok..now I will create a fraction-no input please\n", + "Numerator set inside constructor: 0\n", + "Denominator set inside constructor: 1\n", + "Numerator value retrieved: 0\n", + "Denominator value retrieved: 1\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.8, page no:223" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction:\n", + " def_init_num=None #private members\n", + " def_init_denom=None #private members\n", + " \n", + " def __init__(self,anotherFraction=None): \n", + " if anotherFraction==None: #normal constructor\n", + " self.__num=anotherFraction\n", + " self.__denom=anotherFraction\n", + " else: #copy constructor\n", + " self.__num=anotherFraction.self.__num\n", + " self.__denom=anotherFraction.self.__denom\n", + " \n", + " \n", + " #public functions\n", + " def SetValue(self,a,b):\n", + " self.__num=a\n", + " self.__denom=b#refer to IntegerData\n", + " def GetValue(self,a,b):\n", + " a=self.__num\n", + " b=self.__denom\n", + " return a,b\n", + " \n", + "f=Fraction()\n", + "n=input(\"Enter n: \") #user input\n", + "d=input(\"Enter d: \") #user input\n", + "print \"enter the numerator and denominator: \", ' ',n,d\n", + "\n", + "f.SetValue(n,d) #call function SetValue\n", + "print \"Numerator value set: \", ' ',n\n", + "print \"Denominator value set: \", ' ',d\n", + "f.GetValue(n,d) #call function GetData\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d\n", + "print \"Now a second clone copy is being created: \",''\n", + "f1=f\n", + "f1.GetValue(n,d)\n", + "print \"Clone's numerator value retrieved: \", ' ',n\n", + "print \"Clone's denominator value retrieved: \", ' ',d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter n: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter d: 6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "enter the numerator and denominator: 5 6\n", + "Numerator value set: 5\n", + "Denominator value set: 6\n", + "Numerator value retrieved: 5\n", + "Denominator value retrieved: 6\n", + "Now a second clone copy is being created: \n", + "Clone's numerator value retrieved: 5\n", + "Clone's denominator value retrieved: 6\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.9, page no:229" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def MyNewHandler():\n", + " print \"Sorry operator new failed to allocate memory\"\n", + " exit(0)\n", + " \n", + "def _set_new_handler(s):\n", + " s()\n", + "#In python there is no in-built _set_new_handler function, so i made this function and passed MyNewHandler function as a parameters\n", + "_set_new_handler(MyNewHandler)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sorry operator new failed to allocate memory\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.10, page no:230" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import * \n", + "class Fraction: \n", + " def __init__(self,a=0,b=1): \n", + " if isinstance(a,int): \n", + " c = c_int(a) \n", + " d = c_int(b) \n", + " self.__num = pointer(c) \n", + " self.__denom = pointer(d) \n", + " print 'constructor sets numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", + " else:\n", + " c=c_int(a.__num[0])\n", + " d = c_int(a.__denom[0])\n", + " self.__num = pointer(c) \n", + " self.__denom = pointer(d)\n", + " print 'copy constructor sets numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", + " \n", + " def __del__(self): \n", + " print 'destructor deallocates numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", + " \n", + "n = input(\"Please enter values of numerator: \") \n", + "d = input(\"Please enter values of denominator: \") \n", + "f = Fraction(n,d) \n", + "print 'Please enter another set of ' \n", + "n = input(\"numerator: \") \n", + "d = input(\"denominator: \") \n", + "print 'Creating fraction *pf : ' \n", + "pf = Fraction(n,d) \n", + "print 'Now a clone copy (f2) created from *pf: ' \n", + "f2 = Fraction(pf)\n", + "print 'Now another clone copy (*pf2) created from f:' \n", + "pf2 = Fraction(f) \n", + "print '*pf2 is being destroyed:' \n", + "del pf2\n", + "print '*pf is being destroyed:' \n", + "del pf \n", + "print 'now objects f2 and f automatically destroyed : '" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter values of numerator: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter values of denominator: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "constructor sets numerator = 3 , denominator = 4\n", + "Please enter another set of \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "numerator: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "denominator: 6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Creating fraction *pf : \n", + "constructor sets numerator = 5 , denominator = 6\n", + "Now a clone copy (f2) created from *pf: \n", + "copy constructor sets numerator = 5 , denominator = 6\n", + "Now another clone copy (*pf2) created from f:\n", + "copy constructor sets numerator = 3 , denominator = 4\n", + "*pf2 is being destroyed:\n", + "*pf is being destroyed:\n", + "now objects f2 and f automatically destroyed : \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.11, page no:234" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Memfail(self,s):\n", + " print \"Sorry Unable to allocate memory\"\n", + " sys.exit(0)\n", + "\n", + "MAX_SIZE = 60 + 1\n", + "\n", + "MAX_SIZE=[[0 for col in range(MAX_SIZE)]for row in range(MAX_SIZE)]\n", + "nChar=0\n", + "chArr=\"Hello\"\n", + "\n", + "print \"Please input a string( 60 characters max.): \",chArr\n", + "\n", + "nChar=len(chArr)+1\n", + "szStr=chArr\n", + "print \"required memory space for\",nChar,\n", + "print \"characters\"\n", + "chArr=szStr #string copy\n", + "szStr=chArr\n", + "print \"String copied in allocated space: \",szStr\n", + "print \"Memory space dellocated\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please input a string( 60 characters max.): Hello\n", + "required memory space for 6 characters\n", + "String copied in allocated space: Hello\n", + "Memory space dellocated\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.12, page no:236" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction:\n", + " \n", + " def __init__(self,a=0,b=1): #constructor\n", + " self.__num=a\n", + " self.__denom=b\n", + " \n", + " def __del__(self): #destructor\n", + " pass\n", + " \n", + " def GetValue(self,a,b):\n", + " a=self.__num\n", + " b=self.__denom\n", + " return self.__num,self.__denom\n", + "n=4\n", + "d=5\n", + "f=Fraction(4,5)\n", + "n,d=f.GetValue(n,d)" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.13, page no:239" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class X:\n", + " __sa=20 #initialising static member\n", + " a = None\n", + " def __init__(self):\n", + " self.a=None #public member\n", + " def f(self,b):\n", + " a=30\n", + " print \"Global a= \",b\n", + " print \"Local a= \",a\n", + " print \"Nonstatic member a= \",self.a\n", + " print \"static member sa= \",self.__sa\n", + "\n", + "a=10\n", + "\n", + "aXobj=X()\n", + "aXobj.a=40\n", + "aXobj.f(a)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Global a= 10\n", + "Local a= 30\n", + "Nonstatic member a= 40\n", + "static member sa= 20\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/chapter_8_Data_Abstraction.ipynb b/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/chapter_8_Data_Abstraction.ipynb new file mode 100755 index 00000000..1083b19a --- /dev/null +++ b/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/chapter_8_Data_Abstraction.ipynb @@ -0,0 +1,809 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:dbbd8ed92141bcc804ff2fbeacf8bb85f122dc6e196e1d830291a4a449a3a439" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8: Data Abstraction through Classes and User-Defined Data Types " + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.1, page no: 208" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Super:\n", + " def __init__(self):\n", + " self.__IntegerData=None #private member\n", + " #public functions\n", + " def SetData(self,i):\n", + " self.__IntegerData=i #refer to IntegerData\n", + " def ShowData(self):\n", + " print \"Data is \",self.__IntegerData,' '\n", + "\n", + "ob1=Super()\n", + "ob2=Super()\n", + "ob1.SetData(1000)\n", + "ob2.SetData(2000)\n", + "ob1.ShowData()\n", + "ob2.ShowData()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Data is 1000 \n", + "Data is 2000 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.2, page no:211" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class X:\n", + " def __init__(self):\n", + " self.a=None #private members\n", + " self.b=None #private members\n", + " \n", + "#no structure type present in python \n", + "x = X()\n", + "\n", + "x.a=0\n", + "x.b=1\n", + "print \"x.a=\",x.a,\",x.b=\",x.b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x.a= 0 ,x.b= 1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.3, page no:214" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction:\n", + " \n", + " def SetValue(self,a,b): #public functions\n", + " self.__num=a \n", + " self.__denom=b \n", + " def GetValue(self,a,b):\n", + " a=self.__num\n", + " b=self.__denom\n", + " \n", + "f=Fraction()\n", + "n=input(\"Enter n: \") #user input\n", + "d=input(\"Enter d: \") #user input\n", + "print \"enter the numerator and denominator: \", ' ',n,d\n", + "\n", + "f.SetValue(n,d) #call function SetValue\n", + "print \"Numerator value set: \", ' ',n\n", + "print \"Denominator value set: \", ' ',d\n", + "f.GetValue(n,d) #call function GetData\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter n: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter d: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "enter the numerator and denominator: 3 4\n", + "Numerator value set: 3\n", + "Denominator value set: 4\n", + "Numerator value retrieved: 3\n", + "Denominator value retrieved: 4\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.4, page no:216" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class SimpleClass:\n", + " def __init__(self):\n", + " self.__i=None #private member\n", + " \n", + " def __init__(self):\n", + " self.__i=500 #constructor\n", + " \n", + " def SetData(self,d):\n", + " self.__i=d\n", + " \n", + " def GetData(self):\n", + " return self.__i\n", + " \n", + "#Initializing\n", + "s1=SimpleClass()\n", + "s2=SimpleClass()\n", + "print \"s1 has data: \",s1.GetData()\n", + "print \"s2 has data: \",s2.GetData()\n", + "s1.SetData(1000) #function call\n", + "s2.SetData(2000)\n", + "print \"s1 has data: \",s1.GetData(),' '\n", + "print \"s2 has data: \", s2.GetData(),' '\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "s1 has data: 500\n", + "s2 has data: 500\n", + "s1 has data: 1000 \n", + "s2 has data: 2000 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.5, page no:217" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class SimpleClass:\n", + " __IntegerData=None\n", + " def __init__(self,data=None):\n", + " if data==None:\n", + " self.__IntegerData=500 #default constructor\n", + " else:\n", + " self.__IntegerData=data #parameterised constructor\n", + " \n", + " def SetData(self,d):\n", + " self.__IntegerData=d\n", + " \n", + " def GetData(self):\n", + " return self.__IntegerData\n", + " \n", + "#Initializing\n", + "s1=SimpleClass()\n", + "s2=SimpleClass()\n", + "s3=SimpleClass(400)\n", + "s4=SimpleClass(600)\n", + "print \"s1 has data: \",s1.GetData(),' '\n", + "print \"s2 has data: \",s2.GetData(),' '\n", + "print \"s3 has data: \",s3.GetData(),' '\n", + "print \"s4 has data: \",s4.GetData(),' '\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "s1 has data: 500 \n", + "s2 has data: 500 \n", + "s3 has data: 400 \n", + "s4 has data: 600 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.6, page no:218" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction: \n", + " def_init_num=None #private members\n", + " def_init_denom=None #private members\n", + " def __init__(self,a=0,b=1):\n", + " self.__num=a\n", + " self.__denom=b\n", + " print \"Numerator set inside constructor\",' ',n\n", + " print \"Denominator set inside constructor\",' ',d\n", + " \n", + " def SetValue(self,a,b):\n", + " self.__num=a\n", + " self.__denom=b\n", + " def GetValue(self,a,b):\n", + " a= self.__num\n", + " b= self.__denom\n", + " return a,b\n", + " \n", + " def __del__(self): #destructor\n", + " pass\n", + " \n", + "n=input(\"Enter n: \") #user input\n", + "d=input(\"Enter d: \") #user input\n", + "print \"Please enter value of numerator and denominator: \",' ',n,d\n", + "f=Fraction(n,d)\n", + "f.GetValue(n,d)\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter n: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter d: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter value of numerator and denominator: 3 4\n", + "Numerator set inside constructor 3\n", + "Denominator set inside constructor 4\n", + "Numerator value retrieved: 3\n", + "Denominator value retrieved: 4\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.7, page no:221" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction:\n", + " \n", + " def __init__(self,a=0,b=1): #constructor\n", + " self.__num=a\n", + " self.__denom=b\n", + " print \"Numerator set inside constructor: \",self.__num\n", + " print \"Denominator set inside constructor: \",self.__denom \n", + " \n", + " def GetValue(self,a,b):\n", + " return self.__num,self.__denom\n", + "n=input(\"Enter n: \") #user input\n", + "d=input(\"Enter d: \") #user input\n", + "print \"Please enter the value of the numerator and denominator: \",n,d\n", + "f=Fraction(n,d)\n", + "n,d=f.GetValue(n,d)\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d\n", + "n=input(\"Please enter the value of numerator only: \")\n", + "f1=Fraction(n)\n", + "n,d=f1.GetValue(n,d)\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d\n", + "print 'ok..now I will create a fraction-no input please'\n", + "f2=Fraction()\n", + "n,d=f2.GetValue(n,d)\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter n: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter d: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter the value of the numerator and denominator: 3 4\n", + "Numerator set inside constructor: 3\n", + "Denominator set inside constructor: 4\n", + "Numerator value retrieved: 3\n", + "Denominator value retrieved: 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter the value of numerator only: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Numerator set inside constructor: 3\n", + "Denominator set inside constructor: 1\n", + "Numerator value retrieved: 3\n", + "Denominator value retrieved: 1\n", + "ok..now I will create a fraction-no input please\n", + "Numerator set inside constructor: 0\n", + "Denominator set inside constructor: 1\n", + "Numerator value retrieved: 0\n", + "Denominator value retrieved: 1\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.8, page no:223" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction:\n", + " def_init_num=None #private members\n", + " def_init_denom=None #private members\n", + " \n", + " def __init__(self,anotherFraction=None): \n", + " if anotherFraction==None: #normal constructor\n", + " self.__num=anotherFraction\n", + " self.__denom=anotherFraction\n", + " else: #copy constructor\n", + " self.__num=anotherFraction.self.__num\n", + " self.__denom=anotherFraction.self.__denom\n", + " \n", + " \n", + " #public functions\n", + " def SetValue(self,a,b):\n", + " self.__num=a\n", + " self.__denom=b#refer to IntegerData\n", + " def GetValue(self,a,b):\n", + " a=self.__num\n", + " b=self.__denom\n", + " return a,b\n", + " \n", + "f=Fraction()\n", + "n=input(\"Enter n: \") #user input\n", + "d=input(\"Enter d: \") #user input\n", + "print \"enter the numerator and denominator: \", ' ',n,d\n", + "\n", + "f.SetValue(n,d) #call function SetValue\n", + "print \"Numerator value set: \", ' ',n\n", + "print \"Denominator value set: \", ' ',d\n", + "f.GetValue(n,d) #call function GetData\n", + "print \"Numerator value retrieved: \", ' ',n\n", + "print \"Denominator value retrieved: \", ' ',d\n", + "print \"Now a second clone copy is being created: \",''\n", + "f1=f\n", + "f1.GetValue(n,d)\n", + "print \"Clone's numerator value retrieved: \", ' ',n\n", + "print \"Clone's denominator value retrieved: \", ' ',d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter n: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter d: 6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "enter the numerator and denominator: 5 6\n", + "Numerator value set: 5\n", + "Denominator value set: 6\n", + "Numerator value retrieved: 5\n", + "Denominator value retrieved: 6\n", + "Now a second clone copy is being created: \n", + "Clone's numerator value retrieved: 5\n", + "Clone's denominator value retrieved: 6\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.9, page no:229" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def MyNewHandler():\n", + " print \"Sorry operator new failed to allocate memory\"\n", + " exit(0)\n", + " \n", + "def _set_new_handler(s):\n", + " s()\n", + "#In python there is no in-built _set_new_handler function, so i made this function and passed MyNewHandler function as a parameters\n", + "_set_new_handler(MyNewHandler)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sorry operator new failed to allocate memory\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.10, page no:230" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from ctypes import * \n", + "class Fraction: \n", + " def __init__(self,a=0,b=1): \n", + " if isinstance(a,int): \n", + " c = c_int(a) \n", + " d = c_int(b) \n", + " self.__num = pointer(c) \n", + " self.__denom = pointer(d) \n", + " print 'constructor sets numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", + " else:\n", + " c=c_int(a.__num[0])\n", + " d = c_int(a.__denom[0])\n", + " self.__num = pointer(c) \n", + " self.__denom = pointer(d)\n", + " print 'copy constructor sets numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", + " \n", + " def __del__(self): \n", + " print 'destructor deallocates numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", + " \n", + "n = input(\"Please enter values of numerator: \") \n", + "d = input(\"Please enter values of denominator: \") \n", + "f = Fraction(n,d) \n", + "print 'Please enter another set of ' \n", + "n = input(\"numerator: \") \n", + "d = input(\"denominator: \") \n", + "print 'Creating fraction *pf : ' \n", + "pf = Fraction(n,d) \n", + "print 'Now a clone copy (f2) created from *pf: ' \n", + "f2 = Fraction(pf)\n", + "print 'Now another clone copy (*pf2) created from f:' \n", + "pf2 = Fraction(f) \n", + "print '*pf2 is being destroyed:' \n", + "del pf2\n", + "print '*pf is being destroyed:' \n", + "del pf \n", + "print 'now objects f2 and f automatically destroyed : '" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter values of numerator: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please enter values of denominator: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "constructor sets numerator = 3 , denominator = 4\n", + "Please enter another set of \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "numerator: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "denominator: 6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Creating fraction *pf : \n", + "constructor sets numerator = 5 , denominator = 6\n", + "Now a clone copy (f2) created from *pf: \n", + "copy constructor sets numerator = 5 , denominator = 6\n", + "Now another clone copy (*pf2) created from f:\n", + "copy constructor sets numerator = 3 , denominator = 4\n", + "*pf2 is being destroyed:\n", + "*pf is being destroyed:\n", + "now objects f2 and f automatically destroyed : \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.11, page no:234" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def Memfail(self,s):\n", + " print \"Sorry Unable to allocate memory\"\n", + " sys.exit(0)\n", + "\n", + "MAX_SIZE = 60 + 1\n", + "\n", + "MAX_SIZE=[[0 for col in range(MAX_SIZE)]for row in range(MAX_SIZE)]\n", + "nChar=0\n", + "chArr=\"Hello\"\n", + "\n", + "print \"Please input a string( 60 characters max.): \",chArr\n", + "\n", + "nChar=len(chArr)+1\n", + "szStr=chArr\n", + "print \"required memory space for\",nChar,\n", + "print \"characters\"\n", + "chArr=szStr #string copy\n", + "szStr=chArr\n", + "print \"String copied in allocated space: \",szStr\n", + "print \"Memory space dellocated\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please input a string( 60 characters max.): Hello\n", + "required memory space for 6 characters\n", + "String copied in allocated space: Hello\n", + "Memory space dellocated\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.12, page no:236" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Fraction:\n", + " \n", + " def __init__(self,a=0,b=1): #constructor\n", + " self.__num=a\n", + " self.__denom=b\n", + " \n", + " def __del__(self): #destructor\n", + " pass\n", + " \n", + " def GetValue(self,a,b):\n", + " a=self.__num\n", + " b=self.__denom\n", + " return self.__num,self.__denom\n", + "n=4\n", + "d=5\n", + "f=Fraction(4,5)\n", + "n,d=f.GetValue(n,d)" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program Source Code 8.13, page no:239" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class X:\n", + " __sa=20 #initialising static member\n", + " a = None\n", + " def __init__(self):\n", + " self.a=None #public member\n", + " def f(self,b):\n", + " a=30\n", + " print \"Global a= \",b\n", + " print \"Local a= \",a\n", + " print \"Nonstatic member a= \",self.a\n", + " print \"static member sa= \",self.__sa\n", + "\n", + "a=10\n", + "\n", + "aXobj=X()\n", + "aXobj.a=40\n", + "aXobj.f(a)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Global a= 10\n", + "Local a= 30\n", + "Nonstatic member a= 40\n", + "static member sa= 20\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/chapter_8_Data_Abstraction_through.ipynb b/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/chapter_8_Data_Abstraction_through.ipynb deleted file mode 100755 index 1083b19a..00000000 --- a/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/chapter_8_Data_Abstraction_through.ipynb +++ /dev/null @@ -1,809 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:dbbd8ed92141bcc804ff2fbeacf8bb85f122dc6e196e1d830291a4a449a3a439" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 8: Data Abstraction through Classes and User-Defined Data Types " - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.1, page no: 208" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Super:\n", - " def __init__(self):\n", - " self.__IntegerData=None #private member\n", - " #public functions\n", - " def SetData(self,i):\n", - " self.__IntegerData=i #refer to IntegerData\n", - " def ShowData(self):\n", - " print \"Data is \",self.__IntegerData,' '\n", - "\n", - "ob1=Super()\n", - "ob2=Super()\n", - "ob1.SetData(1000)\n", - "ob2.SetData(2000)\n", - "ob1.ShowData()\n", - "ob2.ShowData()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Data is 1000 \n", - "Data is 2000 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.2, page no:211" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class X:\n", - " def __init__(self):\n", - " self.a=None #private members\n", - " self.b=None #private members\n", - " \n", - "#no structure type present in python \n", - "x = X()\n", - "\n", - "x.a=0\n", - "x.b=1\n", - "print \"x.a=\",x.a,\",x.b=\",x.b" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "x.a= 0 ,x.b= 1\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.3, page no:214" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " \n", - " def SetValue(self,a,b): #public functions\n", - " self.__num=a \n", - " self.__denom=b \n", - " def GetValue(self,a,b):\n", - " a=self.__num\n", - " b=self.__denom\n", - " \n", - "f=Fraction()\n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"enter the numerator and denominator: \", ' ',n,d\n", - "\n", - "f.SetValue(n,d) #call function SetValue\n", - "print \"Numerator value set: \", ' ',n\n", - "print \"Denominator value set: \", ' ',d\n", - "f.GetValue(n,d) #call function GetData\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "enter the numerator and denominator: 3 4\n", - "Numerator value set: 3\n", - "Denominator value set: 4\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 4\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.4, page no:216" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class SimpleClass:\n", - " def __init__(self):\n", - " self.__i=None #private member\n", - " \n", - " def __init__(self):\n", - " self.__i=500 #constructor\n", - " \n", - " def SetData(self,d):\n", - " self.__i=d\n", - " \n", - " def GetData(self):\n", - " return self.__i\n", - " \n", - "#Initializing\n", - "s1=SimpleClass()\n", - "s2=SimpleClass()\n", - "print \"s1 has data: \",s1.GetData()\n", - "print \"s2 has data: \",s2.GetData()\n", - "s1.SetData(1000) #function call\n", - "s2.SetData(2000)\n", - "print \"s1 has data: \",s1.GetData(),' '\n", - "print \"s2 has data: \", s2.GetData(),' '\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "s1 has data: 500\n", - "s2 has data: 500\n", - "s1 has data: 1000 \n", - "s2 has data: 2000 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.5, page no:217" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class SimpleClass:\n", - " __IntegerData=None\n", - " def __init__(self,data=None):\n", - " if data==None:\n", - " self.__IntegerData=500 #default constructor\n", - " else:\n", - " self.__IntegerData=data #parameterised constructor\n", - " \n", - " def SetData(self,d):\n", - " self.__IntegerData=d\n", - " \n", - " def GetData(self):\n", - " return self.__IntegerData\n", - " \n", - "#Initializing\n", - "s1=SimpleClass()\n", - "s2=SimpleClass()\n", - "s3=SimpleClass(400)\n", - "s4=SimpleClass(600)\n", - "print \"s1 has data: \",s1.GetData(),' '\n", - "print \"s2 has data: \",s2.GetData(),' '\n", - "print \"s3 has data: \",s3.GetData(),' '\n", - "print \"s4 has data: \",s4.GetData(),' '\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "s1 has data: 500 \n", - "s2 has data: 500 \n", - "s3 has data: 400 \n", - "s4 has data: 600 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.6, page no:218" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction: \n", - " def_init_num=None #private members\n", - " def_init_denom=None #private members\n", - " def __init__(self,a=0,b=1):\n", - " self.__num=a\n", - " self.__denom=b\n", - " print \"Numerator set inside constructor\",' ',n\n", - " print \"Denominator set inside constructor\",' ',d\n", - " \n", - " def SetValue(self,a,b):\n", - " self.__num=a\n", - " self.__denom=b\n", - " def GetValue(self,a,b):\n", - " a= self.__num\n", - " b= self.__denom\n", - " return a,b\n", - " \n", - " def __del__(self): #destructor\n", - " pass\n", - " \n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"Please enter value of numerator and denominator: \",' ',n,d\n", - "f=Fraction(n,d)\n", - "f.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter value of numerator and denominator: 3 4\n", - "Numerator set inside constructor 3\n", - "Denominator set inside constructor 4\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 4\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.7, page no:221" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " \n", - " def __init__(self,a=0,b=1): #constructor\n", - " self.__num=a\n", - " self.__denom=b\n", - " print \"Numerator set inside constructor: \",self.__num\n", - " print \"Denominator set inside constructor: \",self.__denom \n", - " \n", - " def GetValue(self,a,b):\n", - " return self.__num,self.__denom\n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"Please enter the value of the numerator and denominator: \",n,d\n", - "f=Fraction(n,d)\n", - "n,d=f.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d\n", - "n=input(\"Please enter the value of numerator only: \")\n", - "f1=Fraction(n)\n", - "n,d=f1.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d\n", - "print 'ok..now I will create a fraction-no input please'\n", - "f2=Fraction()\n", - "n,d=f2.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter the value of the numerator and denominator: 3 4\n", - "Numerator set inside constructor: 3\n", - "Denominator set inside constructor: 4\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter the value of numerator only: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Numerator set inside constructor: 3\n", - "Denominator set inside constructor: 1\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 1\n", - "ok..now I will create a fraction-no input please\n", - "Numerator set inside constructor: 0\n", - "Denominator set inside constructor: 1\n", - "Numerator value retrieved: 0\n", - "Denominator value retrieved: 1\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.8, page no:223" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " def_init_num=None #private members\n", - " def_init_denom=None #private members\n", - " \n", - " def __init__(self,anotherFraction=None): \n", - " if anotherFraction==None: #normal constructor\n", - " self.__num=anotherFraction\n", - " self.__denom=anotherFraction\n", - " else: #copy constructor\n", - " self.__num=anotherFraction.self.__num\n", - " self.__denom=anotherFraction.self.__denom\n", - " \n", - " \n", - " #public functions\n", - " def SetValue(self,a,b):\n", - " self.__num=a\n", - " self.__denom=b#refer to IntegerData\n", - " def GetValue(self,a,b):\n", - " a=self.__num\n", - " b=self.__denom\n", - " return a,b\n", - " \n", - "f=Fraction()\n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"enter the numerator and denominator: \", ' ',n,d\n", - "\n", - "f.SetValue(n,d) #call function SetValue\n", - "print \"Numerator value set: \", ' ',n\n", - "print \"Denominator value set: \", ' ',d\n", - "f.GetValue(n,d) #call function GetData\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d\n", - "print \"Now a second clone copy is being created: \",''\n", - "f1=f\n", - "f1.GetValue(n,d)\n", - "print \"Clone's numerator value retrieved: \", ' ',n\n", - "print \"Clone's denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "enter the numerator and denominator: 5 6\n", - "Numerator value set: 5\n", - "Denominator value set: 6\n", - "Numerator value retrieved: 5\n", - "Denominator value retrieved: 6\n", - "Now a second clone copy is being created: \n", - "Clone's numerator value retrieved: 5\n", - "Clone's denominator value retrieved: 6\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.9, page no:229" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def MyNewHandler():\n", - " print \"Sorry operator new failed to allocate memory\"\n", - " exit(0)\n", - " \n", - "def _set_new_handler(s):\n", - " s()\n", - "#In python there is no in-built _set_new_handler function, so i made this function and passed MyNewHandler function as a parameters\n", - "_set_new_handler(MyNewHandler)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sorry operator new failed to allocate memory\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.10, page no:230" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import * \n", - "class Fraction: \n", - " def __init__(self,a=0,b=1): \n", - " if isinstance(a,int): \n", - " c = c_int(a) \n", - " d = c_int(b) \n", - " self.__num = pointer(c) \n", - " self.__denom = pointer(d) \n", - " print 'constructor sets numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", - " else:\n", - " c=c_int(a.__num[0])\n", - " d = c_int(a.__denom[0])\n", - " self.__num = pointer(c) \n", - " self.__denom = pointer(d)\n", - " print 'copy constructor sets numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", - " \n", - " def __del__(self): \n", - " print 'destructor deallocates numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", - " \n", - "n = input(\"Please enter values of numerator: \") \n", - "d = input(\"Please enter values of denominator: \") \n", - "f = Fraction(n,d) \n", - "print 'Please enter another set of ' \n", - "n = input(\"numerator: \") \n", - "d = input(\"denominator: \") \n", - "print 'Creating fraction *pf : ' \n", - "pf = Fraction(n,d) \n", - "print 'Now a clone copy (f2) created from *pf: ' \n", - "f2 = Fraction(pf)\n", - "print 'Now another clone copy (*pf2) created from f:' \n", - "pf2 = Fraction(f) \n", - "print '*pf2 is being destroyed:' \n", - "del pf2\n", - "print '*pf is being destroyed:' \n", - "del pf \n", - "print 'now objects f2 and f automatically destroyed : '" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter values of numerator: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter values of denominator: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "constructor sets numerator = 3 , denominator = 4\n", - "Please enter another set of \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "numerator: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "denominator: 6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Creating fraction *pf : \n", - "constructor sets numerator = 5 , denominator = 6\n", - "Now a clone copy (f2) created from *pf: \n", - "copy constructor sets numerator = 5 , denominator = 6\n", - "Now another clone copy (*pf2) created from f:\n", - "copy constructor sets numerator = 3 , denominator = 4\n", - "*pf2 is being destroyed:\n", - "*pf is being destroyed:\n", - "now objects f2 and f automatically destroyed : \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.11, page no:234" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Memfail(self,s):\n", - " print \"Sorry Unable to allocate memory\"\n", - " sys.exit(0)\n", - "\n", - "MAX_SIZE = 60 + 1\n", - "\n", - "MAX_SIZE=[[0 for col in range(MAX_SIZE)]for row in range(MAX_SIZE)]\n", - "nChar=0\n", - "chArr=\"Hello\"\n", - "\n", - "print \"Please input a string( 60 characters max.): \",chArr\n", - "\n", - "nChar=len(chArr)+1\n", - "szStr=chArr\n", - "print \"required memory space for\",nChar,\n", - "print \"characters\"\n", - "chArr=szStr #string copy\n", - "szStr=chArr\n", - "print \"String copied in allocated space: \",szStr\n", - "print \"Memory space dellocated\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please input a string( 60 characters max.): Hello\n", - "required memory space for 6 characters\n", - "String copied in allocated space: Hello\n", - "Memory space dellocated\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.12, page no:236" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " \n", - " def __init__(self,a=0,b=1): #constructor\n", - " self.__num=a\n", - " self.__denom=b\n", - " \n", - " def __del__(self): #destructor\n", - " pass\n", - " \n", - " def GetValue(self,a,b):\n", - " a=self.__num\n", - " b=self.__denom\n", - " return self.__num,self.__denom\n", - "n=4\n", - "d=5\n", - "f=Fraction(4,5)\n", - "n,d=f.GetValue(n,d)" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.13, page no:239" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class X:\n", - " __sa=20 #initialising static member\n", - " a = None\n", - " def __init__(self):\n", - " self.a=None #public member\n", - " def f(self,b):\n", - " a=30\n", - " print \"Global a= \",b\n", - " print \"Local a= \",a\n", - " print \"Nonstatic member a= \",self.a\n", - " print \"static member sa= \",self.__sa\n", - "\n", - "a=10\n", - "\n", - "aXobj=X()\n", - "aXobj.a=40\n", - "aXobj.f(a)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Global a= 10\n", - "Local a= 30\n", - "Nonstatic member a= 40\n", - "static member sa= 20\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/chapter_8_Data_Abstraction_through_Classes_and_User-Defined_Data.ipynb b/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/chapter_8_Data_Abstraction_through_Classes_and_User-Defined_Data.ipynb deleted file mode 100755 index 1083b19a..00000000 --- a/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/chapter_8_Data_Abstraction_through_Classes_and_User-Defined_Data.ipynb +++ /dev/null @@ -1,809 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:dbbd8ed92141bcc804ff2fbeacf8bb85f122dc6e196e1d830291a4a449a3a439" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 8: Data Abstraction through Classes and User-Defined Data Types " - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.1, page no: 208" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Super:\n", - " def __init__(self):\n", - " self.__IntegerData=None #private member\n", - " #public functions\n", - " def SetData(self,i):\n", - " self.__IntegerData=i #refer to IntegerData\n", - " def ShowData(self):\n", - " print \"Data is \",self.__IntegerData,' '\n", - "\n", - "ob1=Super()\n", - "ob2=Super()\n", - "ob1.SetData(1000)\n", - "ob2.SetData(2000)\n", - "ob1.ShowData()\n", - "ob2.ShowData()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Data is 1000 \n", - "Data is 2000 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.2, page no:211" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class X:\n", - " def __init__(self):\n", - " self.a=None #private members\n", - " self.b=None #private members\n", - " \n", - "#no structure type present in python \n", - "x = X()\n", - "\n", - "x.a=0\n", - "x.b=1\n", - "print \"x.a=\",x.a,\",x.b=\",x.b" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "x.a= 0 ,x.b= 1\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.3, page no:214" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " \n", - " def SetValue(self,a,b): #public functions\n", - " self.__num=a \n", - " self.__denom=b \n", - " def GetValue(self,a,b):\n", - " a=self.__num\n", - " b=self.__denom\n", - " \n", - "f=Fraction()\n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"enter the numerator and denominator: \", ' ',n,d\n", - "\n", - "f.SetValue(n,d) #call function SetValue\n", - "print \"Numerator value set: \", ' ',n\n", - "print \"Denominator value set: \", ' ',d\n", - "f.GetValue(n,d) #call function GetData\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "enter the numerator and denominator: 3 4\n", - "Numerator value set: 3\n", - "Denominator value set: 4\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 4\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.4, page no:216" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class SimpleClass:\n", - " def __init__(self):\n", - " self.__i=None #private member\n", - " \n", - " def __init__(self):\n", - " self.__i=500 #constructor\n", - " \n", - " def SetData(self,d):\n", - " self.__i=d\n", - " \n", - " def GetData(self):\n", - " return self.__i\n", - " \n", - "#Initializing\n", - "s1=SimpleClass()\n", - "s2=SimpleClass()\n", - "print \"s1 has data: \",s1.GetData()\n", - "print \"s2 has data: \",s2.GetData()\n", - "s1.SetData(1000) #function call\n", - "s2.SetData(2000)\n", - "print \"s1 has data: \",s1.GetData(),' '\n", - "print \"s2 has data: \", s2.GetData(),' '\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "s1 has data: 500\n", - "s2 has data: 500\n", - "s1 has data: 1000 \n", - "s2 has data: 2000 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.5, page no:217" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class SimpleClass:\n", - " __IntegerData=None\n", - " def __init__(self,data=None):\n", - " if data==None:\n", - " self.__IntegerData=500 #default constructor\n", - " else:\n", - " self.__IntegerData=data #parameterised constructor\n", - " \n", - " def SetData(self,d):\n", - " self.__IntegerData=d\n", - " \n", - " def GetData(self):\n", - " return self.__IntegerData\n", - " \n", - "#Initializing\n", - "s1=SimpleClass()\n", - "s2=SimpleClass()\n", - "s3=SimpleClass(400)\n", - "s4=SimpleClass(600)\n", - "print \"s1 has data: \",s1.GetData(),' '\n", - "print \"s2 has data: \",s2.GetData(),' '\n", - "print \"s3 has data: \",s3.GetData(),' '\n", - "print \"s4 has data: \",s4.GetData(),' '\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "s1 has data: 500 \n", - "s2 has data: 500 \n", - "s3 has data: 400 \n", - "s4 has data: 600 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.6, page no:218" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction: \n", - " def_init_num=None #private members\n", - " def_init_denom=None #private members\n", - " def __init__(self,a=0,b=1):\n", - " self.__num=a\n", - " self.__denom=b\n", - " print \"Numerator set inside constructor\",' ',n\n", - " print \"Denominator set inside constructor\",' ',d\n", - " \n", - " def SetValue(self,a,b):\n", - " self.__num=a\n", - " self.__denom=b\n", - " def GetValue(self,a,b):\n", - " a= self.__num\n", - " b= self.__denom\n", - " return a,b\n", - " \n", - " def __del__(self): #destructor\n", - " pass\n", - " \n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"Please enter value of numerator and denominator: \",' ',n,d\n", - "f=Fraction(n,d)\n", - "f.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter value of numerator and denominator: 3 4\n", - "Numerator set inside constructor 3\n", - "Denominator set inside constructor 4\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 4\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.7, page no:221" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " \n", - " def __init__(self,a=0,b=1): #constructor\n", - " self.__num=a\n", - " self.__denom=b\n", - " print \"Numerator set inside constructor: \",self.__num\n", - " print \"Denominator set inside constructor: \",self.__denom \n", - " \n", - " def GetValue(self,a,b):\n", - " return self.__num,self.__denom\n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"Please enter the value of the numerator and denominator: \",n,d\n", - "f=Fraction(n,d)\n", - "n,d=f.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d\n", - "n=input(\"Please enter the value of numerator only: \")\n", - "f1=Fraction(n)\n", - "n,d=f1.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d\n", - "print 'ok..now I will create a fraction-no input please'\n", - "f2=Fraction()\n", - "n,d=f2.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter the value of the numerator and denominator: 3 4\n", - "Numerator set inside constructor: 3\n", - "Denominator set inside constructor: 4\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter the value of numerator only: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Numerator set inside constructor: 3\n", - "Denominator set inside constructor: 1\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 1\n", - "ok..now I will create a fraction-no input please\n", - "Numerator set inside constructor: 0\n", - "Denominator set inside constructor: 1\n", - "Numerator value retrieved: 0\n", - "Denominator value retrieved: 1\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.8, page no:223" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " def_init_num=None #private members\n", - " def_init_denom=None #private members\n", - " \n", - " def __init__(self,anotherFraction=None): \n", - " if anotherFraction==None: #normal constructor\n", - " self.__num=anotherFraction\n", - " self.__denom=anotherFraction\n", - " else: #copy constructor\n", - " self.__num=anotherFraction.self.__num\n", - " self.__denom=anotherFraction.self.__denom\n", - " \n", - " \n", - " #public functions\n", - " def SetValue(self,a,b):\n", - " self.__num=a\n", - " self.__denom=b#refer to IntegerData\n", - " def GetValue(self,a,b):\n", - " a=self.__num\n", - " b=self.__denom\n", - " return a,b\n", - " \n", - "f=Fraction()\n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"enter the numerator and denominator: \", ' ',n,d\n", - "\n", - "f.SetValue(n,d) #call function SetValue\n", - "print \"Numerator value set: \", ' ',n\n", - "print \"Denominator value set: \", ' ',d\n", - "f.GetValue(n,d) #call function GetData\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d\n", - "print \"Now a second clone copy is being created: \",''\n", - "f1=f\n", - "f1.GetValue(n,d)\n", - "print \"Clone's numerator value retrieved: \", ' ',n\n", - "print \"Clone's denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "enter the numerator and denominator: 5 6\n", - "Numerator value set: 5\n", - "Denominator value set: 6\n", - "Numerator value retrieved: 5\n", - "Denominator value retrieved: 6\n", - "Now a second clone copy is being created: \n", - "Clone's numerator value retrieved: 5\n", - "Clone's denominator value retrieved: 6\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.9, page no:229" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def MyNewHandler():\n", - " print \"Sorry operator new failed to allocate memory\"\n", - " exit(0)\n", - " \n", - "def _set_new_handler(s):\n", - " s()\n", - "#In python there is no in-built _set_new_handler function, so i made this function and passed MyNewHandler function as a parameters\n", - "_set_new_handler(MyNewHandler)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sorry operator new failed to allocate memory\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.10, page no:230" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import * \n", - "class Fraction: \n", - " def __init__(self,a=0,b=1): \n", - " if isinstance(a,int): \n", - " c = c_int(a) \n", - " d = c_int(b) \n", - " self.__num = pointer(c) \n", - " self.__denom = pointer(d) \n", - " print 'constructor sets numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", - " else:\n", - " c=c_int(a.__num[0])\n", - " d = c_int(a.__denom[0])\n", - " self.__num = pointer(c) \n", - " self.__denom = pointer(d)\n", - " print 'copy constructor sets numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", - " \n", - " def __del__(self): \n", - " print 'destructor deallocates numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", - " \n", - "n = input(\"Please enter values of numerator: \") \n", - "d = input(\"Please enter values of denominator: \") \n", - "f = Fraction(n,d) \n", - "print 'Please enter another set of ' \n", - "n = input(\"numerator: \") \n", - "d = input(\"denominator: \") \n", - "print 'Creating fraction *pf : ' \n", - "pf = Fraction(n,d) \n", - "print 'Now a clone copy (f2) created from *pf: ' \n", - "f2 = Fraction(pf)\n", - "print 'Now another clone copy (*pf2) created from f:' \n", - "pf2 = Fraction(f) \n", - "print '*pf2 is being destroyed:' \n", - "del pf2\n", - "print '*pf is being destroyed:' \n", - "del pf \n", - "print 'now objects f2 and f automatically destroyed : '" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter values of numerator: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter values of denominator: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "constructor sets numerator = 3 , denominator = 4\n", - "Please enter another set of \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "numerator: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "denominator: 6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Creating fraction *pf : \n", - "constructor sets numerator = 5 , denominator = 6\n", - "Now a clone copy (f2) created from *pf: \n", - "copy constructor sets numerator = 5 , denominator = 6\n", - "Now another clone copy (*pf2) created from f:\n", - "copy constructor sets numerator = 3 , denominator = 4\n", - "*pf2 is being destroyed:\n", - "*pf is being destroyed:\n", - "now objects f2 and f automatically destroyed : \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.11, page no:234" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Memfail(self,s):\n", - " print \"Sorry Unable to allocate memory\"\n", - " sys.exit(0)\n", - "\n", - "MAX_SIZE = 60 + 1\n", - "\n", - "MAX_SIZE=[[0 for col in range(MAX_SIZE)]for row in range(MAX_SIZE)]\n", - "nChar=0\n", - "chArr=\"Hello\"\n", - "\n", - "print \"Please input a string( 60 characters max.): \",chArr\n", - "\n", - "nChar=len(chArr)+1\n", - "szStr=chArr\n", - "print \"required memory space for\",nChar,\n", - "print \"characters\"\n", - "chArr=szStr #string copy\n", - "szStr=chArr\n", - "print \"String copied in allocated space: \",szStr\n", - "print \"Memory space dellocated\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please input a string( 60 characters max.): Hello\n", - "required memory space for 6 characters\n", - "String copied in allocated space: Hello\n", - "Memory space dellocated\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.12, page no:236" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " \n", - " def __init__(self,a=0,b=1): #constructor\n", - " self.__num=a\n", - " self.__denom=b\n", - " \n", - " def __del__(self): #destructor\n", - " pass\n", - " \n", - " def GetValue(self,a,b):\n", - " a=self.__num\n", - " b=self.__denom\n", - " return self.__num,self.__denom\n", - "n=4\n", - "d=5\n", - "f=Fraction(4,5)\n", - "n,d=f.GetValue(n,d)" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.13, page no:239" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class X:\n", - " __sa=20 #initialising static member\n", - " a = None\n", - " def __init__(self):\n", - " self.a=None #public member\n", - " def f(self,b):\n", - " a=30\n", - " print \"Global a= \",b\n", - " print \"Local a= \",a\n", - " print \"Nonstatic member a= \",self.a\n", - " print \"static member sa= \",self.__sa\n", - "\n", - "a=10\n", - "\n", - "aXobj=X()\n", - "aXobj.a=40\n", - "aXobj.f(a)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Global a= 10\n", - "Local a= 30\n", - "Nonstatic member a= 40\n", - "static member sa= 20\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/chapter_8_Data_Abstraction_through_Classes_and_User-Defined_Data_Types.ipynb b/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/chapter_8_Data_Abstraction_through_Classes_and_User-Defined_Data_Types.ipynb deleted file mode 100755 index 1083b19a..00000000 --- a/sample_notebooks/NitamoniDas/NitamoniDas_version_backup/chapter_8_Data_Abstraction_through_Classes_and_User-Defined_Data_Types.ipynb +++ /dev/null @@ -1,809 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:dbbd8ed92141bcc804ff2fbeacf8bb85f122dc6e196e1d830291a4a449a3a439" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 8: Data Abstraction through Classes and User-Defined Data Types " - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.1, page no: 208" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Super:\n", - " def __init__(self):\n", - " self.__IntegerData=None #private member\n", - " #public functions\n", - " def SetData(self,i):\n", - " self.__IntegerData=i #refer to IntegerData\n", - " def ShowData(self):\n", - " print \"Data is \",self.__IntegerData,' '\n", - "\n", - "ob1=Super()\n", - "ob2=Super()\n", - "ob1.SetData(1000)\n", - "ob2.SetData(2000)\n", - "ob1.ShowData()\n", - "ob2.ShowData()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Data is 1000 \n", - "Data is 2000 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.2, page no:211" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class X:\n", - " def __init__(self):\n", - " self.a=None #private members\n", - " self.b=None #private members\n", - " \n", - "#no structure type present in python \n", - "x = X()\n", - "\n", - "x.a=0\n", - "x.b=1\n", - "print \"x.a=\",x.a,\",x.b=\",x.b" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "x.a= 0 ,x.b= 1\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.3, page no:214" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " \n", - " def SetValue(self,a,b): #public functions\n", - " self.__num=a \n", - " self.__denom=b \n", - " def GetValue(self,a,b):\n", - " a=self.__num\n", - " b=self.__denom\n", - " \n", - "f=Fraction()\n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"enter the numerator and denominator: \", ' ',n,d\n", - "\n", - "f.SetValue(n,d) #call function SetValue\n", - "print \"Numerator value set: \", ' ',n\n", - "print \"Denominator value set: \", ' ',d\n", - "f.GetValue(n,d) #call function GetData\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "enter the numerator and denominator: 3 4\n", - "Numerator value set: 3\n", - "Denominator value set: 4\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 4\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.4, page no:216" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class SimpleClass:\n", - " def __init__(self):\n", - " self.__i=None #private member\n", - " \n", - " def __init__(self):\n", - " self.__i=500 #constructor\n", - " \n", - " def SetData(self,d):\n", - " self.__i=d\n", - " \n", - " def GetData(self):\n", - " return self.__i\n", - " \n", - "#Initializing\n", - "s1=SimpleClass()\n", - "s2=SimpleClass()\n", - "print \"s1 has data: \",s1.GetData()\n", - "print \"s2 has data: \",s2.GetData()\n", - "s1.SetData(1000) #function call\n", - "s2.SetData(2000)\n", - "print \"s1 has data: \",s1.GetData(),' '\n", - "print \"s2 has data: \", s2.GetData(),' '\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "s1 has data: 500\n", - "s2 has data: 500\n", - "s1 has data: 1000 \n", - "s2 has data: 2000 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.5, page no:217" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class SimpleClass:\n", - " __IntegerData=None\n", - " def __init__(self,data=None):\n", - " if data==None:\n", - " self.__IntegerData=500 #default constructor\n", - " else:\n", - " self.__IntegerData=data #parameterised constructor\n", - " \n", - " def SetData(self,d):\n", - " self.__IntegerData=d\n", - " \n", - " def GetData(self):\n", - " return self.__IntegerData\n", - " \n", - "#Initializing\n", - "s1=SimpleClass()\n", - "s2=SimpleClass()\n", - "s3=SimpleClass(400)\n", - "s4=SimpleClass(600)\n", - "print \"s1 has data: \",s1.GetData(),' '\n", - "print \"s2 has data: \",s2.GetData(),' '\n", - "print \"s3 has data: \",s3.GetData(),' '\n", - "print \"s4 has data: \",s4.GetData(),' '\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "s1 has data: 500 \n", - "s2 has data: 500 \n", - "s3 has data: 400 \n", - "s4 has data: 600 \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.6, page no:218" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction: \n", - " def_init_num=None #private members\n", - " def_init_denom=None #private members\n", - " def __init__(self,a=0,b=1):\n", - " self.__num=a\n", - " self.__denom=b\n", - " print \"Numerator set inside constructor\",' ',n\n", - " print \"Denominator set inside constructor\",' ',d\n", - " \n", - " def SetValue(self,a,b):\n", - " self.__num=a\n", - " self.__denom=b\n", - " def GetValue(self,a,b):\n", - " a= self.__num\n", - " b= self.__denom\n", - " return a,b\n", - " \n", - " def __del__(self): #destructor\n", - " pass\n", - " \n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"Please enter value of numerator and denominator: \",' ',n,d\n", - "f=Fraction(n,d)\n", - "f.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter value of numerator and denominator: 3 4\n", - "Numerator set inside constructor 3\n", - "Denominator set inside constructor 4\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 4\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.7, page no:221" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " \n", - " def __init__(self,a=0,b=1): #constructor\n", - " self.__num=a\n", - " self.__denom=b\n", - " print \"Numerator set inside constructor: \",self.__num\n", - " print \"Denominator set inside constructor: \",self.__denom \n", - " \n", - " def GetValue(self,a,b):\n", - " return self.__num,self.__denom\n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"Please enter the value of the numerator and denominator: \",n,d\n", - "f=Fraction(n,d)\n", - "n,d=f.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d\n", - "n=input(\"Please enter the value of numerator only: \")\n", - "f1=Fraction(n)\n", - "n,d=f1.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d\n", - "print 'ok..now I will create a fraction-no input please'\n", - "f2=Fraction()\n", - "n,d=f2.GetValue(n,d)\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter the value of the numerator and denominator: 3 4\n", - "Numerator set inside constructor: 3\n", - "Denominator set inside constructor: 4\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter the value of numerator only: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Numerator set inside constructor: 3\n", - "Denominator set inside constructor: 1\n", - "Numerator value retrieved: 3\n", - "Denominator value retrieved: 1\n", - "ok..now I will create a fraction-no input please\n", - "Numerator set inside constructor: 0\n", - "Denominator set inside constructor: 1\n", - "Numerator value retrieved: 0\n", - "Denominator value retrieved: 1\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.8, page no:223" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " def_init_num=None #private members\n", - " def_init_denom=None #private members\n", - " \n", - " def __init__(self,anotherFraction=None): \n", - " if anotherFraction==None: #normal constructor\n", - " self.__num=anotherFraction\n", - " self.__denom=anotherFraction\n", - " else: #copy constructor\n", - " self.__num=anotherFraction.self.__num\n", - " self.__denom=anotherFraction.self.__denom\n", - " \n", - " \n", - " #public functions\n", - " def SetValue(self,a,b):\n", - " self.__num=a\n", - " self.__denom=b#refer to IntegerData\n", - " def GetValue(self,a,b):\n", - " a=self.__num\n", - " b=self.__denom\n", - " return a,b\n", - " \n", - "f=Fraction()\n", - "n=input(\"Enter n: \") #user input\n", - "d=input(\"Enter d: \") #user input\n", - "print \"enter the numerator and denominator: \", ' ',n,d\n", - "\n", - "f.SetValue(n,d) #call function SetValue\n", - "print \"Numerator value set: \", ' ',n\n", - "print \"Denominator value set: \", ' ',d\n", - "f.GetValue(n,d) #call function GetData\n", - "print \"Numerator value retrieved: \", ' ',n\n", - "print \"Denominator value retrieved: \", ' ',d\n", - "print \"Now a second clone copy is being created: \",''\n", - "f1=f\n", - "f1.GetValue(n,d)\n", - "print \"Clone's numerator value retrieved: \", ' ',n\n", - "print \"Clone's denominator value retrieved: \", ' ',d" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter n: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter d: 6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "enter the numerator and denominator: 5 6\n", - "Numerator value set: 5\n", - "Denominator value set: 6\n", - "Numerator value retrieved: 5\n", - "Denominator value retrieved: 6\n", - "Now a second clone copy is being created: \n", - "Clone's numerator value retrieved: 5\n", - "Clone's denominator value retrieved: 6\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.9, page no:229" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def MyNewHandler():\n", - " print \"Sorry operator new failed to allocate memory\"\n", - " exit(0)\n", - " \n", - "def _set_new_handler(s):\n", - " s()\n", - "#In python there is no in-built _set_new_handler function, so i made this function and passed MyNewHandler function as a parameters\n", - "_set_new_handler(MyNewHandler)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Sorry operator new failed to allocate memory\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.10, page no:230" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from ctypes import * \n", - "class Fraction: \n", - " def __init__(self,a=0,b=1): \n", - " if isinstance(a,int): \n", - " c = c_int(a) \n", - " d = c_int(b) \n", - " self.__num = pointer(c) \n", - " self.__denom = pointer(d) \n", - " print 'constructor sets numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", - " else:\n", - " c=c_int(a.__num[0])\n", - " d = c_int(a.__denom[0])\n", - " self.__num = pointer(c) \n", - " self.__denom = pointer(d)\n", - " print 'copy constructor sets numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", - " \n", - " def __del__(self): \n", - " print 'destructor deallocates numerator = ', self.__num[0] , ', denominator = ', self.__denom[0] \n", - " \n", - "n = input(\"Please enter values of numerator: \") \n", - "d = input(\"Please enter values of denominator: \") \n", - "f = Fraction(n,d) \n", - "print 'Please enter another set of ' \n", - "n = input(\"numerator: \") \n", - "d = input(\"denominator: \") \n", - "print 'Creating fraction *pf : ' \n", - "pf = Fraction(n,d) \n", - "print 'Now a clone copy (f2) created from *pf: ' \n", - "f2 = Fraction(pf)\n", - "print 'Now another clone copy (*pf2) created from f:' \n", - "pf2 = Fraction(f) \n", - "print '*pf2 is being destroyed:' \n", - "del pf2\n", - "print '*pf is being destroyed:' \n", - "del pf \n", - "print 'now objects f2 and f automatically destroyed : '" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter values of numerator: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please enter values of denominator: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "constructor sets numerator = 3 , denominator = 4\n", - "Please enter another set of \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "numerator: 5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "denominator: 6\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Creating fraction *pf : \n", - "constructor sets numerator = 5 , denominator = 6\n", - "Now a clone copy (f2) created from *pf: \n", - "copy constructor sets numerator = 5 , denominator = 6\n", - "Now another clone copy (*pf2) created from f:\n", - "copy constructor sets numerator = 3 , denominator = 4\n", - "*pf2 is being destroyed:\n", - "*pf is being destroyed:\n", - "now objects f2 and f automatically destroyed : \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.11, page no:234" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def Memfail(self,s):\n", - " print \"Sorry Unable to allocate memory\"\n", - " sys.exit(0)\n", - "\n", - "MAX_SIZE = 60 + 1\n", - "\n", - "MAX_SIZE=[[0 for col in range(MAX_SIZE)]for row in range(MAX_SIZE)]\n", - "nChar=0\n", - "chArr=\"Hello\"\n", - "\n", - "print \"Please input a string( 60 characters max.): \",chArr\n", - "\n", - "nChar=len(chArr)+1\n", - "szStr=chArr\n", - "print \"required memory space for\",nChar,\n", - "print \"characters\"\n", - "chArr=szStr #string copy\n", - "szStr=chArr\n", - "print \"String copied in allocated space: \",szStr\n", - "print \"Memory space dellocated\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Please input a string( 60 characters max.): Hello\n", - "required memory space for 6 characters\n", - "String copied in allocated space: Hello\n", - "Memory space dellocated\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.12, page no:236" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Fraction:\n", - " \n", - " def __init__(self,a=0,b=1): #constructor\n", - " self.__num=a\n", - " self.__denom=b\n", - " \n", - " def __del__(self): #destructor\n", - " pass\n", - " \n", - " def GetValue(self,a,b):\n", - " a=self.__num\n", - " b=self.__denom\n", - " return self.__num,self.__denom\n", - "n=4\n", - "d=5\n", - "f=Fraction(4,5)\n", - "n,d=f.GetValue(n,d)" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Program Source Code 8.13, page no:239" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class X:\n", - " __sa=20 #initialising static member\n", - " a = None\n", - " def __init__(self):\n", - " self.a=None #public member\n", - " def f(self,b):\n", - " a=30\n", - " print \"Global a= \",b\n", - " print \"Local a= \",a\n", - " print \"Nonstatic member a= \",self.a\n", - " print \"static member sa= \",self.__sa\n", - "\n", - "a=10\n", - "\n", - "aXobj=X()\n", - "aXobj.a=40\n", - "aXobj.f(a)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Global a= 10\n", - "Local a= 30\n", - "Nonstatic member a= 40\n", - "static member sa= 20\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/PrashantSahu/Chapter_2.ipynb b/sample_notebooks/PrashantSahu/Chapter_2.ipynb new file mode 100755 index 00000000..7df6880b --- /dev/null +++ b/sample_notebooks/PrashantSahu/Chapter_2.ipynb @@ -0,0 +1,657 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#Chapter 2 : Molecular Diffusion\n", + "##Example 2.1 " + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Molar average velocity of gas mixture is: 0.0303\n", + "Mass average velocity of gas mixture is: 0.029\n" + ] + } + ], + "source": [ + "import math\n", + "N2 = 0.05 #mole fraction of Nitrogen denoted as 1\n", + "H2 = 0.15 #mole fraction of Hydrogen denoted as 2\n", + "NH3 = 0.76 #mole fraction of Ammonia denoted as 3\n", + "Ar = 0.04 #mole fraction of Argon denoted as 4\n", + "u1 = 0.03\n", + "u2 = 0.035\n", + "u3 = 0.03\n", + "u4 = 0.02\n", + "#Calculating molar average velocity\n", + "U = N2*u1 + H2*u2 + NH3*u3 + Ar*u4\n", + "print 'Molar average velocity of gas mixture is: %.4f'%U\n", + "#Calculating of mass average velocity\n", + "M1 = 28\n", + "M2 = 2\n", + "M3 = 17\n", + "M4 = 40\n", + "M = N2*M1 + H2*M2 + NH3*M3 + Ar*M4\n", + "u = (1/M)*(N2*M1*u1 + H2*M2*u2 + NH3*M3*u3 + Ar*M4*u4)\n", + "print 'Mass average velocity of gas mixture is: %.3f'%u" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " ##Example 2.2" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false, + "scrolled": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(a) Time for complete evaporation is: 15.93 hours\n", + "(b) Time for disappearance of water is: 8.87 hours\n" + ] + } + ], + "source": [ + "import math\n", + "import numpy as np\n", + "\n", + "#Calcualtion for (a) part\n", + "#calculating vapor pressure of water at 301K\n", + "pv = math.exp(13.8573 - (5160.2/301)) #in bar\n", + "#wet-bulb temperature is 22.5 degree centigrade\n", + "#calculating mean air-film temperature\n", + "Tm = ((28+22.5)/2)+273 #in kelvin\n", + "#calculating diffusion coefficient\n", + "Dab = ((0.853*(30.48**2))*((298.2/273)**1.75))/(3600*10000) #in m^2/s\n", + "l = 2.5e-3 #in m\n", + "P = 1.013 #in bar\n", + "R = 0.08317 #Gas constant\n", + "pAo = math.exp(13.8573 - (5160.2/295.2)) #vapor pressure of water at the wet-bulb temperature, 22.2C\n", + "pAl = 0.6*round(pv,4)\n", + "Na = (((round(Dab,7)*P)/(R*298.2*l))*math.log((P-pAl)/(P-round(pAo,3))))*18 #in kg/m^2s\n", + "#amount of water per m^2 of floor area is\n", + "thickness = 2e-3\n", + "Amount = thickness*1 #in m^3 \n", + "#density of water is 1000kg/m^3\n", + "#therefore in kg it is\n", + "amount = Amount*1000\n", + "Time_for_completion = amount/Na #in seconds\n", + "Time_for_completion_hours = Time_for_completion/3600\n", + "print '(a) Time for complete evaporation is: %.2f'%Time_for_completion_hours,'hours'\n", + "\n", + "#Calculation for (b) part\n", + "water_loss = 0.1 #in kg/m^2.h\n", + "water_loss_by_evaporation = Na*3600\n", + "total_water_loss = water_loss + water_loss_by_evaporation\n", + "time_for_disappearance = amount/total_water_loss\n", + "print '(b) Time for disappearance of water is: %0.2f'%time_for_disappearance,'hours'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##Example 2.3" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(a) The molar flux of Ammonia is:1.922E-05 gmol/cm^2.s\n", + "(b) and (c)\n", + "Velocity of A is 0.522 cm/s\n", + "Velocity of B is 0.000 cm/s\n", + "Mass average velocity of A is 0.439 cm/s\n", + "Molar average velocity of A is 0.47 cm/s\n", + "(d) Molar flux of NH3 is 3.062E-06 gmol/cm^2.s\n" + ] + }, + { + "data": { + "image/png": "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\n", + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%matplotlib inline\n", + "import matplotlib\n", + "import math\n", + "import numpy as np\n", + "from matplotlib import pyplot as plt\n", + "#calculation for (a) part\n", + "l = 1 #thickness of air in cm\n", + "pAo = 0.9 #in atm\n", + "pAl = 0.1 #in atm\n", + "Dab = 0.214 #in cm^2/s\n", + "T = 298 #in K\n", + "P = 1 #in atm\n", + "R = 82.1 #in (cm^3)(atm)/(K)(gmol)\n", + "#calculating molar flux of ammonia\n", + "Na = ((Dab*P)/(R*T*l))*math.log((P-pAl)/(P-pAo))\n", + "print '(a) The molar flux of Ammonia is:%0.3E'%Na,'gmol/cm^2.s'\n", + "\n", + "#calculation for (b) and (c) part\n", + "Nb = 0 #air is non-diffusing\n", + "U = (Na/(P/(R*T))) #molar average velocity\n", + "yA = pAo/P\n", + "yB = pAl/P\n", + "uA = U/yA #\n", + "uB = 0 #since Nb=0\n", + "Ma = 17\n", + "Mb = 29\n", + "M = Ma*yA + Mb*yB\n", + "u = uA*yA*Ma/M #since u =(uA*phoA + uB*phoB)/pho\n", + "print '(b) and (c)'\n", + "print 'Velocity of A is %0.3f'%uA,'cm/s'\n", + "print 'Velocity of B is %0.3f'%uB,'cm/s'\n", + "print 'Mass average velocity of A is %0.3f'%u,'cm/s'\n", + "print 'Molar average velocity of A is %0.2f'%U,'cm/s'\n", + "\n", + "#calculation for (d) part\n", + "Ca = pAo/(R*T)\n", + "Ia = Ca*(uA - u) #molar flux of NH3 relative to an observer moving\n", + " #with the mass average velocity \n", + "print '(d) Molar flux of NH3 is %0.3E'%Ia,'gmol/cm^2.s'\n", + "\n", + "z = []\n", + "pa =[]\n", + "for i in np.arange(0,1,0.01):\n", + " z.append(i)\n", + " \n", + "for i in range(0,len(z)):\n", + " pa.append(1-(0.1*math.exp(2.197*z[i])))\n", + " \n", + "from matplotlib.pyplot import*\n", + "plot(z,pa);\n", + "plt.xlabel('z(cm)');\n", + "plt.ylabel('pA(atm)');" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "##Example 2.4" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(a) Rate of diffusion of oxygen 7.151E-10 kmol/s\n", + "(b) The partial pressure gradient of oxygen at midway in diffusion path is: -4.25 bar/m\n", + "(c)\n", + "Molar average velocity and diffusion velocities at \"midway\"\n", + "Molar average velocity in z-direction is 9.9E-05 m/s\n", + "The diffusion velocity of oxygen 7.9E-04 m/s\n", + "The diffusion velocity of Nitrogen -9.9E-05 m/s\n", + "Molar average velocity and diffusion velocities at \"top of tube\"\n", + "Molar average velocity in z-direction is 9.9E-05 m/s\n", + "The diffusion velocity of oxygen 3.72E-04 m/s\n", + "The diffusion velocity of Nitrogen -9.9E-05 m/s\n", + "Molar average velocity and diffusion velocities at \"bottom of tube\"\n", + "Molar average velocity in z-direction is 9.9E-05 m/s\n", + "The diffusion velocity of oxygen is not infinity\n", + "The diffusion velocity of Nitrogen -9.9E-05 m/s\n", + "(d)\n", + "New molar flux of (A) 4.95E-06 kmol/m^2.s\n", + "New molar flux of (B) 7.19E-06 kmol/m^2.s\n" + ] + }, + { + "data": { + "image/png": "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\nAABJRU5ErkJggg==\n", + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#calculation of (a) part\n", + "#given data\n", + "import math\n", + "T = 298 #in kelvin\n", + "P = 1.013 #in bar\n", + "pAl = 0 #partial pressure of oxygen(A) at liquid surface\n", + "pAo = 0.21*1.013 #partial pressure of oxygen at open mouth\n", + "l = 0.05 #length of diffusion path in m\n", + "Dab = 2.1e-5 #diffusivity in m^2/s\n", + "R = 0.08317 #in m^3.bar.kmol.K\n", + "Na = Dab*P*math.log((P-pAl)/(P-pAo))/(R*T*l) #in kmol/m^2.s\n", + "area = (math.pi/4)*(0.015)**2\n", + "rate = area*Na\n", + "print '(a) Rate of diffusion of oxygen %0.3E'%rate,'kmol/s'\n", + "z = []\n", + "pa =[]\n", + "for i in np.arange(0,1,0.01):\n", + " z.append(i)\n", + " \n", + "for i in range(0,len(z)):\n", + " pa.append(P-(P-pAo)*math.exp((R*T*Na*z[i])/(Dab*P)))\n", + " \n", + "from matplotlib.pyplot import*\n", + "plot(z,pa);\n", + "plt.xlabel('z(cm)');\n", + "plt.ylabel('pA(atm)');\n", + "\n", + "#calculation of (b) part\n", + "z = 0.025 #diffusion path\n", + "pA = 0.113 #in bar\n", + "#we have to find partial pressure gradient of oxygen at mid way of diffusion path\n", + "#let dpA/dz = ppd\n", + "ppd = -(R*T*round(Na,8)*(P-pA))/(Dab*P)\n", + "print '(b) The partial pressure gradient of oxygen at midway in diffusion path is: %0.2f'%ppd,'bar/m'\n", + "\n", + "#calculation of (c) part\n", + "uA = Na*(R*T/pA) #velocity of oxygen\n", + "uB = 0 #since nitrogen is non-diffusing hence Nb = 0\n", + "U = pA*uA/P #since U=1/C*(uA*Ca + uB*Cb)\n", + "vAd = uA - U #diffusion velocity of oxygen\n", + "vBd = uB - U #diffusion velocity of nitrogen\n", + "print '(c)'\n", + "print 'Molar average velocity and diffusion velocities at \"midway\"'\n", + "print 'Molar average velocity in z-direction is %0.1E'%U,'m/s'\n", + "print 'The diffusion velocity of oxygen %0.1E'%vAd,'m/s'\n", + "print 'The diffusion velocity of Nitrogen %0.1E'%vBd,'m/s'\n", + "#at z=0(at top of tube)\n", + "uA = Na*(R*T/pAo)\n", + "uB = 0\n", + "U = pAo*uA/P\n", + "vAd = uA - U\n", + "vBd = uB - U\n", + "print 'Molar average velocity and diffusion velocities at \"top of tube\"'\n", + "print 'Molar average velocity in z-direction is %0.1E'%U,'m/s'\n", + "print 'The diffusion velocity of oxygen %0.2E'%vAd,'m/s'\n", + "print 'The diffusion velocity of Nitrogen %0.1E'%vBd,'m/s'\n", + "#at z=0.05(at bottom of tube)\n", + "#uA = inf\n", + "uB = 0\n", + "U = pAo*uA/P\n", + "vAd = uA - U\n", + "vBd = uB - U\n", + "print 'Molar average velocity and diffusion velocities at \"bottom of tube\"'\n", + "print 'Molar average velocity in z-direction is %0.1E'%U,'m/s'\n", + "print 'The diffusion velocity of oxygen is not infinity'\n", + "print 'The diffusion velocity of Nitrogen %0.1E'%vBd,'m/s'\n", + "\n", + "#calculation of (d) part\n", + "V = -2*U\n", + "pA = 0.113\n", + "Nad = round(Na,8) - V*(pA/(R*T))\n", + "Nbd = 0 - (P - pA)*V/(R*T)\n", + "print '(d)'\n", + "print 'New molar flux of (A) %0.2E'%Nad,'kmol/m^2.s'\n", + "print 'New molar flux of (B) %0.2E'%Nbd,'kmol/m^2.s'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##Example 2.5" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(a) The air-film thickness is :0.00193 m\n" + ] + } + ], + "source": [ + "#given data\n", + "area = 3*4 #in m^2\n", + "mperarea = 3.0/12 #in kg/m^2\n", + "#part (a)\n", + "P = 1.013 #in bar\n", + "Dab = 9.95e-6 #in m^2/s\n", + "R = 0.08317 #in m^3.bar./K.kmol\n", + "T = 273+27 #in K\n", + "#let d=1\n", + "d = 1 #in m\n", + "pAo = 0.065 #partial pressure of alcohol on liquid surface\n", + "pAd = 0 #partial pressure over d length of stagnant film of air\n", + "Na = (Dab*P*math.log((P-pAd)/(P-pAo)))/(R*T*d) #in kmol/m^2.s\n", + "Na = Na*60 #in kg/m^2.s\n", + "flux = mperarea/(5*60) #since the liquid evaporates completely in 5 minutes\n", + "#now we have to find the value of d\n", + "d = Na/flux\n", + "print '(a) The air-film thickness is :%0.5f'%d,'m'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##Example 2.6" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(a)\n", + "The steady-state flux is: 3.35E-06 kmol/m^2.s\n", + "The rate of transport of N2 from vessel 1 to 2: 6.6E-09 kmol/s\n", + "(b)\n", + "The flux and the rate of transport of oxygen is: -3.35E-06 kmol/m^2.s\n", + "(c)\n", + "Partial pressure at a point 0.05m from vessel 1 is: 1.2 atm\n", + "(d)\n", + "Net or total mass flux: -1.340E-05 kmol/m^2.s\n" + ] + } + ], + "source": [ + "#given data\n", + "#part (a)\n", + "Dab = 0.23e-4*0.5*(293.0/316)**1.75 #in m^2/s\n", + "pA1 = 2*0.8 #in atm\n", + "pA2 = 2*0.2 #in atm\n", + "l = 0.15 #in m\n", + "R = 0.0821 #in m^3.atm./K.kmol\n", + "T = 293 #in K\n", + "Ma = 28\n", + "Mb = 32\n", + "Na = Dab*(pA1-pA2)/(R*T*l) #in kmol/m^2.s\n", + "area = math.pi/4*(0.05)**2 #in m^2\n", + "rate = area*Na\n", + "print '(a)'\n", + "print 'The steady-state flux is: %0.2E'%Na,'kmol/m^2.s'\n", + "print 'The rate of transport of N2 from vessel 1 to 2: %0.1E'%rate,'kmol/s'\n", + "\n", + "#part (b)\n", + "Nb = -Na\n", + "print '(b)'\n", + "print 'The flux and the rate of transport of oxygen is: %0.2E'%Nb,'kmol/m^2.s'\n", + "\n", + "#part (c)\n", + "#let dpA/dz = ppg\n", + "dz = 0.05 #in m\n", + "ppg = (pA2 - pA1)/l #in atm/m\n", + "pA = pA1 + (ppg)*dz #in atm\n", + "print '(c)'\n", + "print 'Partial pressure at a point 0.05m from vessel 1 is: %0.1f'%pA,'atm'\n", + "\n", + "#part (d)\n", + "nt = Ma*Na + Mb*Nb\n", + "print '(d)'\n", + "print 'Net or total mass flux: %0.3E'%nt,'kmol/m^2.s'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##Example 2.7" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Methanol flux: 4.64e-05 kmol/m^2.s\n", + "Water flux: -4.06e-05 kmol/m^2.s\n" + ] + } + ], + "source": [ + "#given data\n", + "Ha = 274.6*32 #molar latent heat of methanol(a)\n", + "Hb = 557.7*18 #molar latent heat of water(b)\n", + "yAl = 0.76 #mole fraction of methanol in the vapour\n", + "yAo = 0.825 #mole fraction of methanol in the vapour at the liquid-vapour interface\n", + "P = 1 #in atm\n", + "l = 1e-3 #in m\n", + "T =344.2 #in K\n", + "R = 0.0821 #m^3.atm./K.kmol\n", + "Dab = 1.816e-5 #in m^2/s\n", + "Na = Dab*P*math.log((1-0.1247*yAl)/(1-0.1247*yAo))/(0.1247*R*T*l)\n", + "print 'Methanol flux: %0.2e'%Na,'kmol/m^2.s'\n", + "Nb = -(Ha/Hb)*Na\n", + "print 'Water flux: %0.2e'%Nb,'kmol/m^2.s'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##Example 2.8" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Value of pA1 is 0.937 atm\n" + ] + } + ], + "source": [ + "#given values\n", + "import math\n", + "V1 = 3000 #in cm^3\n", + "V2 = 4000 #in cm^3\n", + "Dab = 0.23 #in cm^2/s\n", + "Dba = 0.23 #in cm^2/s\n", + "l1 = 4 #in cm\n", + "d1 = 0.5 #in cm\n", + "l2 = 2 #in cm\n", + "d2 = 0.3 #in cm\n", + "pA3 = 1 #in atm\n", + "#unknowns\n", + "# pA1 and pA2\n", + "# dpA1bydt = (Dab/V1*l1)*((pA1)-(pA2))*((math.pi*(d1**2))/4)\n", + "#on integrating using Laplace trandformation\n", + "# initial conditions\n", + "t=18000 #in seconds\n", + "pA1 = 1-0.57*(math.exp((-1.005)*(10**(-6))*t)-math.exp((-7.615)*(10**(-6))*t))\n", + "print 'Value of pA1 is %0.3f'%pA1,'atm'" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "##Example 2.10" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Value of flux of water vapour: 2.96E-05 kmol/m^2.s\n" + ] + } + ], + "source": [ + "#given values\n", + "import math\n", + "y1l = 0 #mol fraction of dry air\n", + "y10 = (17.53/760) #mol fraction of water\n", + "l = 1.5 #in mm\n", + "C = 0.0409 #in kmol/m^3 : calculated by P/RT\n", + "D12 = 0.923 #Diffusivity of hydrogen over water\n", + "D13 = 0.267 #Diffusivity of oxygen over water\n", + "y2 = 0.6 #mole fraction of hydrogen\n", + "y3 = 0.4 #mole fraction of oxygen\n", + "D1m = 1/((y2/D12)+(y3/D13)) #calculating mean diffusivity\n", + "Ni = (D1m*C*1000/(l*10000))*math.log((1-y1l)/(1-y10))\n", + "print 'Value of flux of water vapour: %0.2E'%Ni,'kmol/m^2.s'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##Example 2.11" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Flux of ethane 4.804E-05 gmol/cm^2.s\n" + ] + } + ], + "source": [ + "#given data\n", + "y1 = 0.4 #mole fraction of ethane(1)\n", + "y2 = 0.3 #mole fraction of ethylene(2)\n", + "y3 = 0.3 #mole fraction of hydrogen(3)\n", + "#calculating D13\n", + "#The Lennard-Jones parameters are\n", + "sigma1 = 4.443 #in angstrom\n", + "sigma2 = 4.163 #in angstrom\n", + "sigma3 = 2.827 #in angstrom\n", + "e1byk = 215.7\n", + "e2byk = 224.7\n", + "e3byk = 59.7\n", + "sigma13 = (sigma1 + sigma3)/2 #in angstrom\n", + "e13byk = (e1byk*e3byk)**0.5\n", + "kTbye13 = 993/113.5\n", + "ohmD13 = 0.76 #from collision integral table\n", + "D13 = ((0.001858)*(993**1.5)*((1.0/30)+(1.0/2))**0.5)/((2)*(sigma13**2)*(ohmD13))\n", + "#calculating D23\n", + "sigma23 = (sigma2+sigma3)/2\n", + "kTbye23 = ((993/224.7)*(993/59.7))*0.5\n", + "ohmD23 = 0.762\n", + "D23 = (0.001858*(993**1.5)*((1.0/28)+(1.0/2))**0.5)/(2*(sigma23**2)*ohmD23)\n", + "D = (D13+D23)/2 #in cm^2/s\n", + "l = 0.15 #in cm\n", + "#at z=0 (bulk gas)\n", + "y10 = 0.6\n", + "y20 = 0.2\n", + "y30 = 0.2\n", + "#at z=l (catalyst surface)\n", + "y1l = 0.4\n", + "y2l = 0.3\n", + "y3l = 0.3\n", + "C = 2.0/(82.1*993) #calculated by P/RT\n", + "N1 = (D*C/l)*math.log((y10+y20)/(y1l+y2l))\n", + "print 'Flux of ethane %0.3E'%N1,'gmol/cm^2.s'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/PrashantSahu/Chapter_2_Molecular.ipynb b/sample_notebooks/PrashantSahu/Chapter_2_Molecular.ipynb deleted file mode 100755 index 7df6880b..00000000 --- a/sample_notebooks/PrashantSahu/Chapter_2_Molecular.ipynb +++ /dev/null @@ -1,657 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "#Chapter 2 : Molecular Diffusion\n", - "##Example 2.1 " - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Molar average velocity of gas mixture is: 0.0303\n", - "Mass average velocity of gas mixture is: 0.029\n" - ] - } - ], - "source": [ - "import math\n", - "N2 = 0.05 #mole fraction of Nitrogen denoted as 1\n", - "H2 = 0.15 #mole fraction of Hydrogen denoted as 2\n", - "NH3 = 0.76 #mole fraction of Ammonia denoted as 3\n", - "Ar = 0.04 #mole fraction of Argon denoted as 4\n", - "u1 = 0.03\n", - "u2 = 0.035\n", - "u3 = 0.03\n", - "u4 = 0.02\n", - "#Calculating molar average velocity\n", - "U = N2*u1 + H2*u2 + NH3*u3 + Ar*u4\n", - "print 'Molar average velocity of gas mixture is: %.4f'%U\n", - "#Calculating of mass average velocity\n", - "M1 = 28\n", - "M2 = 2\n", - "M3 = 17\n", - "M4 = 40\n", - "M = N2*M1 + H2*M2 + NH3*M3 + Ar*M4\n", - "u = (1/M)*(N2*M1*u1 + H2*M2*u2 + NH3*M3*u3 + Ar*M4*u4)\n", - "print 'Mass average velocity of gas mixture is: %.3f'%u" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - " ##Example 2.2" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false, - "scrolled": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(a) Time for complete evaporation is: 15.93 hours\n", - "(b) Time for disappearance of water is: 8.87 hours\n" - ] - } - ], - "source": [ - "import math\n", - "import numpy as np\n", - "\n", - "#Calcualtion for (a) part\n", - "#calculating vapor pressure of water at 301K\n", - "pv = math.exp(13.8573 - (5160.2/301)) #in bar\n", - "#wet-bulb temperature is 22.5 degree centigrade\n", - "#calculating mean air-film temperature\n", - "Tm = ((28+22.5)/2)+273 #in kelvin\n", - "#calculating diffusion coefficient\n", - "Dab = ((0.853*(30.48**2))*((298.2/273)**1.75))/(3600*10000) #in m^2/s\n", - "l = 2.5e-3 #in m\n", - "P = 1.013 #in bar\n", - "R = 0.08317 #Gas constant\n", - "pAo = math.exp(13.8573 - (5160.2/295.2)) #vapor pressure of water at the wet-bulb temperature, 22.2C\n", - "pAl = 0.6*round(pv,4)\n", - "Na = (((round(Dab,7)*P)/(R*298.2*l))*math.log((P-pAl)/(P-round(pAo,3))))*18 #in kg/m^2s\n", - "#amount of water per m^2 of floor area is\n", - "thickness = 2e-3\n", - "Amount = thickness*1 #in m^3 \n", - "#density of water is 1000kg/m^3\n", - "#therefore in kg it is\n", - "amount = Amount*1000\n", - "Time_for_completion = amount/Na #in seconds\n", - "Time_for_completion_hours = Time_for_completion/3600\n", - "print '(a) Time for complete evaporation is: %.2f'%Time_for_completion_hours,'hours'\n", - "\n", - "#Calculation for (b) part\n", - "water_loss = 0.1 #in kg/m^2.h\n", - "water_loss_by_evaporation = Na*3600\n", - "total_water_loss = water_loss + water_loss_by_evaporation\n", - "time_for_disappearance = amount/total_water_loss\n", - "print '(b) Time for disappearance of water is: %0.2f'%time_for_disappearance,'hours'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##Example 2.3" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(a) The molar flux of Ammonia is:1.922E-05 gmol/cm^2.s\n", - "(b) and (c)\n", - "Velocity of A is 0.522 cm/s\n", - "Velocity of B is 0.000 cm/s\n", - "Mass average velocity of A is 0.439 cm/s\n", - "Molar average velocity of A is 0.47 cm/s\n", - "(d) Molar flux of NH3 is 3.062E-06 gmol/cm^2.s\n" - ] - }, - { - "data": { - "image/png": "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\n", - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "%matplotlib inline\n", - "import matplotlib\n", - "import math\n", - "import numpy as np\n", - "from matplotlib import pyplot as plt\n", - "#calculation for (a) part\n", - "l = 1 #thickness of air in cm\n", - "pAo = 0.9 #in atm\n", - "pAl = 0.1 #in atm\n", - "Dab = 0.214 #in cm^2/s\n", - "T = 298 #in K\n", - "P = 1 #in atm\n", - "R = 82.1 #in (cm^3)(atm)/(K)(gmol)\n", - "#calculating molar flux of ammonia\n", - "Na = ((Dab*P)/(R*T*l))*math.log((P-pAl)/(P-pAo))\n", - "print '(a) The molar flux of Ammonia is:%0.3E'%Na,'gmol/cm^2.s'\n", - "\n", - "#calculation for (b) and (c) part\n", - "Nb = 0 #air is non-diffusing\n", - "U = (Na/(P/(R*T))) #molar average velocity\n", - "yA = pAo/P\n", - "yB = pAl/P\n", - "uA = U/yA #\n", - "uB = 0 #since Nb=0\n", - "Ma = 17\n", - "Mb = 29\n", - "M = Ma*yA + Mb*yB\n", - "u = uA*yA*Ma/M #since u =(uA*phoA + uB*phoB)/pho\n", - "print '(b) and (c)'\n", - "print 'Velocity of A is %0.3f'%uA,'cm/s'\n", - "print 'Velocity of B is %0.3f'%uB,'cm/s'\n", - "print 'Mass average velocity of A is %0.3f'%u,'cm/s'\n", - "print 'Molar average velocity of A is %0.2f'%U,'cm/s'\n", - "\n", - "#calculation for (d) part\n", - "Ca = pAo/(R*T)\n", - "Ia = Ca*(uA - u) #molar flux of NH3 relative to an observer moving\n", - " #with the mass average velocity \n", - "print '(d) Molar flux of NH3 is %0.3E'%Ia,'gmol/cm^2.s'\n", - "\n", - "z = []\n", - "pa =[]\n", - "for i in np.arange(0,1,0.01):\n", - " z.append(i)\n", - " \n", - "for i in range(0,len(z)):\n", - " pa.append(1-(0.1*math.exp(2.197*z[i])))\n", - " \n", - "from matplotlib.pyplot import*\n", - "plot(z,pa);\n", - "plt.xlabel('z(cm)');\n", - "plt.ylabel('pA(atm)');" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "collapsed": true - }, - "source": [ - "##Example 2.4" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(a) Rate of diffusion of oxygen 7.151E-10 kmol/s\n", - "(b) The partial pressure gradient of oxygen at midway in diffusion path is: -4.25 bar/m\n", - "(c)\n", - "Molar average velocity and diffusion velocities at \"midway\"\n", - "Molar average velocity in z-direction is 9.9E-05 m/s\n", - "The diffusion velocity of oxygen 7.9E-04 m/s\n", - "The diffusion velocity of Nitrogen -9.9E-05 m/s\n", - "Molar average velocity and diffusion velocities at \"top of tube\"\n", - "Molar average velocity in z-direction is 9.9E-05 m/s\n", - "The diffusion velocity of oxygen 3.72E-04 m/s\n", - "The diffusion velocity of Nitrogen -9.9E-05 m/s\n", - "Molar average velocity and diffusion velocities at \"bottom of tube\"\n", - "Molar average velocity in z-direction is 9.9E-05 m/s\n", - "The diffusion velocity of oxygen is not infinity\n", - "The diffusion velocity of Nitrogen -9.9E-05 m/s\n", - "(d)\n", - "New molar flux of (A) 4.95E-06 kmol/m^2.s\n", - "New molar flux of (B) 7.19E-06 kmol/m^2.s\n" - ] - }, - { - "data": { - "image/png": "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\nAABJRU5ErkJggg==\n", - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#calculation of (a) part\n", - "#given data\n", - "import math\n", - "T = 298 #in kelvin\n", - "P = 1.013 #in bar\n", - "pAl = 0 #partial pressure of oxygen(A) at liquid surface\n", - "pAo = 0.21*1.013 #partial pressure of oxygen at open mouth\n", - "l = 0.05 #length of diffusion path in m\n", - "Dab = 2.1e-5 #diffusivity in m^2/s\n", - "R = 0.08317 #in m^3.bar.kmol.K\n", - "Na = Dab*P*math.log((P-pAl)/(P-pAo))/(R*T*l) #in kmol/m^2.s\n", - "area = (math.pi/4)*(0.015)**2\n", - "rate = area*Na\n", - "print '(a) Rate of diffusion of oxygen %0.3E'%rate,'kmol/s'\n", - "z = []\n", - "pa =[]\n", - "for i in np.arange(0,1,0.01):\n", - " z.append(i)\n", - " \n", - "for i in range(0,len(z)):\n", - " pa.append(P-(P-pAo)*math.exp((R*T*Na*z[i])/(Dab*P)))\n", - " \n", - "from matplotlib.pyplot import*\n", - "plot(z,pa);\n", - "plt.xlabel('z(cm)');\n", - "plt.ylabel('pA(atm)');\n", - "\n", - "#calculation of (b) part\n", - "z = 0.025 #diffusion path\n", - "pA = 0.113 #in bar\n", - "#we have to find partial pressure gradient of oxygen at mid way of diffusion path\n", - "#let dpA/dz = ppd\n", - "ppd = -(R*T*round(Na,8)*(P-pA))/(Dab*P)\n", - "print '(b) The partial pressure gradient of oxygen at midway in diffusion path is: %0.2f'%ppd,'bar/m'\n", - "\n", - "#calculation of (c) part\n", - "uA = Na*(R*T/pA) #velocity of oxygen\n", - "uB = 0 #since nitrogen is non-diffusing hence Nb = 0\n", - "U = pA*uA/P #since U=1/C*(uA*Ca + uB*Cb)\n", - "vAd = uA - U #diffusion velocity of oxygen\n", - "vBd = uB - U #diffusion velocity of nitrogen\n", - "print '(c)'\n", - "print 'Molar average velocity and diffusion velocities at \"midway\"'\n", - "print 'Molar average velocity in z-direction is %0.1E'%U,'m/s'\n", - "print 'The diffusion velocity of oxygen %0.1E'%vAd,'m/s'\n", - "print 'The diffusion velocity of Nitrogen %0.1E'%vBd,'m/s'\n", - "#at z=0(at top of tube)\n", - "uA = Na*(R*T/pAo)\n", - "uB = 0\n", - "U = pAo*uA/P\n", - "vAd = uA - U\n", - "vBd = uB - U\n", - "print 'Molar average velocity and diffusion velocities at \"top of tube\"'\n", - "print 'Molar average velocity in z-direction is %0.1E'%U,'m/s'\n", - "print 'The diffusion velocity of oxygen %0.2E'%vAd,'m/s'\n", - "print 'The diffusion velocity of Nitrogen %0.1E'%vBd,'m/s'\n", - "#at z=0.05(at bottom of tube)\n", - "#uA = inf\n", - "uB = 0\n", - "U = pAo*uA/P\n", - "vAd = uA - U\n", - "vBd = uB - U\n", - "print 'Molar average velocity and diffusion velocities at \"bottom of tube\"'\n", - "print 'Molar average velocity in z-direction is %0.1E'%U,'m/s'\n", - "print 'The diffusion velocity of oxygen is not infinity'\n", - "print 'The diffusion velocity of Nitrogen %0.1E'%vBd,'m/s'\n", - "\n", - "#calculation of (d) part\n", - "V = -2*U\n", - "pA = 0.113\n", - "Nad = round(Na,8) - V*(pA/(R*T))\n", - "Nbd = 0 - (P - pA)*V/(R*T)\n", - "print '(d)'\n", - "print 'New molar flux of (A) %0.2E'%Nad,'kmol/m^2.s'\n", - "print 'New molar flux of (B) %0.2E'%Nbd,'kmol/m^2.s'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##Example 2.5" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(a) The air-film thickness is :0.00193 m\n" - ] - } - ], - "source": [ - "#given data\n", - "area = 3*4 #in m^2\n", - "mperarea = 3.0/12 #in kg/m^2\n", - "#part (a)\n", - "P = 1.013 #in bar\n", - "Dab = 9.95e-6 #in m^2/s\n", - "R = 0.08317 #in m^3.bar./K.kmol\n", - "T = 273+27 #in K\n", - "#let d=1\n", - "d = 1 #in m\n", - "pAo = 0.065 #partial pressure of alcohol on liquid surface\n", - "pAd = 0 #partial pressure over d length of stagnant film of air\n", - "Na = (Dab*P*math.log((P-pAd)/(P-pAo)))/(R*T*d) #in kmol/m^2.s\n", - "Na = Na*60 #in kg/m^2.s\n", - "flux = mperarea/(5*60) #since the liquid evaporates completely in 5 minutes\n", - "#now we have to find the value of d\n", - "d = Na/flux\n", - "print '(a) The air-film thickness is :%0.5f'%d,'m'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##Example 2.6" - ] - }, - { - "cell_type": "code", - "execution_count": 33, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(a)\n", - "The steady-state flux is: 3.35E-06 kmol/m^2.s\n", - "The rate of transport of N2 from vessel 1 to 2: 6.6E-09 kmol/s\n", - "(b)\n", - "The flux and the rate of transport of oxygen is: -3.35E-06 kmol/m^2.s\n", - "(c)\n", - "Partial pressure at a point 0.05m from vessel 1 is: 1.2 atm\n", - "(d)\n", - "Net or total mass flux: -1.340E-05 kmol/m^2.s\n" - ] - } - ], - "source": [ - "#given data\n", - "#part (a)\n", - "Dab = 0.23e-4*0.5*(293.0/316)**1.75 #in m^2/s\n", - "pA1 = 2*0.8 #in atm\n", - "pA2 = 2*0.2 #in atm\n", - "l = 0.15 #in m\n", - "R = 0.0821 #in m^3.atm./K.kmol\n", - "T = 293 #in K\n", - "Ma = 28\n", - "Mb = 32\n", - "Na = Dab*(pA1-pA2)/(R*T*l) #in kmol/m^2.s\n", - "area = math.pi/4*(0.05)**2 #in m^2\n", - "rate = area*Na\n", - "print '(a)'\n", - "print 'The steady-state flux is: %0.2E'%Na,'kmol/m^2.s'\n", - "print 'The rate of transport of N2 from vessel 1 to 2: %0.1E'%rate,'kmol/s'\n", - "\n", - "#part (b)\n", - "Nb = -Na\n", - "print '(b)'\n", - "print 'The flux and the rate of transport of oxygen is: %0.2E'%Nb,'kmol/m^2.s'\n", - "\n", - "#part (c)\n", - "#let dpA/dz = ppg\n", - "dz = 0.05 #in m\n", - "ppg = (pA2 - pA1)/l #in atm/m\n", - "pA = pA1 + (ppg)*dz #in atm\n", - "print '(c)'\n", - "print 'Partial pressure at a point 0.05m from vessel 1 is: %0.1f'%pA,'atm'\n", - "\n", - "#part (d)\n", - "nt = Ma*Na + Mb*Nb\n", - "print '(d)'\n", - "print 'Net or total mass flux: %0.3E'%nt,'kmol/m^2.s'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##Example 2.7" - ] - }, - { - "cell_type": "code", - "execution_count": 35, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Methanol flux: 4.64e-05 kmol/m^2.s\n", - "Water flux: -4.06e-05 kmol/m^2.s\n" - ] - } - ], - "source": [ - "#given data\n", - "Ha = 274.6*32 #molar latent heat of methanol(a)\n", - "Hb = 557.7*18 #molar latent heat of water(b)\n", - "yAl = 0.76 #mole fraction of methanol in the vapour\n", - "yAo = 0.825 #mole fraction of methanol in the vapour at the liquid-vapour interface\n", - "P = 1 #in atm\n", - "l = 1e-3 #in m\n", - "T =344.2 #in K\n", - "R = 0.0821 #m^3.atm./K.kmol\n", - "Dab = 1.816e-5 #in m^2/s\n", - "Na = Dab*P*math.log((1-0.1247*yAl)/(1-0.1247*yAo))/(0.1247*R*T*l)\n", - "print 'Methanol flux: %0.2e'%Na,'kmol/m^2.s'\n", - "Nb = -(Ha/Hb)*Na\n", - "print 'Water flux: %0.2e'%Nb,'kmol/m^2.s'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##Example 2.8" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Value of pA1 is 0.937 atm\n" - ] - } - ], - "source": [ - "#given values\n", - "import math\n", - "V1 = 3000 #in cm^3\n", - "V2 = 4000 #in cm^3\n", - "Dab = 0.23 #in cm^2/s\n", - "Dba = 0.23 #in cm^2/s\n", - "l1 = 4 #in cm\n", - "d1 = 0.5 #in cm\n", - "l2 = 2 #in cm\n", - "d2 = 0.3 #in cm\n", - "pA3 = 1 #in atm\n", - "#unknowns\n", - "# pA1 and pA2\n", - "# dpA1bydt = (Dab/V1*l1)*((pA1)-(pA2))*((math.pi*(d1**2))/4)\n", - "#on integrating using Laplace trandformation\n", - "# initial conditions\n", - "t=18000 #in seconds\n", - "pA1 = 1-0.57*(math.exp((-1.005)*(10**(-6))*t)-math.exp((-7.615)*(10**(-6))*t))\n", - "print 'Value of pA1 is %0.3f'%pA1,'atm'" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "collapsed": true - }, - "source": [ - "##Example 2.10" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Value of flux of water vapour: 2.96E-05 kmol/m^2.s\n" - ] - } - ], - "source": [ - "#given values\n", - "import math\n", - "y1l = 0 #mol fraction of dry air\n", - "y10 = (17.53/760) #mol fraction of water\n", - "l = 1.5 #in mm\n", - "C = 0.0409 #in kmol/m^3 : calculated by P/RT\n", - "D12 = 0.923 #Diffusivity of hydrogen over water\n", - "D13 = 0.267 #Diffusivity of oxygen over water\n", - "y2 = 0.6 #mole fraction of hydrogen\n", - "y3 = 0.4 #mole fraction of oxygen\n", - "D1m = 1/((y2/D12)+(y3/D13)) #calculating mean diffusivity\n", - "Ni = (D1m*C*1000/(l*10000))*math.log((1-y1l)/(1-y10))\n", - "print 'Value of flux of water vapour: %0.2E'%Ni,'kmol/m^2.s'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##Example 2.11" - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Flux of ethane 4.804E-05 gmol/cm^2.s\n" - ] - } - ], - "source": [ - "#given data\n", - "y1 = 0.4 #mole fraction of ethane(1)\n", - "y2 = 0.3 #mole fraction of ethylene(2)\n", - "y3 = 0.3 #mole fraction of hydrogen(3)\n", - "#calculating D13\n", - "#The Lennard-Jones parameters are\n", - "sigma1 = 4.443 #in angstrom\n", - "sigma2 = 4.163 #in angstrom\n", - "sigma3 = 2.827 #in angstrom\n", - "e1byk = 215.7\n", - "e2byk = 224.7\n", - "e3byk = 59.7\n", - "sigma13 = (sigma1 + sigma3)/2 #in angstrom\n", - "e13byk = (e1byk*e3byk)**0.5\n", - "kTbye13 = 993/113.5\n", - "ohmD13 = 0.76 #from collision integral table\n", - "D13 = ((0.001858)*(993**1.5)*((1.0/30)+(1.0/2))**0.5)/((2)*(sigma13**2)*(ohmD13))\n", - "#calculating D23\n", - "sigma23 = (sigma2+sigma3)/2\n", - "kTbye23 = ((993/224.7)*(993/59.7))*0.5\n", - "ohmD23 = 0.762\n", - "D23 = (0.001858*(993**1.5)*((1.0/28)+(1.0/2))**0.5)/(2*(sigma23**2)*ohmD23)\n", - "D = (D13+D23)/2 #in cm^2/s\n", - "l = 0.15 #in cm\n", - "#at z=0 (bulk gas)\n", - "y10 = 0.6\n", - "y20 = 0.2\n", - "y30 = 0.2\n", - "#at z=l (catalyst surface)\n", - "y1l = 0.4\n", - "y2l = 0.3\n", - "y3l = 0.3\n", - "C = 2.0/(82.1*993) #calculated by P/RT\n", - "N1 = (D*C/l)*math.log((y10+y20)/(y1l+y2l))\n", - "print 'Flux of ethane %0.3E'%N1,'gmol/cm^2.s'" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/PrashantSahu/PrashantSahu_version_backup/Chapter-2-Molecular_Diffusion_-_Principles_of_Mass_Transfer_and_Separation_Process_by_Binay.ipynb b/sample_notebooks/PrashantSahu/PrashantSahu_version_backup/Chapter-2-Molecular_Diffusion_-_Principles_of_Mass_Transfer_and_Separation_Process_by_Binay.ipynb new file mode 100755 index 00000000..3f6a6b0c --- /dev/null +++ b/sample_notebooks/PrashantSahu/PrashantSahu_version_backup/Chapter-2-Molecular_Diffusion_-_Principles_of_Mass_Transfer_and_Separation_Process_by_Binay.ipynb @@ -0,0 +1,753 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#Chapter 2 : Molecular Diffusion" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##Example 2.1 Page no. 10" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Molar average velocity of gas mixture is: 0.0303 m/s\n", + "Mass average velocity of gas mixture is: 0.029 m/s\n" + ] + } + ], + "source": [ + "N2 = 0.05 #mole fraction of Nitrogen denoted as 1\n", + "H2 = 0.15 #mole fraction of Hydrogen denoted as 2\n", + "NH3 = 0.76 #mole fraction of Ammonia denoted as 3\n", + "Ar = 0.04 #mole fraction of Argon denoted as 4\n", + "u1 = 0.03\n", + "u2 = 0.035\n", + "u3 = 0.03\n", + "u4 = 0.02\n", + "#Calculating molar average velocity\n", + "U = N2*u1 + H2*u2 + NH3*u3 + Ar*u4\n", + "print 'Molar average velocity of gas mixture is: %.4f m/s'%U\n", + "#Calculating of mass average velocity\n", + "M1 = 28\n", + "M2 = 2\n", + "M3 = 17\n", + "M4 = 40\n", + "M = N2*M1 + H2*M2 + NH3*M3 + Ar*M4\n", + "u = (1/M)*(N2*M1*u1 + H2*M2*u2 + NH3*M3*u3 + Ar*M4*u4)\n", + "print 'Mass average velocity of gas mixture is: %.3f m/s'%u" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " ##Example 2.2 Page no. 16" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false, + "scrolled": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(a) Time for complete evaporation is: 15.93 hours\n", + "(b) Time for disappearance of water is: 8.87 hours\n" + ] + } + ], + "source": [ + "from math import log\n", + "from math import exp\n", + "import numpy as np\n", + "\n", + "#Calcualtion for (a) part\n", + "#calculating vapor pressure of water at 301K\n", + "pv = exp(13.8573 - (5160.2/301)) #in bar\n", + "#wet-bulb temperature is 22.5 degree centigrade\n", + "#calculating mean air-film temperature\n", + "Tm = ((28+22.5)/2)+273 #in kelvin\n", + "#calculating diffusion coefficient\n", + "Dab = ((0.853*(30.48**2))*((298.2/273)**1.75))/(3600*10000) #in m^2/s\n", + "l = 2.5e-3 #in m\n", + "P = 1.013 #in bar\n", + "R = 0.08317 #Gas constant\n", + "pAo = exp(13.8573 - (5160.2/295.2)) #vapor pressure of water at the wet-bulb temperature, 22.2C\n", + "pAl = 0.6*round(pv,4)\n", + "Na = (((round(Dab,7)*P)/(R*298.2*l))*log((P-pAl)/(P-round(pAo,3))))*18 #in kg/m^2s\n", + "#amount of water per m^2 of floor area is\n", + "thickness = 2e-3\n", + "Amount = thickness*1 #in m^3 \n", + "#density of water is 1000kg/m^3\n", + "#therefore in kg it is\n", + "amount = Amount*1000\n", + "Time_for_completion = amount/Na #in seconds\n", + "Time_for_completion_hours = Time_for_completion/3600\n", + "print '(a) Time for complete evaporation is: %.2f'%Time_for_completion_hours,'hours'\n", + "\n", + "#Calculation for (b) part\n", + "water_loss = 0.1 #in kg/m^2.h\n", + "water_loss_by_evaporation = Na*3600\n", + "total_water_loss = water_loss + water_loss_by_evaporation\n", + "time_for_disappearance = amount/total_water_loss\n", + "print '(b) Time for disappearance of water is: %0.2f'%time_for_disappearance,'hours'\n", + "#Answers may vary due to round off error" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##Example 2.3 Page no. 17" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(a) The molar flux of Ammonia is:1.922E-05 gmol/cm^2.s\n", + "(b) and (c)\n", + "Velocity of A is 0.522 cm/s\n", + "Velocity of B is 0.000 cm/s\n", + "Mass average velocity of A is 0.439 cm/s\n", + "Molar average velocity of A is 0.47 cm/s\n", + "(d) Molar flux of NH3 is 3.062E-06 gmol/cm^2.s\n" + ] + }, + { + "data": { + "image/png": "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\n", + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%matplotlib inline\n", + "from math import log\n", + "from math import exp\n", + "import numpy as np\n", + "from matplotlib import pyplot as plt\n", + "#calculation for (a) part\n", + "l = 1 #thickness of air in cm\n", + "pAo = 0.9 #in atm\n", + "pAl = 0.1 #in atm\n", + "Dab = 0.214 #in cm^2/s\n", + "T = 298 #in K\n", + "P = 1 #in atm\n", + "R = 82.1 #in (cm^3)(atm)/(K)(gmol)\n", + "#calculating molar flux of ammonia\n", + "Na = ((Dab*P)/(R*T*l))*log((P-pAl)/(P-pAo))\n", + "print '(a) The molar flux of Ammonia is:%0.3E'%Na,'gmol/cm^2.s'\n", + "\n", + "#calculation for (b) and (c) part\n", + "Nb = 0 #air is non-diffusing\n", + "U = (Na/(P/(R*T))) #molar average velocity\n", + "yA = pAo/P\n", + "yB = pAl/P\n", + "uA = U/yA #\n", + "uB = 0 #since Nb=0\n", + "Ma = 17\n", + "Mb = 29\n", + "M = Ma*yA + Mb*yB\n", + "u = uA*yA*Ma/M #since u =(uA*phoA + uB*phoB)/pho\n", + "print '(b) and (c)'\n", + "print 'Velocity of A is %0.3f'%uA,'cm/s'\n", + "print 'Velocity of B is %0.3f'%uB,'cm/s'\n", + "print 'Mass average velocity of A is %0.3f'%u,'cm/s'\n", + "print 'Molar average velocity of A is %0.2f'%U,'cm/s'\n", + "\n", + "#calculation for (d) part\n", + "Ca = pAo/(R*T)\n", + "Ia = Ca*(uA - u) #molar flux of NH3 relative to an observer moving\n", + " #with the mass average velocity \n", + "print '(d) Molar flux of NH3 is %0.3E'%Ia,'gmol/cm^2.s'\n", + "\n", + "z = []\n", + "pa =[]\n", + "for i in np.arange(0,1,0.01):\n", + " z.append(i)\n", + " \n", + "for i in range(0,len(z)):\n", + " pa.append(1-(0.1*exp(2.197*z[i])))\n", + " \n", + "from matplotlib.pyplot import*\n", + "plot(z,pa);\n", + "plt.xlabel('z(cm)');\n", + "plt.ylabel('pA(atm)');\n", + "#Answers may vary due to round off error" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "##Example 2.4 Page no. 19" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(a) Rate of diffusion of oxygen 7.151E-10 kmol/s\n", + "(b) The partial pressure gradient of oxygen at midway in diffusion path is: -4.25 bar/m\n", + "(c)\n", + "Molar average velocity and diffusion velocities at \"midway\"\n", + "Molar average velocity in z-direction is 9.9E-05 m/s\n", + "The diffusion velocity of oxygen 7.9E-04 m/s\n", + "The diffusion velocity of Nitrogen -9.9E-05 m/s\n", + "Molar average velocity and diffusion velocities at \"top of tube\"\n", + "Molar average velocity in z-direction is 9.9E-05 m/s\n", + "The diffusion velocity of oxygen 3.72E-04 m/s\n", + "The diffusion velocity of Nitrogen -9.9E-05 m/s\n", + "Molar average velocity and diffusion velocities at \"bottom of tube\"\n", + "Molar average velocity in z-direction is 9.9E-05 m/s\n", + "The diffusion velocity of oxygen is not infinity\n", + "The diffusion velocity of Nitrogen -9.9E-05 m/s\n", + "(d)\n", + "New molar flux of (A) 4.95E-06 kmol/m^2.s\n", + "New molar flux of (B) 7.19E-06 kmol/m^2.s\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYoAAAEKCAYAAAAMzhLIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHi1JREFUeJzt3XmUVNW59/HvI42CSDOIoAwCMqioiAM44NACKuLAvbnX\nqNFwxVl81USjETXCfZfG+Y3xGl1elWgS0TglKlEQ0HKIIoiKIoKgIIOKEyJBhIZ+3j92td1gd3V1\nd506p6p/n7X2qlOnTp/zcBZdT++9z97b3B0REZHabBV3ACIikmxKFCIikpEShYiIZKREISIiGSlR\niIhIRkoUIiKSUUncATSEmemZXhGRBnB3q+/PFGyNwt1V3Bk3blzsMSSl6F7oXuheZC4NVbCJQkRE\n8kOJQkREMlKiKHBlZWVxh5AYuhdVdC+q6F40njWm3SouZuaFGLeISJzMDG9KndkiIpIfShQiIpKR\nEoWIiGSkRCEiIhkpUYiISEZKFCIikpEShYiIZKREISIiGSlRiIhIRkoUIiKSkRKFiIhkpEQhIiIZ\nJTJRmNlwM5tvZgvN7NdxxyMi0pQlbvZYM2sGLACGASuAWcAp7v5+tWM0e6yISD0V0+yxg4BF7r7E\n3cuBh4GRWx70/fdQUZH32EREmpySuAOoQRdgWbX3y4EDtjyoTRvYsAFKSmCbbULZeuvw2qJF1b4W\nLeouLVtWvdZUtt02lOrbLVrAVklMsyIiOZbERJFVm9LYseNxD7WKgw4qY9CgMjZsCDWN9es3L99/\nD+vW/fj999+H8u23sHJl2FdZKo/57ruq17Vrq7bXrw/JolWrkDhatdq8bLddKJXbrVtX7at8X72U\nlobSvHnUt1dEmopUKkUqlWr0eZLYR3EgMN7dh6ffjwUq3P3GasfE3kdRURGSxtq1tZd//SuU6ttr\n1lS9VpZvv616bd68KmmUloaaU2kptG0bttu2/XFp166qtG4NVu8WSBFpChraR5HERFFC6MweCnwC\nzKSJdGa7h5rM6tWhfPttKJXvV6+Gb74JpXJ71arNy/ffh+TRvn1V2X778NqhQyjbbx9ed9ih6r1q\nMiLFr2gSBYCZHQPcBjQD7nP367f4vCgTRS6Ul1clja++CuXrr+HLL6veV25/8UXY/vrrUBPp2DEk\nj44doVOnqtcdd6x63Wmn0FcjIoWnqBJFXZQocquiIiSWzz/fvKxcWVU++ww+/TRst2gREsZOO0Hn\nzlWlS5dQunYNn6mWIpIsShSSF+4hqXz6aSiffFJVli+HFSvC6xdfhNpJt26h7LxzeO3evaq0b6/+\nFJF8UqKQRCkvD7WQZctCWboUPv646vXjj2HTJujZE3r0CK+77AK9eoXXnj3VxCWSa0oUUnC++QYW\nL4YlS+Cjj8L2hx+GsnRpqJH07g19+oTSt2947d07jJkRkfpRopCismlTqIksWgQLF4bywQehLF0a\nmrF22y2U3XevKm3bxh25SHIpUUiTsWFDqIHMnx/KvHnw/vuhtG0Le+4Je+wBe+0F/ftDv36hA16k\nqVOikCavoiL0fbz3HsydC+++G8rChaHPY8CAUPbeG/bdNzRtiTQlShQitdiwIdQ25syBt9+Gt94K\npbQ0JIz99oOBA2H//cMARJFipUQhUg/uofN89mx4441QZs8O06AccEBV2XdfNVtJ8VCiEGmkiorQ\nTPX666HMmBH6QPr3h4MPhsGD4ZBDwoh1kUKkRCESgbVrYdYsePVVeOWV8NqpExx6KBx+OJSVhSew\nRAqBEoVIHmzaFDrLX3yxqpSWwhFHwNCh4XXHHeOOUqRmShQiMXAPieOFF2D69JA4unaFo46CI4+E\nww4L65WIJIEShUgCbNoUOsafew6mTg1PVx18MBxzTCh9+2p+K4mPEoVIAq1eDdOmwbPPhrLttnD8\n8XDccaGfQzPsSj4pUYgknHsYxzFpEjz9dJie5Nhj4d/+DYYPD8vmikRJiUKkwKxYAU89BX//e3gU\nd+hQ+M//DLWN0tK4o5NipEQhUsBWrQpJ47HH4KWXYMgQOPnkkDRU05BcUaIQKRLffBNqGQ8/HGoa\nI0bAz38enqIqKYk7OilkShQiReiLL+CRR+AvfwlTjpx8Mpx+epjcUKS+lChEitzChfDnP8MDD4Rl\nZEePhtNOC9si2VCiEGkiKirg+edhwgR45pnQj3HOOeFxW43RkEyUKESaoK++CrWMe+4JCWTMGBg1\nCtq0iTsySSIlCpEmzD08LXXnnWFU+EknwUUXhdX9RCo1NFFsFUUwIpJfZmE227/+Ncw91alTeMT2\n6KPDiPCKirgjlEKmGoVIkVq/Pjxie9ttYZW/Sy+FU0+FbbaJOzKJi5qeRKRG7mFm25tvDmuI/+IX\ncN55Gv3dFKnpSURqZAbDhsGUKaEZ6q23oFcvGDcudIaL1EWJQqQJ2XtveOihsFLfihVh2vMrr1TC\nkMyUKESaoD594N574c03Q5Lo2xeuugq+/jruyCSJlChEmrDu3eHuu2H2bPj885AwrrsO/vWvuCOT\nJFGiEBF69AiD9l59FebODTWO//mf8LSUiBKFiPygb9/Qh/Hss2GBpT32gCeeCE9OSdOlx2NFpFbP\nPQeXXQatW4fxGPvvH3dE0hh6PFZEcu6oo0KH9+jRYa3vM86Azz6LOyrJNyUKEcmoWTM480xYsAC2\n3x723BNuvRXKy+OOTPIllkRhZjeb2ftmNsfMnjCzNtU+G2tmC81svpkdFUd8IvJjpaVhdPerr4bB\ne/vuCy+/HHdUkg+x9FGY2ZHAdHevMLMbANz9CjPrB0wEBgJdgGlAX3ev2OLn1UchEiP3sL73JZfA\n0KGhhrH99nFHJXUpqD4Kd59a7cv/daBrensk8JC7l7v7EmARMCiGEEUkAzM48USYNw/atg3NURMn\n6umoYpWEPoozgGfS252B5dU+W06oWYhIAlU+DfXkk3DDDTBiBCxdGndUkmuRJQozm2pm79ZQjq92\nzFXABnefmOFU+htFJOEGDQqjuw85BPbbL0wPotpF8SiJ6sTufmSmz83sdGAEMLTa7hVAt2rvu6b3\n/cj48eN/2C4rK6OsrKxhgYpITjRvHuaLGjkSTj8dHn00JIxu3er8UYlIKpUilUo1+jxxdWYPB24F\nDnf3L6vtr+zMHkRVZ3bvLXuu1Zktkmzl5XDjjXD77fD738Mpp8QdkUCBLVxkZguBrYHKuSpfc/cx\n6c+uJPRbbAQudvcpNfy8EoVIAZg9G047DQYMCOt5t2sXd0RNW0ElisZSohApHN99B7/+NTz1FDz4\nYOjHkHgoUYhIok2aBGedBRdcEBZLatYs7oiaHiUKEUm8FStCUxSEcRc77RRvPE1NQQ24E5GmqUsX\nmDYNysrCTLQvvhh3RJIN1ShEJBbPPQejRsEvfxmmMt9Kf7ZGTk1PIlJwli2Dn/40NEE98EAY6S3R\nUdOTiBScbt0glYIOHeDAA2HRorgjkpooUYhIrLbZBv73f+Gii2DwYJg8Oe6IZEtqehKRxHjllTAr\n7dixcOGFYZZayR31UYhIUVi8GI47Dg4/PEz/0bx53BEVD/VRiEhR6NkzrKK3eDEceyysXh13RKJE\nISKJ06YNPP009OkDhx0WBupJfJQoRCSRSkrgjjvg1FPh4INh7ty4I2q61EchIok3cWIYmPfII6Hv\nQhpGndkiUtSmTw/rWtx3Hxx/fN3Hy4+pM1tEitrQofCPf8DZZ8Of/xx3NE1LZEuhiojk2sCB8MIL\ncPTRsGpVGKQn0VOiEJGCsvvu8PLLoYaxbl1YFEmipUQhIgWne/cwRfnQobB+PfzmNxrFHSUlChEp\nSF26hGQxbFhIFtdeq2QRFSUKESlYnTqFPothw8AdrrtOySIKShQiUtA6dAir5g0ZEuaF+u//jjui\n4qNEISIFrzJZHHEENGsG11wTd0TFJWOiMLPmwFHAYUAPwIGPgZeAKe6+MeoARUSy0bFjGJRXVhbW\nuNDTULlT68hsM/sN8B/Aa8BM4BPCAL2dgEHAgcBj7n5tfkLdLDaNzBaRGq1YAYceCpdfDuedF3c0\nydLQkdmZahRzgGtr+UaeYGZbAcfV94IiIlHq0gWmTg1zQrVpE6b9kMbRXE8iUpTmzg1PQ917b1gI\nSSKcFNDMBgJXEvooKmsg7u7963uxXFGiEJFszJwZksSTT8JBB8UdTfyiTBQfAL8C5gIVlfvdfUl9\nL5YrShQikq3Jk+H00yGVgt12izuaeEWZKP7p7oMbHFkElChEpD7uvz+Mr/jnP6Fz57ijiU+UieIo\n4CRgGrAhvdvd/Yl6R5kjShQiUl+//W1Y+Oill6C0NO5o4hFlongQ2BV4j82bnkbX92K5okQhIvXl\nDmPGwJIlYT3ukiY43DjKRLEA2C1J38xKFCLSEBs3wrHHQu/eYT3upjYvVJQr3L0K9Kt/SCIiyVJS\nEpqfXnwRbr897mgKRzaVr4OAt81sMbA+vS/Wx2NFRBqqTRuYNAkOPhh69dIYi2xk0/TUHdiyquLu\n/nFkUdVBTU8i0lgzZsAJJ4Taxe67xx1NfkTZ9HStuy+pXoC8z+8kIpJLBx4IN94II0eG9beldtkk\nij2rvzGzEmC/XFzczC41swoza19t31gzW2hm89OP5oqIRGL0aBgxIswHtWlT3NEkV62JwsyuNLM1\nwF5mtqayAJ8DTzX2wmbWDTiSMG155b5+hDEb/YDhwJ3pyQdFRCJxyy1QXg5XXBF3JMlV65ewu//W\n3VsDt7h762qlvbvn4pb+P+DyLfaNBB5y9/J0E9ciwpTmIiKRqHwS6rHH4NFH444mmep86sndrzCz\ndkAfoEW1/S819KJmNhJY7u7v2OYPMncGZlR7vxzo0tDriIhkY/vtQ6IYPhz22ktzQm2pzkRhZmcD\nFwHdgLcICxa9Bgyp4+emAjvW8NFVwFjCynk/HJ7hVDU+3jR+/PgftsvKyigrK8sUjohIRvvtB9df\nDz/5SZh1drvt4o6o8VKpFKlUqtHnyebx2LnAQOA1dx9gZrsB17v7vzfogmZ7AtOB79K7ugIrgAOA\n0QDufkP62MnAOHd/fYtz6PFYEYnEmWfC2rXw0EPFN3I7ysdjv3f3demLtHD3+YS5nxrE3ee6eyd3\n7+nuPQnNS/u6+0pCJ/nJZra1mfUkNHfNbOi1RETq64474IMP4M47444kObIZmb0s3Ufxd2Cqma0C\nluQwhh+qBu4+z8weAeYBG4ExqjqISD61bAl//WsYuT14MAwYEHdE8avXUqhmVgaUApPdfUMdh0dG\nTU8iErWJE8MaFrNnF0d/BUQwe6yZtXb3NXVctM5joqBEISL5cNZZsH49/OlPxdFfEUUfxd/M7A9m\ndtQWI6fbm9nRZnYX8LeGBCsiUghuvx3efBMeeCDuSOKVsenJzIYAPwMGE8Y4AHwCvAI86O6pqAOs\nJS7VKEQkL959F4YMCZMI9uoVdzSNE9nCRUmkRCEi+XTbbVXLqBbyynhRPh5b/SK9zOw3ZvZefS8k\nIlKoLroodGhfd13ckcSjzkRhZl3M7BIzm0VYN7sZcHLkkYmIJMRWW8H994exFTNm1Hl40ck0e+y5\nZpYCpgJtgTOAT919vLu/m6f4REQSoXNnuOsuOO20MHK7Kcn0eGw5MBm42t3npPctTo+mjpX6KEQk\nLqNGQWlpGMFdaKIYR9EBOJHQzNQReAwY7e5dGxNoLihRiEhcVq0KM8z+6U/haahCEulTT+lFhn4K\nnAJsBzzh7lfWO8ocUaIQkTg9+yycfz68806oXRSKyBKFmbUExgCHEOZlmgG0cPf/25BAc0GJQkTi\ndtZZ0KwZ3H133JFkL8pE8SjwLfAXwroRPwPauPuJDQk0F5QoRCRuq1dD//5w771w5JFxR5OdKBPF\nPHfvV9e+fFKiEJEkePZZuOCCMHq7Vau4o6lblAPu3jSzg6pd6EBgdn0vJCJSbI45JkxHfs01cUcS\nrWxqFPOBvsAyQh/FzsACwnoR7u79ow6yhphUoxCRRPjyS9hzT3j6aRg4MO5oMouy6alHps/dfUl9\nL9pYShQikiQPPgg33QRvvAHNm8cdTe00KaCISEzc4dhj4dBDYezYuKOpnRKFiEiMliyB/feHmTNh\nl13ijqZmeZk9VkREatajB/zqV3DhhaGGUUyUKEREcuSSS2DxYvhbka39qaYnEZEcSqXCxIHz5oU1\nLJJEfRQiIgkxahR07Ai33BJ3JJtTohARSYjPP4c99oAXX4R+sc1h8WPqzBYRSYiOHeHqq+Hii4uj\nY1uJQkQkAmPGwCefwJNPxh1J46npSUQkItOmwTnnhI7tFi3ijkZNTyIiiTNsGAwYALfeGnckjaMa\nhYhIhBYvDiO258yBrjEvJK2nnkREEurqq2HZMnjggXjjUKIQEUmoNWugb1/4xz9g333ji0N9FCIi\nCdW6NYwfD5deWpiPyypRiIjkwZlnhoF4Tz8ddyT1p0QhIpIHJSVhSo/LLoPy8rijqR8lChGRPBk+\nHLp3h7vvjjuS+lFntohIHs2ZA0cfDQsXhr6LfCq4zmwzu9DM3jezuWZ2Y7X9Y81soZnNN7Oj4opP\nRCQKe+8dBuL97ndxR5K9WGoUZnYEcCUwwt3LzWwHd//CzPoBE4GBQBdgGtDX3Su2+HnVKESkYH30\nEQwcCPPnww475O+6hVajOB+43t3LAdz9i/T+kcBD7l7u7kuARcCgeEIUEYnGLrvAKafA9dfHHUl2\n4koUfYDDzGyGmaXMbP/0/s7A8mrHLSfULEREisrVV4eR2kuXxh1J3UqiOrGZTQV2rOGjq9LXbefu\nB5rZQOARYJdaTqU2JhEpOjvuCOefHwbiTZgQdzSZRZYo3P3I2j4zs/OBJ9LHzTKzCjPrAKwAulU7\ntGt634+MHz/+h+2ysjLKysoaH7SISB5ddhn06RP6KnbbLffnT6VSpFKpRp8nrs7sc4HO7j7OzPoC\n09x952qd2YOo6szuvWXPtTqzRaRYXH89vPsuTJwY/bUKalJAM2sOTAAGABuAS909lf7sSuAMYCNw\nsbtPqeHnlShEpCisWQO9e8Pzz4d1tqNUUImisZQoRKSY3HwzzJoFjzwS7XWUKERECtTataFWMWUK\n9O8f3XUKbRyFiIiktWoFl18enoBKItUoREQSYN26UKuYNAn22Seaa6hGISJSwFq2DI/LXntt3JH8\nmGoUIiIJsXZtmN4jqiegVKMQESlwrVrBL3+ZvDmgVKMQEUmQb7+FXr3gtddCn0UuqUYhIlIESkvh\nggvghhvijqSKahQiIgnz9ddhDqi33oKdd87deVWjEBEpEu3bw9lnw003xR1JoBqFiEgCrVwJu+8O\nCxbkbhU81ShERIpIp05w4olwxx1xR6IahYhIYi1cCIMHw+LF4dHZxlKNQkSkyPTpA4cdBvfdF28c\nqlGIiCTY66/DSSeF2kXz5o07l2oUIiJF6IADoEcPePTR+GJQohARSbjLLw+PysbVkKJEISKScMcc\nAxs3wvTp8VxfiUJEJOHM4Be/gNtui+n6hdgprM5sEWlq1q0LfRUvvQS77tqwc6gzW0SkiLVsCeec\nA7//ff6vrRqFiEiB+PRT6NcPPvwwzAdVX6pRiIgUuZ12ghNOgHvuye91VaMQESkgb78Nxx8PH31U\n/wF4qlGIiDQBAwaEle8efzx/11SiEBEpMBdemN9ZZZUoREQKzAknwMcfh2aofFCiEBEpMCUlcN55\n8Ic/5Od66swWESlAn38eBt7V51FZdWaLiDQhHTvCccfBH/8Y/bVUoxARKVAzZsCpp4a1KrbK4s9+\n1ShERJqYAw6Adu1g8uRor6NEISJSoMzgggui79RW05OISAH77jvo1g3efBO6d898rJqeRESaoG23\nDf0U994b3TVUoxARKXBz58LRR4dBeCUltR9XUDUKMxtkZjPN7C0zm2VmA6t9NtbMFprZfDM7Ko74\nREQKyZ57hkWNJk2K5vxxNT3dBPzG3fcBrkm/x8z6AScB/YDhwJ1mpuYxEZE6nHsu3H13NOeO60v4\nU6BNerstsCK9PRJ4yN3L3X0JsAgYlP/wREQKy4knwqxZsGRJ7s8dV6K4ArjVzJYCNwNj0/s7A8ur\nHbcc6JLn2ERECk7LlnDaadF0amfo9mgcM5sK7FjDR1cBFwEXufvfzOxEYAJwZC2nqrHXevz48T9s\nl5WVUVZW1phwRUQK3jnnwLBhMG5cWNQolUqRSqUafd5Ynnoys2/dvTS9bcA37t7GzK4AcPcb0p9N\nBsa5++tb/LyeehIRqcEhh8Dll4epyLdUUE89AYvM7PD09hDgg/T2U8DJZra1mfUE+gAz4whQRKQQ\nnXEGTJiQ23PGVaPYH/gDsA2wDhjj7m+lP7sSOAPYCFzs7lNq+HnVKEREarBmTRipvWABdOq0+WcN\nrVFowJ2ISJEZPTqMrbj00s33F1rTk4iIRKSy+SlXf08rUYiIFJlDDoENG2Bmjnp4lShERIqMWW47\ntdVHISJShFasgL32guXLwwyzoD4KERGppksXOOggePzxxp9LNQoRkSK1aBG0bx8K6PFYERGpg5qe\nREQkEkoUIiKSkRKFiIhkpEQhIiIZKVGIiEhGShQiIpKREoWIiGSkRFHgcrHMYbHQvaiie1FF96Lx\nlCgKnH4JquheVNG9qKJ70XhKFCIikpEShYiIZFSwcz3FHYOISCFqMpMCiohI/qjpSUREMlKiEBGR\njBKdKMxsuJnNN7OFZvbrWo65Pf35HDPbJ98x5ktd98LMTk3fg3fM7J9m1j+OOPMhm/8X6eMGmtlG\nM/tJPuPLpyx/R8rM7C0zm2tmqTyHmDdZ/I50MLPJZvZ2+l6cHkOYkTOzCWa20szezXBM/b433T2R\nBWgGLAJ6AM2Bt4HdtzhmBPBMevsAYEbcccd4Lw4C2qS3hzfle1HtuOeBScB/xB13jP8v2gLvAV3T\n7zvEHXeM92I8cH3lfQC+Akrijj2Ce3EosA/wbi2f1/t7M8k1ikHAIndf4u7lwMPAyC2OOQF4AMDd\nXwfamlmn/IaZF3XeC3d/zd1Xp9++DnTNc4z5ks3/C4ALgceAL/IZXJ5lcy9+Bjzu7ssB3P3LPMeY\nL9nci0+B0vR2KfCVu2/MY4x54e4vA6syHFLv780kJ4ouwLJq75en99V1TDF+QWZzL6o7E3gm0oji\nU+e9MLMuhC+Ju9K7ivXRvmz+X/QB2pvZC2b2hpn9PG/R5Vc29+IeYA8z+wSYA1ycp9iSpt7fmyWR\nhtM42f5yb/lMcDF+KWT9bzKzI4AzgMHRhROrbO7FbcAV7u5mZvz4/0ixyOZeNAf2BYYC2wKvmdkM\nd18YaWT5l829uBJ4293LzKwXMNXM9nb3NRHHlkT1+t5McqJYAXSr9r4bIfNlOqZrel+xyeZekO7A\nvgcY7u6Zqp6FLJt7sR/wcMgRdACOMbNyd38qPyHmTTb3YhnwpbuvA9aZ2UvA3kCxJYps7sXBwHUA\n7v6hmS0GdgXeyEuEyVHv780kNz29AfQxsx5mtjVwErDlL/pTwCgAMzsQ+MbdV+Y3zLyo816Y2c7A\nE8Bp7r4ohhjzpc574e67uHtPd+9J6Kc4vwiTBGT3O/IkcIiZNTOzbQmdl/PyHGc+ZHMv5gPDANJt\n8rsCH+U1ymSo9/dmYmsU7r7RzP4PMIXwRMN97v6+mZ2b/vxud3/GzEaY2SJgLTA6xpAjk829AK4B\n2gF3pf+SLnf3QXHFHJUs70WTkOXvyHwzmwy8A1QA97h70SWKLP9f/Bb4o5nNIfyRfLm7fx1b0BEx\ns4eAw4EOZrYMGEdogmzw96am8BARkYyS3PQkIiIJoEQhIiIZKVGIiEhGShQiIpKREoWIiGSkRCEi\nIhkpUYjUk5lNM7PWOTjP9FycRyRqShQi9WBmQ4AFOZof6GHg7BycRyRSGnAnUov0qN7z0m/bAEuA\nD4FH3f259DGjgEsJk6rNcff/MrP7ge8IawJ0JMzmOxoYCLzu7qPTP9sJeLoYR9BLcVGiEKmDmZUQ\nFkG6CbgZGOzuX5vZHoT5tQ5Kv2/r7t+Y2R+Bbdz9Z2Z2AvAXwsJS84BZwJnuPid97o+Avdx9bQz/\nNJGsqOlJpG63A9PdfRLQudr8QEOARyrfu/s31X7m6fTrXOAzd3/Pw19l7xFWYau0ks1n8hRJnMRO\nCiiSBOl1lbu5+5gaPnZqX+tiQ/q1AlhfbX8Fm//eGcW5hooUEdUoRGphZvsR+h+qrwr3iZm1T28/\nD5xY+d7M2jXgMp2oYW0RkSRRjUKkdhcQpm5/IT11+xvAK4RO6SnuPs/MrgNeNLNNwJuE1QVh81rC\nljUGBzCzHQnrNqt/QhJNndki9WBmZcBJ7n5+Ds51DtDK3X/X6MBEIqSmJ5F6cPcUYSW1XAyUO4mw\ndK1IoqlGISIiGalGISIiGSlRiIhIRkoUIiKSkRKFiIhkpEQhIiIZKVGIiEhG/x/dtbi5bQDtAwAA\nAABJRU5ErkJggg==\n", + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#calculation of (a) part\n", + "#given data\n", + "from math import log\n", + "from math import pi\n", + "from math import exp\n", + "import numpy as np\n", + "T = 298 #in kelvin\n", + "P = 1.013 #in bar\n", + "pAl = 0 #partial pressure of oxygen(A) at liquid surface\n", + "pAo = 0.21*1.013 #partial pressure of oxygen at open mouth\n", + "l = 0.05 #length of diffusion path in m\n", + "Dab = 2.1e-5 #diffusivity in m^2/s\n", + "R = 0.08317 #in m^3.bar.kmol.K\n", + "Na = Dab*P*log((P-pAl)/(P-pAo))/(R*T*l) #in kmol/m^2.s\n", + "area = (pi/4)*(0.015)**2\n", + "rate = area*Na\n", + "print '(a) Rate of diffusion of oxygen %0.3E'%rate,'kmol/s'\n", + "z = []\n", + "pa =[]\n", + "for i in np.arange(0,1,0.01):\n", + " z.append(i)\n", + " \n", + "for i in range(0,len(z)):\n", + " pa.append(P-(P-pAo)*exp((R*T*Na*z[i])/(Dab*P)))\n", + " \n", + "from matplotlib.pyplot import*\n", + "plot(z,pa);\n", + "plt.xlabel('z(cm)');\n", + "plt.ylabel('pA(atm)');\n", + "\n", + "#calculation of (b) part\n", + "z = 0.025 #diffusion path\n", + "pA = 0.113 #in bar\n", + "#we have to find partial pressure gradient of oxygen at mid way of diffusion path\n", + "#let dpA/dz = ppd\n", + "ppd = -(R*T*round(Na,8)*(P-pA))/(Dab*P)\n", + "print '(b) The partial pressure gradient of oxygen at midway in diffusion path is: %0.2f'%ppd,'bar/m'\n", + "\n", + "#calculation of (c) part\n", + "uA = Na*(R*T/pA) #velocity of oxygen\n", + "uB = 0 #since nitrogen is non-diffusing hence Nb = 0\n", + "U = pA*uA/P #since U=1/C*(uA*Ca + uB*Cb)\n", + "vAd = uA - U #diffusion velocity of oxygen\n", + "vBd = uB - U #diffusion velocity of nitrogen\n", + "print '(c)'\n", + "print 'Molar average velocity and diffusion velocities at \"midway\"'\n", + "print 'Molar average velocity in z-direction is %0.1E'%U,'m/s'\n", + "print 'The diffusion velocity of oxygen %0.1E'%vAd,'m/s'\n", + "print 'The diffusion velocity of Nitrogen %0.1E'%vBd,'m/s'\n", + "#at z=0(at top of tube)\n", + "uA = Na*(R*T/pAo)\n", + "uB = 0\n", + "U = pAo*uA/P\n", + "vAd = uA - U\n", + "vBd = uB - U\n", + "print 'Molar average velocity and diffusion velocities at \"top of tube\"'\n", + "print 'Molar average velocity in z-direction is %0.1E'%U,'m/s'\n", + "print 'The diffusion velocity of oxygen %0.2E'%vAd,'m/s'\n", + "print 'The diffusion velocity of Nitrogen %0.1E'%vBd,'m/s'\n", + "#at z=0.05(at bottom of tube)\n", + "#uA = inf\n", + "uB = 0\n", + "U = pAo*uA/P\n", + "vAd = uA - U\n", + "vBd = uB - U\n", + "print 'Molar average velocity and diffusion velocities at \"bottom of tube\"'\n", + "print 'Molar average velocity in z-direction is %0.1E'%U,'m/s'\n", + "print 'The diffusion velocity of oxygen is not infinity'\n", + "print 'The diffusion velocity of Nitrogen %0.1E'%vBd,'m/s'\n", + "\n", + "#calculation of (d) part\n", + "V = -2*U\n", + "pA = 0.113\n", + "Nad = round(Na,8) - V*(pA/(R*T))\n", + "Nbd = 0 - (P - pA)*V/(R*T)\n", + "print '(d)'\n", + "print 'New molar flux of (A) %0.2E'%Nad,'kmol/m^2.s'\n", + "print 'New molar flux of (B) %0.2E'%Nbd,'kmol/m^2.s'\n", + "#Answers may vary due to round off errors" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##Example 2.5 Page no. 21" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(a) The air-film thickness is :0.00193 m\n" + ] + } + ], + "source": [ + "from math import log\n", + "#given data\n", + "area = 3*4 #in m^2\n", + "mperarea = 3.0/12 #in kg/m^2\n", + "#part (a)\n", + "P = 1.013 #in bar\n", + "Dab = 9.95e-6 #in m^2/s\n", + "R = 0.08317 #in m^3.bar./K.kmol\n", + "T = 273+27 #in K\n", + "#let d=1\n", + "d = 1 #in m\n", + "pAo = 0.065 #partial pressure of alcohol on liquid surface\n", + "pAd = 0 #partial pressure over d length of stagnant film of air\n", + "Na = (Dab*P*log((P-pAd)/(P-pAo)))/(R*T*d) #in kmol/m^2.s\n", + "Na = Na*60 #in kg/m^2.s\n", + "flux = mperarea/(5*60) #since the liquid evaporates completely in 5 minutes\n", + "#now we have to find the value of d\n", + "d = Na/flux\n", + "print '(a) The air-film thickness is :%0.5f'%d,'m'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##Example 2.6 Page no. 24" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(a)\n", + "The steady-state flux is: 3.35E-06 kmol/m^2.s\n", + "The rate of transport of N2 from vessel 1 to 2: 6.6E-09 kmol/s\n", + "(b)\n", + "The flux and the rate of transport of oxygen is: -3.35E-06 kmol/m^2.s\n", + "(c)\n", + "Partial pressure at a point 0.05m from vessel 1 is: 1.2 atm\n", + "(d)\n", + "Net or total mass flux: -1.340E-05 kmol/m^2.s\n" + ] + } + ], + "source": [ + "from math import pi\n", + "#given data\n", + "#part (a)\n", + "Dab = 0.23e-4*0.5*(293.0/316)**1.75 #in m^2/s\n", + "pA1 = 2*0.8 #in atm\n", + "pA2 = 2*0.2 #in atm\n", + "l = 0.15 #in m\n", + "R = 0.0821 #in m^3.atm./K.kmol\n", + "T = 293 #in K\n", + "Ma = 28\n", + "Mb = 32\n", + "Na = Dab*(pA1-pA2)/(R*T*l) #in kmol/m^2.s\n", + "area = pi/4*(0.05)**2 #in m^2\n", + "rate = area*Na\n", + "print '(a)'\n", + "print 'The steady-state flux is: %0.2E'%Na,'kmol/m^2.s'\n", + "print 'The rate of transport of N2 from vessel 1 to 2: %0.1E'%rate,'kmol/s'\n", + "\n", + "#part (b)\n", + "Nb = -Na\n", + "print '(b)'\n", + "print 'The flux and the rate of transport of oxygen is: %0.2E'%Nb,'kmol/m^2.s'\n", + "\n", + "#part (c)\n", + "#let dpA/dz = ppg\n", + "dz = 0.05 #in m\n", + "ppg = (pA2 - pA1)/l #in atm/m\n", + "pA = pA1 + (ppg)*dz #in atm\n", + "print '(c)'\n", + "print 'Partial pressure at a point 0.05m from vessel 1 is: %0.1f'%pA,'atm'\n", + "\n", + "#part (d)\n", + "nt = Ma*Na + Mb*Nb\n", + "print '(d)'\n", + "print 'Net or total mass flux: %0.3E'%nt,'kmol/m^2.s'\n", + "#Answers may vary due to round off errors" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##Example 2.7 Page no. 25" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Methanol flux: 4.64e-05 kmol/m^2.s\n", + "Water flux: -4.06e-05 kmol/m^2.s\n" + ] + } + ], + "source": [ + "from math import log\n", + "#given data\n", + "Ha = 274.6*32 #molar latent heat of methanol(a)\n", + "Hb = 557.7*18 #molar latent heat of water(b)\n", + "yAl = 0.76 #mole fraction of methanol in the vapour\n", + "yAo = 0.825 #mole fraction of methanol in the vapour at the liquid-vapour interface\n", + "P = 1 #in atm\n", + "l = 1e-3 #in m\n", + "T =344.2 #in K\n", + "R = 0.0821 #m^3.atm./K.kmol\n", + "Dab = 1.816e-5 #in m^2/s\n", + "Na = Dab*P*log((1-0.1247*yAl)/(1-0.1247*yAo))/(0.1247*R*T*l)\n", + "print 'Methanol flux: %0.2e'%Na,'kmol/m^2.s'\n", + "Nb = -(Ha/Hb)*Na\n", + "print 'Water flux: %0.2e'%Nb,'kmol/m^2.s'\n", + "#Answers may vary due to round off errors" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##Example 2.8 Page no. 27" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Value of pA1 is 0.937 atm\n" + ] + } + ], + "source": [ + "#given values\n", + "from math import exp\n", + "V1 = 3000 #in cm^3\n", + "V2 = 4000 #in cm^3\n", + "Dab = 0.23 #in cm^2/s\n", + "Dba = 0.23 #in cm^2/s\n", + "l1 = 4 #in cm\n", + "d1 = 0.5 #in cm\n", + "l2 = 2 #in cm\n", + "d2 = 0.3 #in cm\n", + "pA3 = 1 #in atm\n", + "#unknowns\n", + "# pA1 and pA2\n", + "# dpA1bydt = (Dab/V1*l1)*((pA1)-(pA2))*((math.pi*(d1**2))/4)\n", + "#on integrating using Laplace trandformation\n", + "# initial conditions\n", + "t=18000 #in seconds\n", + "pA1 = 1-0.57*(exp((-1.005)*(10**(-6))*t)-exp((-7.615)*(10**(-6))*t))\n", + "print 'Value of pA1 is %0.3f'%pA1,'atm'" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "##Example 2.10 Page no.34" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Value of flux of water vapour: 2.96E-05 kmol/m^2.s\n" + ] + } + ], + "source": [ + "#given values\n", + "from math import log\n", + "y1l = 0 #mol fraction of dry air\n", + "y10 = (17.53/760) #mol fraction of water\n", + "l = 1.5 #in mm\n", + "C = 0.0409 #in kmol/m^3 : calculated by P/RT\n", + "D12 = 0.923 #Diffusivity of hydrogen over water\n", + "D13 = 0.267 #Diffusivity of oxygen over water\n", + "y2 = 0.6 #mole fraction of hydrogen\n", + "y3 = 0.4 #mole fraction of oxygen\n", + "D1m = 1/((y2/D12)+(y3/D13)) #calculating mean diffusivity\n", + "Ni = (D1m*C*1000/(l*10000))*log((1-y1l)/(1-y10))\n", + "print 'Value of flux of water vapour: %0.2E'%Ni,'kmol/m^2.s'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##Example 2.11 Page no. 35" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Flux of ethane 4.804E-05 gmol/cm^2.s\n" + ] + } + ], + "source": [ + "from math import log\n", + "#given data\n", + "y1 = 0.4 #mole fraction of ethane(1)\n", + "y2 = 0.3 #mole fraction of ethylene(2)\n", + "y3 = 0.3 #mole fraction of hydrogen(3)\n", + "#calculating D13\n", + "#The Lennard-Jones parameters are\n", + "sigma1 = 4.443 #in angstrom\n", + "sigma2 = 4.163 #in angstrom\n", + "sigma3 = 2.827 #in angstrom\n", + "e1byk = 215.7\n", + "e2byk = 224.7\n", + "e3byk = 59.7\n", + "sigma13 = (sigma1 + sigma3)/2 #in angstrom\n", + "e13byk = (e1byk*e3byk)**0.5\n", + "kTbye13 = 993/113.5\n", + "ohmD13 = 0.76 #from collision integral table\n", + "D13 = ((0.001858)*(993**1.5)*((1.0/30)+(1.0/2))**0.5)/((2)*(sigma13**2)*(ohmD13))\n", + "#calculating D23\n", + "sigma23 = (sigma2+sigma3)/2\n", + "kTbye23 = ((993/224.7)*(993/59.7))*0.5\n", + "ohmD23 = 0.762\n", + "D23 = (0.001858*(993**1.5)*((1.0/28)+(1.0/2))**0.5)/(2*(sigma23**2)*ohmD23)\n", + "D = (D13+D23)/2 #in cm^2/s\n", + "l = 0.15 #in cm\n", + "#at z=0 (bulk gas)\n", + "y10 = 0.6\n", + "y20 = 0.2\n", + "y30 = 0.2\n", + "#at z=l (catalyst surface)\n", + "y1l = 0.4\n", + "y2l = 0.3\n", + "y3l = 0.3\n", + "C = 2.0/(82.1*993) #calculated by P/RT\n", + "N1 = (D*C/l)*log((y10+y20)/(y1l+y2l))\n", + "print 'Flux of ethane %0.3E'%N1,'gmol/cm^2.s'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##Example 2.12 Page no. 43" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The liquid-film thickness is: 0.0004 m\n" + ] + } + ], + "source": [ + "#given data\n", + "from math import pi\n", + "rc = 5e-4 #in m\n", + "D = 7e-10 #in m^2/s\n", + "Cab = 1 #in kmol/m^3\n", + "Na = 3.15e-6 #in kmol/m^2.s\n", + "W = 4*pi*(rc**2)*Na #the rate of reaction\n", + "#let (rc+delta)/delta = 1\n", + "w1 = 4*pi*D*Cab*rc*1 #flux of the reactant to the surface of the catalyst\n", + "rcplusdelta = W/w1\n", + "delta = rc/(rcplusdelta-1) #stagnant liquid-film thickness \n", + "print 'The liquid-film thickness is: ',delta,'m'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##Example 2.13 Page no. 46" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Tortuosity factor is: 2.5\n" + ] + } + ], + "source": [ + "#given data\n", + "from math import log\n", + "V1 = 60.2 #in cm^3; volume of compartment 1\n", + "V2 = 59.3 #volume of compartment 2 in cm^3\n", + "Ca1i = 0.3 #initial concentration of KCl in compartment 1\n", + "Ca2i = 0 #initial concentration of KCl in compartment 2\n", + "Ca1f = 0.215 #final concentration of KCl in compartment 1\n", + "Ca2f = 0.0863 #final concentration of KCl in compartment 2\n", + "D = 1.51e-5 #diffusivity of KCl in cm^2/s\n", + "tf = 55.2*3600 #time of the experiment in s\n", + "#calcutaling cell constant\n", + "beta = (1/(D*tf))*log((Ca1i - Ca2i)/(Ca1f - Ca2f))\n", + "#diffusion of propionic acid\n", + "Cpa1i = 0.4 #initial concentration of propionic acid in compartment 1\n", + "Cpa2i = 0 #initial concentration of propionic acid in compartment 2\n", + "Cpa1f = 0.32 #final concentration of propionic acid in compartment 1\n", + "Cpa2f = 0.0812 #final concentration of propionic acid in compartment 2 by mass balance\n", + "tfp = 56.4*3600 #time for the experiment\n", + "Dp = (1/(beta*tfp))*log((Cpa1i-Cpa2i)/(Cpa1f-Cpa2f)) #diffusivity of the propionic acid\n", + "#calculating tortusity factor\n", + "A= (math.pi/4)*(3.5**2) #area of the diaphragm\n", + "epsilon = 0.39 #average porosity of the diaphragm\n", + "l = 0.18 #thickness of hte diaphragm\n", + "tou = (A*epsilon/(beta*l))*(1/V1 + 1/V2)\n", + "print 'Tortuosity factor is: ',round(tou,1)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/PrashantSahu/PrashantSahu_version_backup/Chapter-2-Molecular_Diffusion_-_Principles_of_Mass_Transfer_and_Separation_Process_by_Binay_K.ipynb b/sample_notebooks/PrashantSahu/PrashantSahu_version_backup/Chapter-2-Molecular_Diffusion_-_Principles_of_Mass_Transfer_and_Separation_Process_by_Binay_K.ipynb deleted file mode 100755 index 3f6a6b0c..00000000 --- a/sample_notebooks/PrashantSahu/PrashantSahu_version_backup/Chapter-2-Molecular_Diffusion_-_Principles_of_Mass_Transfer_and_Separation_Process_by_Binay_K.ipynb +++ /dev/null @@ -1,753 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "#Chapter 2 : Molecular Diffusion" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##Example 2.1 Page no. 10" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Molar average velocity of gas mixture is: 0.0303 m/s\n", - "Mass average velocity of gas mixture is: 0.029 m/s\n" - ] - } - ], - "source": [ - "N2 = 0.05 #mole fraction of Nitrogen denoted as 1\n", - "H2 = 0.15 #mole fraction of Hydrogen denoted as 2\n", - "NH3 = 0.76 #mole fraction of Ammonia denoted as 3\n", - "Ar = 0.04 #mole fraction of Argon denoted as 4\n", - "u1 = 0.03\n", - "u2 = 0.035\n", - "u3 = 0.03\n", - "u4 = 0.02\n", - "#Calculating molar average velocity\n", - "U = N2*u1 + H2*u2 + NH3*u3 + Ar*u4\n", - "print 'Molar average velocity of gas mixture is: %.4f m/s'%U\n", - "#Calculating of mass average velocity\n", - "M1 = 28\n", - "M2 = 2\n", - "M3 = 17\n", - "M4 = 40\n", - "M = N2*M1 + H2*M2 + NH3*M3 + Ar*M4\n", - "u = (1/M)*(N2*M1*u1 + H2*M2*u2 + NH3*M3*u3 + Ar*M4*u4)\n", - "print 'Mass average velocity of gas mixture is: %.3f m/s'%u" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - " ##Example 2.2 Page no. 16" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false, - "scrolled": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(a) Time for complete evaporation is: 15.93 hours\n", - "(b) Time for disappearance of water is: 8.87 hours\n" - ] - } - ], - "source": [ - "from math import log\n", - "from math import exp\n", - "import numpy as np\n", - "\n", - "#Calcualtion for (a) part\n", - "#calculating vapor pressure of water at 301K\n", - "pv = exp(13.8573 - (5160.2/301)) #in bar\n", - "#wet-bulb temperature is 22.5 degree centigrade\n", - "#calculating mean air-film temperature\n", - "Tm = ((28+22.5)/2)+273 #in kelvin\n", - "#calculating diffusion coefficient\n", - "Dab = ((0.853*(30.48**2))*((298.2/273)**1.75))/(3600*10000) #in m^2/s\n", - "l = 2.5e-3 #in m\n", - "P = 1.013 #in bar\n", - "R = 0.08317 #Gas constant\n", - "pAo = exp(13.8573 - (5160.2/295.2)) #vapor pressure of water at the wet-bulb temperature, 22.2C\n", - "pAl = 0.6*round(pv,4)\n", - "Na = (((round(Dab,7)*P)/(R*298.2*l))*log((P-pAl)/(P-round(pAo,3))))*18 #in kg/m^2s\n", - "#amount of water per m^2 of floor area is\n", - "thickness = 2e-3\n", - "Amount = thickness*1 #in m^3 \n", - "#density of water is 1000kg/m^3\n", - "#therefore in kg it is\n", - "amount = Amount*1000\n", - "Time_for_completion = amount/Na #in seconds\n", - "Time_for_completion_hours = Time_for_completion/3600\n", - "print '(a) Time for complete evaporation is: %.2f'%Time_for_completion_hours,'hours'\n", - "\n", - "#Calculation for (b) part\n", - "water_loss = 0.1 #in kg/m^2.h\n", - "water_loss_by_evaporation = Na*3600\n", - "total_water_loss = water_loss + water_loss_by_evaporation\n", - "time_for_disappearance = amount/total_water_loss\n", - "print '(b) Time for disappearance of water is: %0.2f'%time_for_disappearance,'hours'\n", - "#Answers may vary due to round off error" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##Example 2.3 Page no. 17" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(a) The molar flux of Ammonia is:1.922E-05 gmol/cm^2.s\n", - "(b) and (c)\n", - "Velocity of A is 0.522 cm/s\n", - "Velocity of B is 0.000 cm/s\n", - "Mass average velocity of A is 0.439 cm/s\n", - "Molar average velocity of A is 0.47 cm/s\n", - "(d) Molar flux of NH3 is 3.062E-06 gmol/cm^2.s\n" - ] - }, - { - "data": { - "image/png": "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\n", - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "%matplotlib inline\n", - "from math import log\n", - "from math import exp\n", - "import numpy as np\n", - "from matplotlib import pyplot as plt\n", - "#calculation for (a) part\n", - "l = 1 #thickness of air in cm\n", - "pAo = 0.9 #in atm\n", - "pAl = 0.1 #in atm\n", - "Dab = 0.214 #in cm^2/s\n", - "T = 298 #in K\n", - "P = 1 #in atm\n", - "R = 82.1 #in (cm^3)(atm)/(K)(gmol)\n", - "#calculating molar flux of ammonia\n", - "Na = ((Dab*P)/(R*T*l))*log((P-pAl)/(P-pAo))\n", - "print '(a) The molar flux of Ammonia is:%0.3E'%Na,'gmol/cm^2.s'\n", - "\n", - "#calculation for (b) and (c) part\n", - "Nb = 0 #air is non-diffusing\n", - "U = (Na/(P/(R*T))) #molar average velocity\n", - "yA = pAo/P\n", - "yB = pAl/P\n", - "uA = U/yA #\n", - "uB = 0 #since Nb=0\n", - "Ma = 17\n", - "Mb = 29\n", - "M = Ma*yA + Mb*yB\n", - "u = uA*yA*Ma/M #since u =(uA*phoA + uB*phoB)/pho\n", - "print '(b) and (c)'\n", - "print 'Velocity of A is %0.3f'%uA,'cm/s'\n", - "print 'Velocity of B is %0.3f'%uB,'cm/s'\n", - "print 'Mass average velocity of A is %0.3f'%u,'cm/s'\n", - "print 'Molar average velocity of A is %0.2f'%U,'cm/s'\n", - "\n", - "#calculation for (d) part\n", - "Ca = pAo/(R*T)\n", - "Ia = Ca*(uA - u) #molar flux of NH3 relative to an observer moving\n", - " #with the mass average velocity \n", - "print '(d) Molar flux of NH3 is %0.3E'%Ia,'gmol/cm^2.s'\n", - "\n", - "z = []\n", - "pa =[]\n", - "for i in np.arange(0,1,0.01):\n", - " z.append(i)\n", - " \n", - "for i in range(0,len(z)):\n", - " pa.append(1-(0.1*exp(2.197*z[i])))\n", - " \n", - "from matplotlib.pyplot import*\n", - "plot(z,pa);\n", - "plt.xlabel('z(cm)');\n", - "plt.ylabel('pA(atm)');\n", - "#Answers may vary due to round off error" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "collapsed": true - }, - "source": [ - "##Example 2.4 Page no. 19" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(a) Rate of diffusion of oxygen 7.151E-10 kmol/s\n", - "(b) The partial pressure gradient of oxygen at midway in diffusion path is: -4.25 bar/m\n", - "(c)\n", - "Molar average velocity and diffusion velocities at \"midway\"\n", - "Molar average velocity in z-direction is 9.9E-05 m/s\n", - "The diffusion velocity of oxygen 7.9E-04 m/s\n", - "The diffusion velocity of Nitrogen -9.9E-05 m/s\n", - "Molar average velocity and diffusion velocities at \"top of tube\"\n", - "Molar average velocity in z-direction is 9.9E-05 m/s\n", - "The diffusion velocity of oxygen 3.72E-04 m/s\n", - "The diffusion velocity of Nitrogen -9.9E-05 m/s\n", - "Molar average velocity and diffusion velocities at \"bottom of tube\"\n", - "Molar average velocity in z-direction is 9.9E-05 m/s\n", - "The diffusion velocity of oxygen is not infinity\n", - "The diffusion velocity of Nitrogen -9.9E-05 m/s\n", - "(d)\n", - "New molar flux of (A) 4.95E-06 kmol/m^2.s\n", - "New molar flux of (B) 7.19E-06 kmol/m^2.s\n" - ] - }, - { - "data": { - "image/png": "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\nAABJRU5ErkJggg==\n", - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#calculation of (a) part\n", - "#given data\n", - "from math import log\n", - "from math import pi\n", - "from math import exp\n", - "import numpy as np\n", - "T = 298 #in kelvin\n", - "P = 1.013 #in bar\n", - "pAl = 0 #partial pressure of oxygen(A) at liquid surface\n", - "pAo = 0.21*1.013 #partial pressure of oxygen at open mouth\n", - "l = 0.05 #length of diffusion path in m\n", - "Dab = 2.1e-5 #diffusivity in m^2/s\n", - "R = 0.08317 #in m^3.bar.kmol.K\n", - "Na = Dab*P*log((P-pAl)/(P-pAo))/(R*T*l) #in kmol/m^2.s\n", - "area = (pi/4)*(0.015)**2\n", - "rate = area*Na\n", - "print '(a) Rate of diffusion of oxygen %0.3E'%rate,'kmol/s'\n", - "z = []\n", - "pa =[]\n", - "for i in np.arange(0,1,0.01):\n", - " z.append(i)\n", - " \n", - "for i in range(0,len(z)):\n", - " pa.append(P-(P-pAo)*exp((R*T*Na*z[i])/(Dab*P)))\n", - " \n", - "from matplotlib.pyplot import*\n", - "plot(z,pa);\n", - "plt.xlabel('z(cm)');\n", - "plt.ylabel('pA(atm)');\n", - "\n", - "#calculation of (b) part\n", - "z = 0.025 #diffusion path\n", - "pA = 0.113 #in bar\n", - "#we have to find partial pressure gradient of oxygen at mid way of diffusion path\n", - "#let dpA/dz = ppd\n", - "ppd = -(R*T*round(Na,8)*(P-pA))/(Dab*P)\n", - "print '(b) The partial pressure gradient of oxygen at midway in diffusion path is: %0.2f'%ppd,'bar/m'\n", - "\n", - "#calculation of (c) part\n", - "uA = Na*(R*T/pA) #velocity of oxygen\n", - "uB = 0 #since nitrogen is non-diffusing hence Nb = 0\n", - "U = pA*uA/P #since U=1/C*(uA*Ca + uB*Cb)\n", - "vAd = uA - U #diffusion velocity of oxygen\n", - "vBd = uB - U #diffusion velocity of nitrogen\n", - "print '(c)'\n", - "print 'Molar average velocity and diffusion velocities at \"midway\"'\n", - "print 'Molar average velocity in z-direction is %0.1E'%U,'m/s'\n", - "print 'The diffusion velocity of oxygen %0.1E'%vAd,'m/s'\n", - "print 'The diffusion velocity of Nitrogen %0.1E'%vBd,'m/s'\n", - "#at z=0(at top of tube)\n", - "uA = Na*(R*T/pAo)\n", - "uB = 0\n", - "U = pAo*uA/P\n", - "vAd = uA - U\n", - "vBd = uB - U\n", - "print 'Molar average velocity and diffusion velocities at \"top of tube\"'\n", - "print 'Molar average velocity in z-direction is %0.1E'%U,'m/s'\n", - "print 'The diffusion velocity of oxygen %0.2E'%vAd,'m/s'\n", - "print 'The diffusion velocity of Nitrogen %0.1E'%vBd,'m/s'\n", - "#at z=0.05(at bottom of tube)\n", - "#uA = inf\n", - "uB = 0\n", - "U = pAo*uA/P\n", - "vAd = uA - U\n", - "vBd = uB - U\n", - "print 'Molar average velocity and diffusion velocities at \"bottom of tube\"'\n", - "print 'Molar average velocity in z-direction is %0.1E'%U,'m/s'\n", - "print 'The diffusion velocity of oxygen is not infinity'\n", - "print 'The diffusion velocity of Nitrogen %0.1E'%vBd,'m/s'\n", - "\n", - "#calculation of (d) part\n", - "V = -2*U\n", - "pA = 0.113\n", - "Nad = round(Na,8) - V*(pA/(R*T))\n", - "Nbd = 0 - (P - pA)*V/(R*T)\n", - "print '(d)'\n", - "print 'New molar flux of (A) %0.2E'%Nad,'kmol/m^2.s'\n", - "print 'New molar flux of (B) %0.2E'%Nbd,'kmol/m^2.s'\n", - "#Answers may vary due to round off errors" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##Example 2.5 Page no. 21" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(a) The air-film thickness is :0.00193 m\n" - ] - } - ], - "source": [ - "from math import log\n", - "#given data\n", - "area = 3*4 #in m^2\n", - "mperarea = 3.0/12 #in kg/m^2\n", - "#part (a)\n", - "P = 1.013 #in bar\n", - "Dab = 9.95e-6 #in m^2/s\n", - "R = 0.08317 #in m^3.bar./K.kmol\n", - "T = 273+27 #in K\n", - "#let d=1\n", - "d = 1 #in m\n", - "pAo = 0.065 #partial pressure of alcohol on liquid surface\n", - "pAd = 0 #partial pressure over d length of stagnant film of air\n", - "Na = (Dab*P*log((P-pAd)/(P-pAo)))/(R*T*d) #in kmol/m^2.s\n", - "Na = Na*60 #in kg/m^2.s\n", - "flux = mperarea/(5*60) #since the liquid evaporates completely in 5 minutes\n", - "#now we have to find the value of d\n", - "d = Na/flux\n", - "print '(a) The air-film thickness is :%0.5f'%d,'m'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##Example 2.6 Page no. 24" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(a)\n", - "The steady-state flux is: 3.35E-06 kmol/m^2.s\n", - "The rate of transport of N2 from vessel 1 to 2: 6.6E-09 kmol/s\n", - "(b)\n", - "The flux and the rate of transport of oxygen is: -3.35E-06 kmol/m^2.s\n", - "(c)\n", - "Partial pressure at a point 0.05m from vessel 1 is: 1.2 atm\n", - "(d)\n", - "Net or total mass flux: -1.340E-05 kmol/m^2.s\n" - ] - } - ], - "source": [ - "from math import pi\n", - "#given data\n", - "#part (a)\n", - "Dab = 0.23e-4*0.5*(293.0/316)**1.75 #in m^2/s\n", - "pA1 = 2*0.8 #in atm\n", - "pA2 = 2*0.2 #in atm\n", - "l = 0.15 #in m\n", - "R = 0.0821 #in m^3.atm./K.kmol\n", - "T = 293 #in K\n", - "Ma = 28\n", - "Mb = 32\n", - "Na = Dab*(pA1-pA2)/(R*T*l) #in kmol/m^2.s\n", - "area = pi/4*(0.05)**2 #in m^2\n", - "rate = area*Na\n", - "print '(a)'\n", - "print 'The steady-state flux is: %0.2E'%Na,'kmol/m^2.s'\n", - "print 'The rate of transport of N2 from vessel 1 to 2: %0.1E'%rate,'kmol/s'\n", - "\n", - "#part (b)\n", - "Nb = -Na\n", - "print '(b)'\n", - "print 'The flux and the rate of transport of oxygen is: %0.2E'%Nb,'kmol/m^2.s'\n", - "\n", - "#part (c)\n", - "#let dpA/dz = ppg\n", - "dz = 0.05 #in m\n", - "ppg = (pA2 - pA1)/l #in atm/m\n", - "pA = pA1 + (ppg)*dz #in atm\n", - "print '(c)'\n", - "print 'Partial pressure at a point 0.05m from vessel 1 is: %0.1f'%pA,'atm'\n", - "\n", - "#part (d)\n", - "nt = Ma*Na + Mb*Nb\n", - "print '(d)'\n", - "print 'Net or total mass flux: %0.3E'%nt,'kmol/m^2.s'\n", - "#Answers may vary due to round off errors" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##Example 2.7 Page no. 25" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Methanol flux: 4.64e-05 kmol/m^2.s\n", - "Water flux: -4.06e-05 kmol/m^2.s\n" - ] - } - ], - "source": [ - "from math import log\n", - "#given data\n", - "Ha = 274.6*32 #molar latent heat of methanol(a)\n", - "Hb = 557.7*18 #molar latent heat of water(b)\n", - "yAl = 0.76 #mole fraction of methanol in the vapour\n", - "yAo = 0.825 #mole fraction of methanol in the vapour at the liquid-vapour interface\n", - "P = 1 #in atm\n", - "l = 1e-3 #in m\n", - "T =344.2 #in K\n", - "R = 0.0821 #m^3.atm./K.kmol\n", - "Dab = 1.816e-5 #in m^2/s\n", - "Na = Dab*P*log((1-0.1247*yAl)/(1-0.1247*yAo))/(0.1247*R*T*l)\n", - "print 'Methanol flux: %0.2e'%Na,'kmol/m^2.s'\n", - "Nb = -(Ha/Hb)*Na\n", - "print 'Water flux: %0.2e'%Nb,'kmol/m^2.s'\n", - "#Answers may vary due to round off errors" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##Example 2.8 Page no. 27" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Value of pA1 is 0.937 atm\n" - ] - } - ], - "source": [ - "#given values\n", - "from math import exp\n", - "V1 = 3000 #in cm^3\n", - "V2 = 4000 #in cm^3\n", - "Dab = 0.23 #in cm^2/s\n", - "Dba = 0.23 #in cm^2/s\n", - "l1 = 4 #in cm\n", - "d1 = 0.5 #in cm\n", - "l2 = 2 #in cm\n", - "d2 = 0.3 #in cm\n", - "pA3 = 1 #in atm\n", - "#unknowns\n", - "# pA1 and pA2\n", - "# dpA1bydt = (Dab/V1*l1)*((pA1)-(pA2))*((math.pi*(d1**2))/4)\n", - "#on integrating using Laplace trandformation\n", - "# initial conditions\n", - "t=18000 #in seconds\n", - "pA1 = 1-0.57*(exp((-1.005)*(10**(-6))*t)-exp((-7.615)*(10**(-6))*t))\n", - "print 'Value of pA1 is %0.3f'%pA1,'atm'" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "collapsed": true - }, - "source": [ - "##Example 2.10 Page no.34" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Value of flux of water vapour: 2.96E-05 kmol/m^2.s\n" - ] - } - ], - "source": [ - "#given values\n", - "from math import log\n", - "y1l = 0 #mol fraction of dry air\n", - "y10 = (17.53/760) #mol fraction of water\n", - "l = 1.5 #in mm\n", - "C = 0.0409 #in kmol/m^3 : calculated by P/RT\n", - "D12 = 0.923 #Diffusivity of hydrogen over water\n", - "D13 = 0.267 #Diffusivity of oxygen over water\n", - "y2 = 0.6 #mole fraction of hydrogen\n", - "y3 = 0.4 #mole fraction of oxygen\n", - "D1m = 1/((y2/D12)+(y3/D13)) #calculating mean diffusivity\n", - "Ni = (D1m*C*1000/(l*10000))*log((1-y1l)/(1-y10))\n", - "print 'Value of flux of water vapour: %0.2E'%Ni,'kmol/m^2.s'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##Example 2.11 Page no. 35" - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Flux of ethane 4.804E-05 gmol/cm^2.s\n" - ] - } - ], - "source": [ - "from math import log\n", - "#given data\n", - "y1 = 0.4 #mole fraction of ethane(1)\n", - "y2 = 0.3 #mole fraction of ethylene(2)\n", - "y3 = 0.3 #mole fraction of hydrogen(3)\n", - "#calculating D13\n", - "#The Lennard-Jones parameters are\n", - "sigma1 = 4.443 #in angstrom\n", - "sigma2 = 4.163 #in angstrom\n", - "sigma3 = 2.827 #in angstrom\n", - "e1byk = 215.7\n", - "e2byk = 224.7\n", - "e3byk = 59.7\n", - "sigma13 = (sigma1 + sigma3)/2 #in angstrom\n", - "e13byk = (e1byk*e3byk)**0.5\n", - "kTbye13 = 993/113.5\n", - "ohmD13 = 0.76 #from collision integral table\n", - "D13 = ((0.001858)*(993**1.5)*((1.0/30)+(1.0/2))**0.5)/((2)*(sigma13**2)*(ohmD13))\n", - "#calculating D23\n", - "sigma23 = (sigma2+sigma3)/2\n", - "kTbye23 = ((993/224.7)*(993/59.7))*0.5\n", - "ohmD23 = 0.762\n", - "D23 = (0.001858*(993**1.5)*((1.0/28)+(1.0/2))**0.5)/(2*(sigma23**2)*ohmD23)\n", - "D = (D13+D23)/2 #in cm^2/s\n", - "l = 0.15 #in cm\n", - "#at z=0 (bulk gas)\n", - "y10 = 0.6\n", - "y20 = 0.2\n", - "y30 = 0.2\n", - "#at z=l (catalyst surface)\n", - "y1l = 0.4\n", - "y2l = 0.3\n", - "y3l = 0.3\n", - "C = 2.0/(82.1*993) #calculated by P/RT\n", - "N1 = (D*C/l)*log((y10+y20)/(y1l+y2l))\n", - "print 'Flux of ethane %0.3E'%N1,'gmol/cm^2.s'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##Example 2.12 Page no. 43" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The liquid-film thickness is: 0.0004 m\n" - ] - } - ], - "source": [ - "#given data\n", - "from math import pi\n", - "rc = 5e-4 #in m\n", - "D = 7e-10 #in m^2/s\n", - "Cab = 1 #in kmol/m^3\n", - "Na = 3.15e-6 #in kmol/m^2.s\n", - "W = 4*pi*(rc**2)*Na #the rate of reaction\n", - "#let (rc+delta)/delta = 1\n", - "w1 = 4*pi*D*Cab*rc*1 #flux of the reactant to the surface of the catalyst\n", - "rcplusdelta = W/w1\n", - "delta = rc/(rcplusdelta-1) #stagnant liquid-film thickness \n", - "print 'The liquid-film thickness is: ',delta,'m'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##Example 2.13 Page no. 46" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Tortuosity factor is: 2.5\n" - ] - } - ], - "source": [ - "#given data\n", - "from math import log\n", - "V1 = 60.2 #in cm^3; volume of compartment 1\n", - "V2 = 59.3 #volume of compartment 2 in cm^3\n", - "Ca1i = 0.3 #initial concentration of KCl in compartment 1\n", - "Ca2i = 0 #initial concentration of KCl in compartment 2\n", - "Ca1f = 0.215 #final concentration of KCl in compartment 1\n", - "Ca2f = 0.0863 #final concentration of KCl in compartment 2\n", - "D = 1.51e-5 #diffusivity of KCl in cm^2/s\n", - "tf = 55.2*3600 #time of the experiment in s\n", - "#calcutaling cell constant\n", - "beta = (1/(D*tf))*log((Ca1i - Ca2i)/(Ca1f - Ca2f))\n", - "#diffusion of propionic acid\n", - "Cpa1i = 0.4 #initial concentration of propionic acid in compartment 1\n", - "Cpa2i = 0 #initial concentration of propionic acid in compartment 2\n", - "Cpa1f = 0.32 #final concentration of propionic acid in compartment 1\n", - "Cpa2f = 0.0812 #final concentration of propionic acid in compartment 2 by mass balance\n", - "tfp = 56.4*3600 #time for the experiment\n", - "Dp = (1/(beta*tfp))*log((Cpa1i-Cpa2i)/(Cpa1f-Cpa2f)) #diffusivity of the propionic acid\n", - "#calculating tortusity factor\n", - "A= (math.pi/4)*(3.5**2) #area of the diaphragm\n", - "epsilon = 0.39 #average porosity of the diaphragm\n", - "l = 0.18 #thickness of hte diaphragm\n", - "tou = (A*epsilon/(beta*l))*(1/V1 + 1/V2)\n", - "print 'Tortuosity factor is: ',round(tou,1)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/RahulJoshi/Chapter_1_An_Overview_of.ipynb b/sample_notebooks/RahulJoshi/Chapter_1_An_Overview_of.ipynb new file mode 100644 index 00000000..0cef27c9 --- /dev/null +++ b/sample_notebooks/RahulJoshi/Chapter_1_An_Overview_of.ipynb @@ -0,0 +1,1396 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "# Example 1.1 Page Number 2" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Heat Flow through the surface is 17850.0 W\n", + "Temprature Gradient in flow direction -700.0 C/m\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "#variable declaration\n", + "\n", + "T = 100 # temperature of wall 1 in deg celcius\n", + "\n", + "t = 30 # temperature of wall 2 in deg celcius\n", + "\n", + "L = 0.1 # distance between the walls in meters\n", + "\n", + "k = 8.5 # thermal conductivity in W/mK\n", + "\n", + "A = 3 # area is meters square\n", + "\n", + "#calculation\n", + "\n", + "Q = (T-t)/(L/(k*A)) # heat flow rate in (W)\n", + "\n", + "tempgrad = (-1*Q)/(k*A) # temperature gradient in celcius/meter\n", + "\n", + "# Result\n", + "\n", + "print(\"Heat Flow through the surface is\",Q,\"W\")\n", + "\n", + "print(\"Temprature Gradient in flow direction\",tempgrad,\"C/m\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example 1.2 Page Number 6" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Convective heat transfer rate 1500.0 W\n", + "Resistance 0.08 C/W\n", + "Temprature Gradient along y direction -3000.0 C/m\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "#variable declaration\n", + "\n", + "T = 160 # temperature of wall 1 in deg celcius\n", + "\n", + "t = 40 # temperature of wall 2 in deg celcius\n", + "\n", + "k = 1 # thermal conductivity in W/mK\n", + "\n", + "h = 25 # Convective heat transfer coefficient W/m2K\n", + "\n", + "A = 0.5 # area is meters square\n", + "\n", + "#calculation\n", + "\n", + "Q = h*A*(T-t) # heat tranfer by convection (W)\n", + "\n", + "r = 1/(h*A) # resistance (C/W)\n", + "\n", + "tempgrad = (-1*Q)/(k*A) # temperature gradient in celcius/meter along y\n", + "\n", + "# Result\n", + "\n", + "print(\"Convective heat transfer rate \",Q,\"W\")\n", + "\n", + "print(\"Resistance\",r,\"C/W\")\n", + "\n", + "print(\"Temprature Gradient along y direction\",tempgrad,\"C/m\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example 1.3 Page number 7" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Heat Flow through the surface is 2171.37 W\n", + "Resistance 0.0783 K/W\n", + "Equivalent thermal coefficient 6.3864 W/m2K\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "#variable declaration\n", + "\n", + "T = 473 # temperature of wall 1 kelvin\n", + "\n", + "t = 303 # temperature of wall 2 in kelvin\n", + "\n", + "sigma = 5.67*10**-8 # Stefen-Boltzmann constant\n", + "\n", + "F = 0.46 # emmissivity \n", + "\n", + "A = 2 # area is meters sq\n", + "\n", + "#calculation\n", + "\n", + "Q = F*sigma*A*(T**4-t**4) # heat exchange in (W)\n", + "\n", + "R = (T-t)/Q # Resistance in (K/W)\n", + "\n", + "hr = 1/(R*A) # equivalent thermal coefficient W/m2K\n", + "\n", + "# Result\n", + "\n", + "print(\"Heat Flow through the surface is\",round(Q,2),\"W\")\n", + "\n", + "print(\"Resistance\",round(R,4),\"K/W\")\n", + "\n", + "print(\"Equivalent thermal coefficient\",round(hr,4),\"W/m2K\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example 1.4 Page number 8" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Heat Received 7092.23 W\n", + "T2 = 368.479 K\n", + "Temprature on other side of the wall 263.3 K\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "#variable declaration\n", + "\n", + "Tinf1 = 500 # temperature of wall 1 Kelvin\n", + "\n", + "T1 = 400 # temperature of wall 2 in Kelvin\n", + "\n", + "sigma = 5.67 # Stefen-Boltzmann constant\n", + "\n", + "h = 50 # Convective heat transfer coefficient W/m2K\n", + "\n", + "k = 45 # thermal conductivity in W/mK\n", + "\n", + "L = 0.2 # slab thickness in meters\n", + "\n", + "#calculation\n", + "\n", + "Q = sigma*((Tinf1/100)**4 - (T1/100)**4)+ h*(Tinf1-T1) # heat received (W)\n", + "\n", + "dT = Q*(L/k) # temp gradient (K)\n", + "\n", + "T2 = T1-dT #\n", + "\n", + "Tinf2 = 263.3 # temperature on the other side of the wall using trial and error\n", + "\n", + "# Result\n", + "\n", + "print(\"Heat Received \",round(Q,3),\"W\")\n", + "\n", + "print(\"T2 = \",round(T2,3),\"K\")\n", + "\n", + "print(\"Temprature on other side of the wall\",round(Tinf2,3),\"K\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example 1.5 Page number " + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Rate of change of temperature 0.03984 C/s\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "#variable declaration\n", + "\n", + "T1 = 400 # temperature of wall 1 Kelvin\n", + "\n", + "T2 = 100 # temperature of wall 2 in Kelvin\n", + "\n", + "sigma = 5.67*10**-8 # Stefen-Boltzmann constant\n", + "\n", + "h = 200 # Convective heat transfer coefficient W/m2K\n", + "\n", + "q = 1.5*10**6 # heat generated in W/m3\n", + "\n", + "H = 0.3 # height in meters\n", + "\n", + "r = 0.15 # radius in meters\n", + "\n", + "rho = 19000 # density in kg/m3\n", + "\n", + "cp = 118 # specific heat capacity in kJ/kgK\n", + "\n", + "#calculation\n", + "\n", + "Sa = 2*3.14*r*H+2*3.14*r**2 # Surface area in meters sq\n", + "\n", + "Hc = 3.14*r**2*H*rho*cp # heat capacity in J/deg C\n", + "\n", + "Hg = 3.14*r**2*H*q # Heat generated in W\n", + "\n", + "Hcon = h*Sa*(T1-T2) # convective heat transfer in W\n", + "\n", + "Hrad = sigma*Sa*((T1+273)**4 - (T2+273)**4)\n", + "\n", + "Th = Hg-Hcon-Hrad\n", + "\n", + "dTbydt = Th/Hc\n", + "\n", + "# Result\n", + "\n", + "print(\"Rate of change of temperature \",round(dTbydt,5),\"C/s\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example 1.6 Page number 11" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "BTU/hrftF = 1.7322 W/mC\n", + "BTU/hrft2F = 5.6831 W/m2C\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "J = 9.47*10**-4 # Joule to BTU conversion\n", + "\n", + "m = 39.37 # meter to inch conversion\n", + "\n", + "kg = 2.2046 # kg to lb conversion\n", + "\n", + "C = 9/5 # Celcius to Farhenight\n", + "\n", + "# Calculation\n", + "\n", + "BTU = 1/J # in Joule\n", + "\n", + "ft = 12/m # in feet\n", + "\n", + "a = (BTU/(3600*ft*(5/9))) # in BTU/hrftF\n", + "\n", + "print(\"BTU/hrftF = \",round(a,4),\"W/mC\")\n", + "\n", + "b = (BTU/(3600*ft**2*(5/9))) # in BTU/hrftF\n", + "\n", + "print(\"BTU/hrft2F = \",round(b,4),\"W/m2C\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem 1 page Number 11" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Temprature gradient along surface -1111.7 C/m\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "#variable declaration\n", + "\n", + "T1 = 200 # temperature of wall 1 Kelvin\n", + "\n", + "T2 = 60 # temperature of wall 2 in Kelvin\n", + "\n", + "sigma = 5.67 # Stefen-Boltzmann constant\n", + "\n", + "h = 80 # Convective heat transfer coefficient W/m2K\n", + "\n", + "k = 12 # thermal conductivity in W/mK\n", + "\n", + "#L = 0.2 # slab thickness in meters\n", + "\n", + "#calculation\n", + "\n", + "Q = sigma*(((T1+273)/100)**4 - ((T2+273)/100)**4)+ h*(T1-T2) # heat received (W)\n", + "\n", + "dTbydx = Q/(-1*k) # temp gradient (K)\n", + "\n", + "print(\"Temprature gradient along surface\",round(dTbydx,1),\"C/m\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem 2 Page number 12" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Temprature only conduction and convection 682.174 C\n", + "Temprature only conduction and radiation 1139.148 C\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "#variable declaration\n", + "\n", + "dTbydx = -9000 # temperature gradient \n", + "\n", + "T2 = 30 # temperature of wall 2 in C\n", + "\n", + "sigma = 5.67 # Stefen-Boltzmann constant\n", + "\n", + "k = -25 # Convective heat transfer coefficient W/mK\n", + "\n", + "h = 345 # thermal conductivity in W/m2K\n", + "\n", + "A = 1 # area in meters sq\n", + "\n", + "#calculation\n", + "\n", + "#only conduction and convection\n", + "\n", + "T11 = k*A*dTbydx/(h*A) + T2\n", + "\n", + "#only conduction and radiation\n", + "\n", + "T12 = (((k*A*dTbydx/(sigma)) + ((T2+273)/100)**4)*100**4)**(1/4)-273\n", + "\n", + "# Result\n", + "\n", + "print(\"Temprature only conduction and convection \",round(T11,3),\"C\")\n", + "\n", + "print(\"Temprature only conduction and radiation \",round(T12,3),\"C\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem number 3 Page number 12" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Wall surface temperature 330.4 K\n", + "Heat Generated 2252.765 W/m2\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "#variable declaration\n", + "\n", + "Qc = 2250 # heat conducted in W/m2\n", + "\n", + "T1 = 303 # temperature of wall 2 in C\n", + "\n", + "sigma = 5.67 # Stefen-Boltzmann constant\n", + "\n", + "h = 75 # thermal conductivity in W/m2K\n", + "\n", + "A = 1 # area in meters sq\n", + "\n", + "#calculation\n", + "\n", + "# taking the approximate value from table 330.4\n", + "\n", + "Tapprox = 330.4\n", + "\n", + "Q = h*(Tapprox-T1)+sigma*((Tapprox/100)**4-(T1/100)**4)\n", + "\n", + "# Result\n", + "\n", + "print(\"Wall surface temperature \",round(Tapprox,3),\"K\")\n", + "\n", + "print(\"Heat Generated \",round(Q,3),\"W/m2\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem 4 page number 13" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Wall surface temperature 277.75 K\n", + "Heat Generated 65.479 W\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "#variable declaration\n", + "\n", + "Hc = 65.5 # heat conducted in W/m\n", + "\n", + "T1 = 263 # temperature of wall in K\n", + "\n", + "sigma = 5.67 # Stefen-Boltzmann constant\n", + "\n", + "h = 4.35 # thermal conductivity in W/m2K\n", + "\n", + "r = 0.08 # area in meters \n", + "\n", + "#calculation\n", + "\n", + "# taking the approximate value from table 277.75 K\n", + "\n", + "Tapprox = 277.75\n", + "\n", + "Q = h*3.14*r*2*(Tapprox-T1)+sigma*2*3.14*r*((Tapprox/100)**4-(T1/100)**4)\n", + "\n", + "# Result\n", + "\n", + "print(\"Wall surface temperature \",round(Tapprox,3),\"K\")\n", + "\n", + "print(\"Heat Generated \",round(Q,3),\"W\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem 5 Page number 14" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Wall surface temperature 386.1 K\n", + "Heat Generated 449.65 W\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "#variable declaration\n", + "\n", + "Hc = 450 # heat conducted in W/m\n", + "\n", + "T1 = 396.4 # temperature of wall in K\n", + "\n", + "sigma = 5.67 # Stefen-Boltzmann constant\n", + "\n", + "h = 1.5 # thermal conductivity in W/m2K\n", + "\n", + "r = 0.08 # area in meters \n", + "\n", + "A = 4*3.14*0.48**2 # area in meters sq\n", + "\n", + "#calculation\n", + "\n", + "# taking the approximate value from table 386.1 K\n", + "\n", + "Tapprox = 386.1\n", + "\n", + "Q = h*A*(T1-Tapprox)+sigma*A*((T1/100)**4-(Tapprox/100)**4)\n", + "\n", + "# Result\n", + "\n", + "print(\"Wall surface temperature \",round(Tapprox,3),\"K\")\n", + "\n", + "print(\"Heat Generated \",round(Q,3),\"W\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem 6 Page number 14" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Heat Capacity 1000.0 J/C\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "#variable declaration\n", + "\n", + "dTbydt = 0.5 # Temperature transition in C/s\n", + "\n", + "Qr = 4000 # Heat Received in J/s\n", + "\n", + "Qc = 5200 # Heat Convection in J/s\n", + "\n", + "qdot = 1700 # Heat generated in J/s\n", + "\n", + "#calculation\n", + "\n", + "HeatCapacity = (Qr-Qc+qdot)/dTbydt\n", + "\n", + "# Result\n", + "\n", + "print(\"Heat Capacity \",round(HeatCapacity,3),\"J/C\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem 7 page number 15" + ] + }, + { + "cell_type": "code", + "execution_count": 54, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Time rate of temperature change 0.1 C/s\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "#variable declaration\n", + "\n", + "Q = 240 # Heat Received in J/s\n", + "\n", + "qdot = 100000 # Heat generated in J/m3/s\n", + "\n", + "rho = 2500 # density in kg/m3\n", + "\n", + "cp = 0.52*10**3 # heat capacity in kJ/KgK\n", + "\n", + "a = 0.2 # side of the cube in meters\n", + "\n", + "#calculation\n", + "\n", + "V = a**3\n", + "\n", + "dTbydt = (Q+qdot*V)/(rho*V*cp)\n", + "\n", + "# Result\n", + "\n", + "print(\"Time rate of temperature change \",round(dTbydt,3),\"C/s\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem 8 Page Number 15 " + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Heat Convected 1309.5 W/m2\n", + "Heat Received 1303.428 W/m2\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "#variable declaration\n", + "\n", + "T1 = 160 # heat conducted in W/m\n", + "\n", + "T2 = 30 # temperature of wall in K\n", + "\n", + "sigma = 5.67 # Stefen-Boltzmann constant\n", + "\n", + "h = 45 # thermal conductivity in W/m2K\n", + "\n", + "A = 1 # area in meters sq\n", + "\n", + "#calculation\n", + "\n", + "# taking the approximate value from table 332 K\n", + "\n", + "Tapprox = 332.1 \n", + "\n", + "Hc = h*A*(Tapprox-(273+T2)) # Heat Convected in W/m2\n", + "\n", + "Hr = sigma*A*(((T1+273)/100)**4-(Tapprox/100)**4) # Heat received in W/m2\n", + "\n", + "# Result\n", + "\n", + "print(\"Heat Convected \",round(Hc,3),\"W/m2\")\n", + "\n", + "print(\"Heat Received \",round(Hr,3),\"W/m2\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem 9 Page number 16" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total Heat loss case 1 150.6 W\n", + "Total Heat loss case 2 81.9 W\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "#variable declaration\n", + "\n", + "T1 = 37 # temperature of body in C\n", + "\n", + "T21 = 26 # temperature of air in C\n", + "\n", + "T22 = 5 # temperature of walls in room in C\n", + "\n", + "sigma = 5.67 # Stefen-Boltzmann constant\n", + "\n", + "h = 6 # Convective heat transfer coefficient W/m2K\n", + "\n", + "A = 0.6 # area in meters sq\n", + "\n", + "#calculation\n", + "\n", + "Hc = h*A*(T1-T21) # Heat Convected in W/m2\n", + "\n", + "Hr1 = sigma*A*(((T1+273)/100)**4-((T22+273)/100)**4) # Heat received in W/m2\n", + "\n", + "Ht1 = Hr1+Hc\n", + "\n", + "# calculate when temperature is 26C\n", + "\n", + "Hr2 = sigma*A*(((T1+273)/100)**4 - ((T21+273)/100)**4) # Heat received in W/m2\n", + "\n", + "Ht2 = Hc+Hr2\n", + "\n", + "print(\"Total Heat loss case 1\",round(Ht1,1),\"W\")\n", + "\n", + "print(\"Total Heat loss case 2\",round(Ht2,1),\"W\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem 10 Page number 16" + ] + }, + { + "cell_type": "code", + "execution_count": 63, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Net heat Gain 291.1 W\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "#variable declaration\n", + "\n", + "T1 = 37 # temperature of body in C\n", + "\n", + "T21 = 650 # temperature of air in C\n", + "\n", + "T22 = 5 # temperature of walls in room in C\n", + "\n", + "sigma = 5.67 # Stefen-Boltzmann constant\n", + "\n", + "h = 6 # Convective heat transfer coefficient W/m2K\n", + "\n", + "A = 0.6 # area in meters sq\n", + "\n", + "F = 0.01 # fraction of radiation \n", + "\n", + "#calculation\n", + "\n", + "# Heat loss by convection in W\n", + "\n", + "Hc = h*A*(T1-T22)\n", + "\n", + "# Heat Gain by radiation\n", + "\n", + "Hr = sigma*F*(((T21+273)/100)**4 - ((T1+273)/100)**4) # Heat received in W/m2\n", + "\n", + "Hnet = Hr-Hc\n", + "\n", + "print(\"Net heat Gain\",round(Hnet,1),\"W\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem 11 Page number 16" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Equilibrium Temperature = 960.01 K\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "# Variable Declaration\n", + "\n", + "Q = 1500 # heat dissipation in W\n", + "\n", + "sigma = 5.67 # stefan-Boltzmann constant\n", + "\n", + "T2 = 288 # temperature in K\n", + "\n", + "r = 0.04 # radius in meters\n", + "\n", + "H = 0.25 # height in meters\n", + "\n", + "T1 = ((Q/(sigma*3.14*r*H)+(288/100)**4)*100**4)**(1/4)\n", + "\n", + "print(\"Equilibrium Temperature = \",round(T1,2),\"K\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem number 12 Page number 17" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Equilibrium Temperature = 62.0 C\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "# Variable declaration\n", + "\n", + "Hr = 800 # Heat Rate in W/m2\n", + "\n", + "h1 = 10 # convective heat transfer rate on back of plate in W/m2K\n", + "\n", + "h2 = 15 # convective heat transfer rate on front of plate in W/m2K\n", + "\n", + "T2 = 30 # temperature on both sides of the plate\n", + "\n", + "T = (Hr+h1*30+h2*30)/25\n", + "\n", + "print(\"Equilibrium Temperature = \",round(T,2),\"C\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem number 13 Page number 17" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "temperature of the plate 784.57 K\n", + "heat transfer with sheet 19668.31 W\n", + "heat transfer without sheet 39336.61 W\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "# Variable Declaration\n", + "\n", + "T1 = 650 # temperature from one side of the source in C\n", + "\n", + "T2 = 150 # temperature on other side of the surface in C\n", + "\n", + "sigma = 5.67 # stefan-boltzmann constant\n", + "\n", + "T = (((((T1+273)/100)**4 + ((T2+273)/100)**4)/2)*100**4)**(1/4)\n", + "\n", + "print(\"temperature of the plate\",round(T,2),\"K\")\n", + "\n", + "Q1 = sigma*(((T1+273)/100)**4 - (T/100)**4)\n", + "\n", + "print(\"heat transfer with sheet\",round(Q1,2),\"W\")\n", + "\n", + "Q2 = sigma*(((T1+273)/100)**4 - ((T2+273)/100)**4)\n", + "\n", + "print(\"heat transfer without sheet\",round(Q2,2),\"W\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem 14 Page number 18" + ] + }, + { + "cell_type": "code", + "execution_count": 83, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "COnvective heat trasnfer rate 375.0 W/m2K\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "# Variable Declaration\n", + "\n", + "Tair = 120 # temperature of air in C\n", + "\n", + "T1 = 42 # temperature of plate 1 in C\n", + "\n", + "T2 = 30 # temperature of plate 2 in C\n", + "\n", + "L = 0.01 # length of the slab in meters\n", + "\n", + "A = 1 # area in meters sq\n", + "\n", + "k = 22.5 # thermal conductivity in W/mK\n", + "\n", + "# Calculation\n", + "\n", + "Q = (T1-T2)/(L/(k*A))\n", + "\n", + "Tnew = T1+6\n", + "\n", + "h = Q/(A*(Tair-Tnew))\n", + "\n", + "print(\"COnvective heat trasnfer rate\",round(h,2),\"W/m2K\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem 15 Page number 19" + ] + }, + { + "cell_type": "code", + "execution_count": 87, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Efficiency of the collector when temperature is 32 deg C 47.5 %\n", + "Efficiency of the collector when temperature is 45 deg C 75.62 %\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "# Variable declaration\n", + "\n", + "T1 = 60 # temperature of the tube in C\n", + "\n", + "T2 = 32 # temperature of air in C\n", + "\n", + "h = 15 # convective heat transfer in W/m2K\n", + "\n", + "A = 1 # area in meters sq\n", + "\n", + "Qf = 800 # heat flux in W/m2\n", + "\n", + "Tnew = 45 # new temperature in C\n", + "\n", + "# Calculation\n", + "\n", + "Q = h*A*(T1-T2) # heat transfer in W\n", + "\n", + "eff = ((Qf-Q)/Qf)*100\n", + "\n", + "print(\"Efficiency of the collector when temperature is 32 deg C\",round(eff,2),\"%\")\n", + "\n", + "# Heat lost by convection when T = 45 C\n", + "\n", + "Q2 = h*A*(Tnew-T2) # heat transfer in W\n", + "\n", + "eff1 = ((Qf-Q2)/Qf)*100 \n", + "\n", + "print(\"Efficiency of the collector when temperature is 45 deg C\",round(eff1,2),\"%\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem 16 Page Number 19" + ] + }, + { + "cell_type": "code", + "execution_count": 88, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Temperature of the air 428.89 C\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "# Variable declaration\n", + "\n", + "Tg = 40 # temperature of the glass plate in C\n", + "\n", + "dT = 5 # temperature graditent in C\n", + "\n", + "L = 0.001 # length in meters\n", + "\n", + "k = 1.4 # conductive heat transfer coefficient in W/mK\n", + "\n", + "A = 1 # area in meters sq\n", + "\n", + "h = 18 # convective heat trasnfer coefficient in W/m2K\n", + "\n", + "# Calculation\n", + "\n", + "Q = dT/(L/(k*A))\n", + "\n", + "Tair = (Q/h)+ Tg\n", + "\n", + "print(\"Temperature of the air\",round(Tair,2),\"C\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem 17 Page number 20" + ] + }, + { + "cell_type": "code", + "execution_count": 89, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Temperature gradient in the solid -631.58 C/m\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "# Variable Declaration\n", + "\n", + "h = 30 # Convective heat transfer coefficient in W/m2K\n", + "\n", + "k = 9.5 # conductive heat trasnfer coefficient in W/mK\n", + "\n", + "T1 = 260 # temperature of the surface in C\n", + "\n", + "T2 = 60 # temperature of the air in C\n", + "\n", + "tempgrad = (h/k)*(T2-T1)\n", + "\n", + "print(\"Temperature gradient in the solid\",round(tempgrad,2),\"C/m\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem 18 Page number 20" + ] + }, + { + "cell_type": "code", + "execution_count": 90, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Steady state temperature of plate 313.33 K\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "# Variable Declaration\n", + "\n", + "A = 1 # area in meters sq\n", + "\n", + "h1 = 100 # convective heat transfer coeffcient in W/m2K\n", + "\n", + "h2 = 15 # convective heat transfer coeffcient in W/m2K\n", + "\n", + "# solving by trial and error we get T1 = 313.33 K\n", + "\n", + "T1 = 313.33 \n", + "\n", + "print(\"Steady state temperature of plate\",round(T1,2),\"K\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem 19 Page number 21" + ] + }, + { + "cell_type": "code", + "execution_count": 91, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Surface temperature 674.39 K\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "# Variable Declaration\n", + "\n", + "k = -22.5 # conductive heat trasnfer coefficient in W/mK\n", + "\n", + "tempgrad = -500 # temperature gradient in C/m\n", + "\n", + "sigma = 5.67 # stefan-boltzmann constant\n", + "\n", + "Ts = 303 # temperatre of surroundings in K\n", + "\n", + "# Calculation\n", + "\n", + "T2 = ((((k*tempgrad)/sigma)+(Ts/100)**4)*100**4)**(1/4)\n", + "\n", + "print(\"Surface temperature\",round(T2,2),\"K\")\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem 20 Page number 21" + ] + }, + { + "cell_type": "code", + "execution_count": 92, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Surface temperatrue 230.2 K\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "# variable declaration \n", + "\n", + "Hc = 2000 # heat generated in W\n", + "\n", + "r = 1 # radius in meters\n", + "\n", + "sigma = 5.67 # stefan boltzmann constant\n", + "\n", + "T2 = 0 # temperate of space in K\n", + "\n", + "# Calculation \n", + "\n", + "T = ((Hc/(4*3.14*r**2*sigma))*100**4)**(1/4)\n", + "\n", + "print(\"Surface temperatrue\",round(T,2),\"K\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Problem 21 page Number 22" + ] + }, + { + "cell_type": "code", + "execution_count": 93, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Temperature drop through the wall 1.33 C\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "# Variable Declaration\n", + "\n", + "Q = 10 # heat flux in W/m2\n", + "\n", + "A = 1 # area in meters sq\n", + "\n", + "k = 1.5 # thermal cnductivity in W/mK\n", + "\n", + "t = 0.2 # wall thockness in m\n", + "\n", + "# Calculation\n", + "\n", + "dT = (Q*t)/(k*A)\n", + "\n", + "print(\"Temperature drop through the wall\",round(dT,2),\"C\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "anaconda-cloud": {}, + "kernelspec": { + "display_name": "Python [default]", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.5.2" + } + }, + "nbformat": 4, + "nbformat_minor": 1 +} diff --git a/sample_notebooks/RahulJoshi/Chapter_1_An_Overview_of_Heat.ipynb b/sample_notebooks/RahulJoshi/Chapter_1_An_Overview_of_Heat.ipynb deleted file mode 100644 index 0cef27c9..00000000 --- a/sample_notebooks/RahulJoshi/Chapter_1_An_Overview_of_Heat.ipynb +++ /dev/null @@ -1,1396 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": { - "collapsed": true - }, - "source": [ - "# Example 1.1 Page Number 2" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Heat Flow through the surface is 17850.0 W\n", - "Temprature Gradient in flow direction -700.0 C/m\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "#variable declaration\n", - "\n", - "T = 100 # temperature of wall 1 in deg celcius\n", - "\n", - "t = 30 # temperature of wall 2 in deg celcius\n", - "\n", - "L = 0.1 # distance between the walls in meters\n", - "\n", - "k = 8.5 # thermal conductivity in W/mK\n", - "\n", - "A = 3 # area is meters square\n", - "\n", - "#calculation\n", - "\n", - "Q = (T-t)/(L/(k*A)) # heat flow rate in (W)\n", - "\n", - "tempgrad = (-1*Q)/(k*A) # temperature gradient in celcius/meter\n", - "\n", - "# Result\n", - "\n", - "print(\"Heat Flow through the surface is\",Q,\"W\")\n", - "\n", - "print(\"Temprature Gradient in flow direction\",tempgrad,\"C/m\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Example 1.2 Page Number 6" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Convective heat transfer rate 1500.0 W\n", - "Resistance 0.08 C/W\n", - "Temprature Gradient along y direction -3000.0 C/m\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "#variable declaration\n", - "\n", - "T = 160 # temperature of wall 1 in deg celcius\n", - "\n", - "t = 40 # temperature of wall 2 in deg celcius\n", - "\n", - "k = 1 # thermal conductivity in W/mK\n", - "\n", - "h = 25 # Convective heat transfer coefficient W/m2K\n", - "\n", - "A = 0.5 # area is meters square\n", - "\n", - "#calculation\n", - "\n", - "Q = h*A*(T-t) # heat tranfer by convection (W)\n", - "\n", - "r = 1/(h*A) # resistance (C/W)\n", - "\n", - "tempgrad = (-1*Q)/(k*A) # temperature gradient in celcius/meter along y\n", - "\n", - "# Result\n", - "\n", - "print(\"Convective heat transfer rate \",Q,\"W\")\n", - "\n", - "print(\"Resistance\",r,\"C/W\")\n", - "\n", - "print(\"Temprature Gradient along y direction\",tempgrad,\"C/m\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Example 1.3 Page number 7" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Heat Flow through the surface is 2171.37 W\n", - "Resistance 0.0783 K/W\n", - "Equivalent thermal coefficient 6.3864 W/m2K\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "#variable declaration\n", - "\n", - "T = 473 # temperature of wall 1 kelvin\n", - "\n", - "t = 303 # temperature of wall 2 in kelvin\n", - "\n", - "sigma = 5.67*10**-8 # Stefen-Boltzmann constant\n", - "\n", - "F = 0.46 # emmissivity \n", - "\n", - "A = 2 # area is meters sq\n", - "\n", - "#calculation\n", - "\n", - "Q = F*sigma*A*(T**4-t**4) # heat exchange in (W)\n", - "\n", - "R = (T-t)/Q # Resistance in (K/W)\n", - "\n", - "hr = 1/(R*A) # equivalent thermal coefficient W/m2K\n", - "\n", - "# Result\n", - "\n", - "print(\"Heat Flow through the surface is\",round(Q,2),\"W\")\n", - "\n", - "print(\"Resistance\",round(R,4),\"K/W\")\n", - "\n", - "print(\"Equivalent thermal coefficient\",round(hr,4),\"W/m2K\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Example 1.4 Page number 8" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Heat Received 7092.23 W\n", - "T2 = 368.479 K\n", - "Temprature on other side of the wall 263.3 K\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "#variable declaration\n", - "\n", - "Tinf1 = 500 # temperature of wall 1 Kelvin\n", - "\n", - "T1 = 400 # temperature of wall 2 in Kelvin\n", - "\n", - "sigma = 5.67 # Stefen-Boltzmann constant\n", - "\n", - "h = 50 # Convective heat transfer coefficient W/m2K\n", - "\n", - "k = 45 # thermal conductivity in W/mK\n", - "\n", - "L = 0.2 # slab thickness in meters\n", - "\n", - "#calculation\n", - "\n", - "Q = sigma*((Tinf1/100)**4 - (T1/100)**4)+ h*(Tinf1-T1) # heat received (W)\n", - "\n", - "dT = Q*(L/k) # temp gradient (K)\n", - "\n", - "T2 = T1-dT #\n", - "\n", - "Tinf2 = 263.3 # temperature on the other side of the wall using trial and error\n", - "\n", - "# Result\n", - "\n", - "print(\"Heat Received \",round(Q,3),\"W\")\n", - "\n", - "print(\"T2 = \",round(T2,3),\"K\")\n", - "\n", - "print(\"Temprature on other side of the wall\",round(Tinf2,3),\"K\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Example 1.5 Page number " - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Rate of change of temperature 0.03984 C/s\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "#variable declaration\n", - "\n", - "T1 = 400 # temperature of wall 1 Kelvin\n", - "\n", - "T2 = 100 # temperature of wall 2 in Kelvin\n", - "\n", - "sigma = 5.67*10**-8 # Stefen-Boltzmann constant\n", - "\n", - "h = 200 # Convective heat transfer coefficient W/m2K\n", - "\n", - "q = 1.5*10**6 # heat generated in W/m3\n", - "\n", - "H = 0.3 # height in meters\n", - "\n", - "r = 0.15 # radius in meters\n", - "\n", - "rho = 19000 # density in kg/m3\n", - "\n", - "cp = 118 # specific heat capacity in kJ/kgK\n", - "\n", - "#calculation\n", - "\n", - "Sa = 2*3.14*r*H+2*3.14*r**2 # Surface area in meters sq\n", - "\n", - "Hc = 3.14*r**2*H*rho*cp # heat capacity in J/deg C\n", - "\n", - "Hg = 3.14*r**2*H*q # Heat generated in W\n", - "\n", - "Hcon = h*Sa*(T1-T2) # convective heat transfer in W\n", - "\n", - "Hrad = sigma*Sa*((T1+273)**4 - (T2+273)**4)\n", - "\n", - "Th = Hg-Hcon-Hrad\n", - "\n", - "dTbydt = Th/Hc\n", - "\n", - "# Result\n", - "\n", - "print(\"Rate of change of temperature \",round(dTbydt,5),\"C/s\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Example 1.6 Page number 11" - ] - }, - { - "cell_type": "code", - "execution_count": 40, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "BTU/hrftF = 1.7322 W/mC\n", - "BTU/hrft2F = 5.6831 W/m2C\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "J = 9.47*10**-4 # Joule to BTU conversion\n", - "\n", - "m = 39.37 # meter to inch conversion\n", - "\n", - "kg = 2.2046 # kg to lb conversion\n", - "\n", - "C = 9/5 # Celcius to Farhenight\n", - "\n", - "# Calculation\n", - "\n", - "BTU = 1/J # in Joule\n", - "\n", - "ft = 12/m # in feet\n", - "\n", - "a = (BTU/(3600*ft*(5/9))) # in BTU/hrftF\n", - "\n", - "print(\"BTU/hrftF = \",round(a,4),\"W/mC\")\n", - "\n", - "b = (BTU/(3600*ft**2*(5/9))) # in BTU/hrftF\n", - "\n", - "print(\"BTU/hrft2F = \",round(b,4),\"W/m2C\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Problem 1 page Number 11" - ] - }, - { - "cell_type": "code", - "execution_count": 43, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Temprature gradient along surface -1111.7 C/m\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "#variable declaration\n", - "\n", - "T1 = 200 # temperature of wall 1 Kelvin\n", - "\n", - "T2 = 60 # temperature of wall 2 in Kelvin\n", - "\n", - "sigma = 5.67 # Stefen-Boltzmann constant\n", - "\n", - "h = 80 # Convective heat transfer coefficient W/m2K\n", - "\n", - "k = 12 # thermal conductivity in W/mK\n", - "\n", - "#L = 0.2 # slab thickness in meters\n", - "\n", - "#calculation\n", - "\n", - "Q = sigma*(((T1+273)/100)**4 - ((T2+273)/100)**4)+ h*(T1-T2) # heat received (W)\n", - "\n", - "dTbydx = Q/(-1*k) # temp gradient (K)\n", - "\n", - "print(\"Temprature gradient along surface\",round(dTbydx,1),\"C/m\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Problem 2 Page number 12" - ] - }, - { - "cell_type": "code", - "execution_count": 46, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Temprature only conduction and convection 682.174 C\n", - "Temprature only conduction and radiation 1139.148 C\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "#variable declaration\n", - "\n", - "dTbydx = -9000 # temperature gradient \n", - "\n", - "T2 = 30 # temperature of wall 2 in C\n", - "\n", - "sigma = 5.67 # Stefen-Boltzmann constant\n", - "\n", - "k = -25 # Convective heat transfer coefficient W/mK\n", - "\n", - "h = 345 # thermal conductivity in W/m2K\n", - "\n", - "A = 1 # area in meters sq\n", - "\n", - "#calculation\n", - "\n", - "#only conduction and convection\n", - "\n", - "T11 = k*A*dTbydx/(h*A) + T2\n", - "\n", - "#only conduction and radiation\n", - "\n", - "T12 = (((k*A*dTbydx/(sigma)) + ((T2+273)/100)**4)*100**4)**(1/4)-273\n", - "\n", - "# Result\n", - "\n", - "print(\"Temprature only conduction and convection \",round(T11,3),\"C\")\n", - "\n", - "print(\"Temprature only conduction and radiation \",round(T12,3),\"C\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Problem number 3 Page number 12" - ] - }, - { - "cell_type": "code", - "execution_count": 47, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Wall surface temperature 330.4 K\n", - "Heat Generated 2252.765 W/m2\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "#variable declaration\n", - "\n", - "Qc = 2250 # heat conducted in W/m2\n", - "\n", - "T1 = 303 # temperature of wall 2 in C\n", - "\n", - "sigma = 5.67 # Stefen-Boltzmann constant\n", - "\n", - "h = 75 # thermal conductivity in W/m2K\n", - "\n", - "A = 1 # area in meters sq\n", - "\n", - "#calculation\n", - "\n", - "# taking the approximate value from table 330.4\n", - "\n", - "Tapprox = 330.4\n", - "\n", - "Q = h*(Tapprox-T1)+sigma*((Tapprox/100)**4-(T1/100)**4)\n", - "\n", - "# Result\n", - "\n", - "print(\"Wall surface temperature \",round(Tapprox,3),\"K\")\n", - "\n", - "print(\"Heat Generated \",round(Q,3),\"W/m2\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Problem 4 page number 13" - ] - }, - { - "cell_type": "code", - "execution_count": 48, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Wall surface temperature 277.75 K\n", - "Heat Generated 65.479 W\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "#variable declaration\n", - "\n", - "Hc = 65.5 # heat conducted in W/m\n", - "\n", - "T1 = 263 # temperature of wall in K\n", - "\n", - "sigma = 5.67 # Stefen-Boltzmann constant\n", - "\n", - "h = 4.35 # thermal conductivity in W/m2K\n", - "\n", - "r = 0.08 # area in meters \n", - "\n", - "#calculation\n", - "\n", - "# taking the approximate value from table 277.75 K\n", - "\n", - "Tapprox = 277.75\n", - "\n", - "Q = h*3.14*r*2*(Tapprox-T1)+sigma*2*3.14*r*((Tapprox/100)**4-(T1/100)**4)\n", - "\n", - "# Result\n", - "\n", - "print(\"Wall surface temperature \",round(Tapprox,3),\"K\")\n", - "\n", - "print(\"Heat Generated \",round(Q,3),\"W\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Problem 5 Page number 14" - ] - }, - { - "cell_type": "code", - "execution_count": 51, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Wall surface temperature 386.1 K\n", - "Heat Generated 449.65 W\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "#variable declaration\n", - "\n", - "Hc = 450 # heat conducted in W/m\n", - "\n", - "T1 = 396.4 # temperature of wall in K\n", - "\n", - "sigma = 5.67 # Stefen-Boltzmann constant\n", - "\n", - "h = 1.5 # thermal conductivity in W/m2K\n", - "\n", - "r = 0.08 # area in meters \n", - "\n", - "A = 4*3.14*0.48**2 # area in meters sq\n", - "\n", - "#calculation\n", - "\n", - "# taking the approximate value from table 386.1 K\n", - "\n", - "Tapprox = 386.1\n", - "\n", - "Q = h*A*(T1-Tapprox)+sigma*A*((T1/100)**4-(Tapprox/100)**4)\n", - "\n", - "# Result\n", - "\n", - "print(\"Wall surface temperature \",round(Tapprox,3),\"K\")\n", - "\n", - "print(\"Heat Generated \",round(Q,3),\"W\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Problem 6 Page number 14" - ] - }, - { - "cell_type": "code", - "execution_count": 52, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Heat Capacity 1000.0 J/C\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "#variable declaration\n", - "\n", - "dTbydt = 0.5 # Temperature transition in C/s\n", - "\n", - "Qr = 4000 # Heat Received in J/s\n", - "\n", - "Qc = 5200 # Heat Convection in J/s\n", - "\n", - "qdot = 1700 # Heat generated in J/s\n", - "\n", - "#calculation\n", - "\n", - "HeatCapacity = (Qr-Qc+qdot)/dTbydt\n", - "\n", - "# Result\n", - "\n", - "print(\"Heat Capacity \",round(HeatCapacity,3),\"J/C\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Problem 7 page number 15" - ] - }, - { - "cell_type": "code", - "execution_count": 54, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Time rate of temperature change 0.1 C/s\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "#variable declaration\n", - "\n", - "Q = 240 # Heat Received in J/s\n", - "\n", - "qdot = 100000 # Heat generated in J/m3/s\n", - "\n", - "rho = 2500 # density in kg/m3\n", - "\n", - "cp = 0.52*10**3 # heat capacity in kJ/KgK\n", - "\n", - "a = 0.2 # side of the cube in meters\n", - "\n", - "#calculation\n", - "\n", - "V = a**3\n", - "\n", - "dTbydt = (Q+qdot*V)/(rho*V*cp)\n", - "\n", - "# Result\n", - "\n", - "print(\"Time rate of temperature change \",round(dTbydt,3),\"C/s\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Problem 8 Page Number 15 " - ] - }, - { - "cell_type": "code", - "execution_count": 55, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Heat Convected 1309.5 W/m2\n", - "Heat Received 1303.428 W/m2\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "#variable declaration\n", - "\n", - "T1 = 160 # heat conducted in W/m\n", - "\n", - "T2 = 30 # temperature of wall in K\n", - "\n", - "sigma = 5.67 # Stefen-Boltzmann constant\n", - "\n", - "h = 45 # thermal conductivity in W/m2K\n", - "\n", - "A = 1 # area in meters sq\n", - "\n", - "#calculation\n", - "\n", - "# taking the approximate value from table 332 K\n", - "\n", - "Tapprox = 332.1 \n", - "\n", - "Hc = h*A*(Tapprox-(273+T2)) # Heat Convected in W/m2\n", - "\n", - "Hr = sigma*A*(((T1+273)/100)**4-(Tapprox/100)**4) # Heat received in W/m2\n", - "\n", - "# Result\n", - "\n", - "print(\"Heat Convected \",round(Hc,3),\"W/m2\")\n", - "\n", - "print(\"Heat Received \",round(Hr,3),\"W/m2\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Problem 9 Page number 16" - ] - }, - { - "cell_type": "code", - "execution_count": 60, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Total Heat loss case 1 150.6 W\n", - "Total Heat loss case 2 81.9 W\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "#variable declaration\n", - "\n", - "T1 = 37 # temperature of body in C\n", - "\n", - "T21 = 26 # temperature of air in C\n", - "\n", - "T22 = 5 # temperature of walls in room in C\n", - "\n", - "sigma = 5.67 # Stefen-Boltzmann constant\n", - "\n", - "h = 6 # Convective heat transfer coefficient W/m2K\n", - "\n", - "A = 0.6 # area in meters sq\n", - "\n", - "#calculation\n", - "\n", - "Hc = h*A*(T1-T21) # Heat Convected in W/m2\n", - "\n", - "Hr1 = sigma*A*(((T1+273)/100)**4-((T22+273)/100)**4) # Heat received in W/m2\n", - "\n", - "Ht1 = Hr1+Hc\n", - "\n", - "# calculate when temperature is 26C\n", - "\n", - "Hr2 = sigma*A*(((T1+273)/100)**4 - ((T21+273)/100)**4) # Heat received in W/m2\n", - "\n", - "Ht2 = Hc+Hr2\n", - "\n", - "print(\"Total Heat loss case 1\",round(Ht1,1),\"W\")\n", - "\n", - "print(\"Total Heat loss case 2\",round(Ht2,1),\"W\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Problem 10 Page number 16" - ] - }, - { - "cell_type": "code", - "execution_count": 63, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Net heat Gain 291.1 W\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "#variable declaration\n", - "\n", - "T1 = 37 # temperature of body in C\n", - "\n", - "T21 = 650 # temperature of air in C\n", - "\n", - "T22 = 5 # temperature of walls in room in C\n", - "\n", - "sigma = 5.67 # Stefen-Boltzmann constant\n", - "\n", - "h = 6 # Convective heat transfer coefficient W/m2K\n", - "\n", - "A = 0.6 # area in meters sq\n", - "\n", - "F = 0.01 # fraction of radiation \n", - "\n", - "#calculation\n", - "\n", - "# Heat loss by convection in W\n", - "\n", - "Hc = h*A*(T1-T22)\n", - "\n", - "# Heat Gain by radiation\n", - "\n", - "Hr = sigma*F*(((T21+273)/100)**4 - ((T1+273)/100)**4) # Heat received in W/m2\n", - "\n", - "Hnet = Hr-Hc\n", - "\n", - "print(\"Net heat Gain\",round(Hnet,1),\"W\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Problem 11 Page number 16" - ] - }, - { - "cell_type": "code", - "execution_count": 66, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Equilibrium Temperature = 960.01 K\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "# Variable Declaration\n", - "\n", - "Q = 1500 # heat dissipation in W\n", - "\n", - "sigma = 5.67 # stefan-Boltzmann constant\n", - "\n", - "T2 = 288 # temperature in K\n", - "\n", - "r = 0.04 # radius in meters\n", - "\n", - "H = 0.25 # height in meters\n", - "\n", - "T1 = ((Q/(sigma*3.14*r*H)+(288/100)**4)*100**4)**(1/4)\n", - "\n", - "print(\"Equilibrium Temperature = \",round(T1,2),\"K\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Problem number 12 Page number 17" - ] - }, - { - "cell_type": "code", - "execution_count": 68, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Equilibrium Temperature = 62.0 C\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "Hr = 800 # Heat Rate in W/m2\n", - "\n", - "h1 = 10 # convective heat transfer rate on back of plate in W/m2K\n", - "\n", - "h2 = 15 # convective heat transfer rate on front of plate in W/m2K\n", - "\n", - "T2 = 30 # temperature on both sides of the plate\n", - "\n", - "T = (Hr+h1*30+h2*30)/25\n", - "\n", - "print(\"Equilibrium Temperature = \",round(T,2),\"C\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Problem number 13 Page number 17" - ] - }, - { - "cell_type": "code", - "execution_count": 73, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "temperature of the plate 784.57 K\n", - "heat transfer with sheet 19668.31 W\n", - "heat transfer without sheet 39336.61 W\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "# Variable Declaration\n", - "\n", - "T1 = 650 # temperature from one side of the source in C\n", - "\n", - "T2 = 150 # temperature on other side of the surface in C\n", - "\n", - "sigma = 5.67 # stefan-boltzmann constant\n", - "\n", - "T = (((((T1+273)/100)**4 + ((T2+273)/100)**4)/2)*100**4)**(1/4)\n", - "\n", - "print(\"temperature of the plate\",round(T,2),\"K\")\n", - "\n", - "Q1 = sigma*(((T1+273)/100)**4 - (T/100)**4)\n", - "\n", - "print(\"heat transfer with sheet\",round(Q1,2),\"W\")\n", - "\n", - "Q2 = sigma*(((T1+273)/100)**4 - ((T2+273)/100)**4)\n", - "\n", - "print(\"heat transfer without sheet\",round(Q2,2),\"W\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Problem 14 Page number 18" - ] - }, - { - "cell_type": "code", - "execution_count": 83, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "COnvective heat trasnfer rate 375.0 W/m2K\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "# Variable Declaration\n", - "\n", - "Tair = 120 # temperature of air in C\n", - "\n", - "T1 = 42 # temperature of plate 1 in C\n", - "\n", - "T2 = 30 # temperature of plate 2 in C\n", - "\n", - "L = 0.01 # length of the slab in meters\n", - "\n", - "A = 1 # area in meters sq\n", - "\n", - "k = 22.5 # thermal conductivity in W/mK\n", - "\n", - "# Calculation\n", - "\n", - "Q = (T1-T2)/(L/(k*A))\n", - "\n", - "Tnew = T1+6\n", - "\n", - "h = Q/(A*(Tair-Tnew))\n", - "\n", - "print(\"COnvective heat trasnfer rate\",round(h,2),\"W/m2K\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Problem 15 Page number 19" - ] - }, - { - "cell_type": "code", - "execution_count": 87, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Efficiency of the collector when temperature is 32 deg C 47.5 %\n", - "Efficiency of the collector when temperature is 45 deg C 75.62 %\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "T1 = 60 # temperature of the tube in C\n", - "\n", - "T2 = 32 # temperature of air in C\n", - "\n", - "h = 15 # convective heat transfer in W/m2K\n", - "\n", - "A = 1 # area in meters sq\n", - "\n", - "Qf = 800 # heat flux in W/m2\n", - "\n", - "Tnew = 45 # new temperature in C\n", - "\n", - "# Calculation\n", - "\n", - "Q = h*A*(T1-T2) # heat transfer in W\n", - "\n", - "eff = ((Qf-Q)/Qf)*100\n", - "\n", - "print(\"Efficiency of the collector when temperature is 32 deg C\",round(eff,2),\"%\")\n", - "\n", - "# Heat lost by convection when T = 45 C\n", - "\n", - "Q2 = h*A*(Tnew-T2) # heat transfer in W\n", - "\n", - "eff1 = ((Qf-Q2)/Qf)*100 \n", - "\n", - "print(\"Efficiency of the collector when temperature is 45 deg C\",round(eff1,2),\"%\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Problem 16 Page Number 19" - ] - }, - { - "cell_type": "code", - "execution_count": 88, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Temperature of the air 428.89 C\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "# Variable declaration\n", - "\n", - "Tg = 40 # temperature of the glass plate in C\n", - "\n", - "dT = 5 # temperature graditent in C\n", - "\n", - "L = 0.001 # length in meters\n", - "\n", - "k = 1.4 # conductive heat transfer coefficient in W/mK\n", - "\n", - "A = 1 # area in meters sq\n", - "\n", - "h = 18 # convective heat trasnfer coefficient in W/m2K\n", - "\n", - "# Calculation\n", - "\n", - "Q = dT/(L/(k*A))\n", - "\n", - "Tair = (Q/h)+ Tg\n", - "\n", - "print(\"Temperature of the air\",round(Tair,2),\"C\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Problem 17 Page number 20" - ] - }, - { - "cell_type": "code", - "execution_count": 89, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Temperature gradient in the solid -631.58 C/m\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "# Variable Declaration\n", - "\n", - "h = 30 # Convective heat transfer coefficient in W/m2K\n", - "\n", - "k = 9.5 # conductive heat trasnfer coefficient in W/mK\n", - "\n", - "T1 = 260 # temperature of the surface in C\n", - "\n", - "T2 = 60 # temperature of the air in C\n", - "\n", - "tempgrad = (h/k)*(T2-T1)\n", - "\n", - "print(\"Temperature gradient in the solid\",round(tempgrad,2),\"C/m\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Problem 18 Page number 20" - ] - }, - { - "cell_type": "code", - "execution_count": 90, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Steady state temperature of plate 313.33 K\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "# Variable Declaration\n", - "\n", - "A = 1 # area in meters sq\n", - "\n", - "h1 = 100 # convective heat transfer coeffcient in W/m2K\n", - "\n", - "h2 = 15 # convective heat transfer coeffcient in W/m2K\n", - "\n", - "# solving by trial and error we get T1 = 313.33 K\n", - "\n", - "T1 = 313.33 \n", - "\n", - "print(\"Steady state temperature of plate\",round(T1,2),\"K\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Problem 19 Page number 21" - ] - }, - { - "cell_type": "code", - "execution_count": 91, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Surface temperature 674.39 K\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "# Variable Declaration\n", - "\n", - "k = -22.5 # conductive heat trasnfer coefficient in W/mK\n", - "\n", - "tempgrad = -500 # temperature gradient in C/m\n", - "\n", - "sigma = 5.67 # stefan-boltzmann constant\n", - "\n", - "Ts = 303 # temperatre of surroundings in K\n", - "\n", - "# Calculation\n", - "\n", - "T2 = ((((k*tempgrad)/sigma)+(Ts/100)**4)*100**4)**(1/4)\n", - "\n", - "print(\"Surface temperature\",round(T2,2),\"K\")\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Problem 20 Page number 21" - ] - }, - { - "cell_type": "code", - "execution_count": 92, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Surface temperatrue 230.2 K\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "# variable declaration \n", - "\n", - "Hc = 2000 # heat generated in W\n", - "\n", - "r = 1 # radius in meters\n", - "\n", - "sigma = 5.67 # stefan boltzmann constant\n", - "\n", - "T2 = 0 # temperate of space in K\n", - "\n", - "# Calculation \n", - "\n", - "T = ((Hc/(4*3.14*r**2*sigma))*100**4)**(1/4)\n", - "\n", - "print(\"Surface temperatrue\",round(T,2),\"K\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Problem 21 page Number 22" - ] - }, - { - "cell_type": "code", - "execution_count": 93, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Temperature drop through the wall 1.33 C\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "# Variable Declaration\n", - "\n", - "Q = 10 # heat flux in W/m2\n", - "\n", - "A = 1 # area in meters sq\n", - "\n", - "k = 1.5 # thermal cnductivity in W/mK\n", - "\n", - "t = 0.2 # wall thockness in m\n", - "\n", - "# Calculation\n", - "\n", - "dT = (Q*t)/(k*A)\n", - "\n", - "print(\"Temperature drop through the wall\",round(dT,2),\"C\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "anaconda-cloud": {}, - "kernelspec": { - "display_name": "Python [default]", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.5.2" - } - }, - "nbformat": 4, - "nbformat_minor": 1 -} diff --git a/sample_notebooks/Reshma Ustad/Chapter_2_Properties.ipynb b/sample_notebooks/Reshma Ustad/Chapter_2_Properties.ipynb new file mode 100755 index 00000000..823b8e71 --- /dev/null +++ b/sample_notebooks/Reshma Ustad/Chapter_2_Properties.ipynb @@ -0,0 +1,146 @@ +{ + "metadata": { + "name": "Chapter 2 Properties Of Material" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": "Chapter 2 Properties Of Material" + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Example 1 Page No:19" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#Input data\nL=5 # length of steel bar in m\nd=25*10**-3 # diametr of steel bar in mm\ndeltaLt=25*10**-3 #steel \npt=800 # power load of steel bar in N\n\n\n#calculation\nA=((pi/4)*((deltaLt)**2)) #Cross-section area\nsigmat=(pt)/(A) #Stress in steel bar\net=(deltaLt)/L #strain in steel bar\nE=(sigmat)/(et) #Young's modulus\n\n\n#output\nprint(\"value of Cross-section area A=\",A,\"m**2\")\nprint(\"value of tress in steel bar sigmat=\",sigmat,\"MN/m**2\")\nprint(\"value of strain in steel bar et= \",et)\nprint(\"value of Young's modulus E \",E,\"N/m**2\")\n\n\n", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "value of Cross-section area A= 0.0004906250000000001 m**2\nvalue of tress in steel bar sigmat= 1630573.248407643 MN/m**2\nvalue of strain in steel bar et= 0.005\nvalue of Young's modulus E 326114649.6815286 N/m**2\n" + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Example 2 Page No:20\n" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#Input data\nL=300*10**-3 #length of hexagonal prismatic steel bar in mm\nA=500*10**-6 #Area of cross section of steel bar mm**2\nPt=500*10**3 # load of steel bar in KN\nE=210*10**9 # modulus of elasticity GN/m**2\n\n#Calculation\nsigmat=((Pt)/(A)) #stress in steel bar\net=((sigmat)/(E)) #strain steel bar is\ndeltaLt=((et)*(L)) #therefore,elongation of the steel bar is given by\n\n#output\nprint('stress in steel bar =',sigmat,\"N/m**2\")\nprint('therefore,strain steel bar is given by =',et,)\nprint('therefore,elongation of the steel bar is given by=',deltaLt,\"m\")\n\n\n", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "stress in steel bar = 1000000000.0 N/m**2\ntherefore,strain steel bar is given by = 0.004761904761904762\ntherefore,elongation of the steel bar is given by= 0.0014285714285714286 m\n" + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Example 3 Page No:21\n" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#Input Data\nPt=600 #tensils force in N\nd=2*10**-3 #diameter of steel wire in mm\nL=15 #length of wire in m\nE=210*10**9 #modulus of elasticity of the material in GN/M**2\npi=3.1482\n\n\n#Calculation\nA=((pi/4)*((d)**2)) #(1)cross section area\nsigmat=(Pt)/(A) # stress in the steel wire \net=((sigmat)/(E)) #(2)therefore, strain in steel wire is given by\ndeltaLt=et*L #(3)Enlongation of the steel wire is given by \npe=((deltaLt/L)*100) #(4)percentage elongation\n\n\n#Output\nprint(\"cross section area A= \",A,\"m**2\")\nprint(\"stress in the steel wire sigmat=\",sigmat,\"GN/m**2\")\nprint(\"modulus of elasticity et=\",et,)\nprint(\"strain in steel wire deltaLt=\",deltaLt,\"mm\")\nprint(\"percentage elongation\",pe,\"%\")\n\n\n\n", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "cross section area A= 3.1481999999999998e-06 m**2\nstress in the steel wire sigmat= 190585096.24547362 GN/m**2\nmodulus of elasticity et= 0.0009075480773593982\nstrain in steel wire deltaLt= 0.013613221160390973 mm\npercentage elongation 0.09075480773593982 %\n" + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Example 4 Page No:22\n" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#input data\nA=30*30*10**-6 #area of square rod in mm**2\nL=5 #length of square rod in m\nPc=150*10**3 # axial comperessive load of a rod in kN\nE=215*10**9 # modulus of elasticity in GN/m**2\n\n\n#Calculation\nsigmac=((Pc)/(A)) #stress in square rod\nec=((sigmac)/(E)) #modulusof elasticity is E=sigmac/ec ,therefore strain in square rod is\ndeltaLc=ec*5 #therefore shortening of length of the rod \n\n\n#Output\nprint (\"stress in square rod\",sigmac,\"N/m**2\")\nprint(\"strain in square rod ec=\",ec,)\nprint(\"shortening of length of the rod=\",deltaLc,\"m\")", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "stress in square rod 166666666.66666666 N/m**2\nstrain in square rod ec= 0.0007751937984496124\nshortening of length of the rod= 0.003875968992248062 m\n" + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Example 5 Page No:23" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#input data\nd=50*10**-6 #diameter of metalic rod in mm**2\nL=220*10**-3 #length of metalic rod in mm\nPt=40*10**3 #load of metalic rod in KN\ndeltaLt=0.03*10**-3 #elastic enlongation in mm\nypl=160*10**3 # yield point load in KN\nml=250*10**3 #maximum load in KN\nlsf=270*10**-3 #length of specimen at fracture in mm\npi=3.1482\n\n#calculation\nA=(((pi)/(4)*((d)**2))) #(1)cross section area\nsigmat=(Pt/A) #stress in metallic rod\net=(deltaLt/L) #strain n metallic rod\nE=(sigmat/et) #young's modulus\nys=(ypl/A) #(2)yeild strength\nuts=(ml/A) #(3)ultimate tensile strength\nPebf=((lsf-L)/L)*100 #percentage elongation before fracture \n\n\n\n#output\nprint(\"cross section area\",A,\"m**2\")\nprint(\"stress in metallic rod\",sigmat,\"N/m**2\")\nprint(\"strain n metallic rod\",et,)\nprint(\"young's modulus\",E,\"GN/m**2\")\nprint(\"yeild strength\",ys,\"MN/m**2\")\nprint(\"ultimate tensile strength\",uts,\"MN/m**2\")\nprint(\"percentage elongation before fracture\",Pebf,\"%\")\n", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "cross section area 1.967625e-09 m**2\nstress in metallic rod 20329076932850.52 N/m**2\nstrain n metallic rod 0.00013636363636363637\nyoung's modulus 1.4907989750757046e+17 GN/m**2\nyeild strength 81316307731402.08 MN/m**2\nultimate tensile strength 127056730830315.75 MN/m**2\npercentage elongation before fracture 22.727272727272734 %\n" + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Example 6 Page No:24\n" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#input data\nA=50*50*10**-6 #area ofsquare metal bar in mm**2\nPc=600*10**3 #axial compress laod in KN\nL=200*10**-3 # gauge length of metal bar in mm\ndeltaLc=0.4*10**-3 #contraction length of metal bar in mm\ndeltaLlateral=0.05*10**-3 #lateral length of metal bar in mm\n\n#Calculation\nsigmac=((Pc)/(A)) #stress in square metal bar \nec=((deltaLc)/(L)) #longitudinal or linear strain in square metal bar\nE =((sigmac)/(ec)) #smodule of elasticity\nelateral=((deltaLlateral)/(L)) #lateral strain in square metal bar\npoissonsratio=(elateral)/(ec)\n\n\n#output\nprint(\"stress in bar=\",sigmac,\"n/m**2\")\nprint(\"longitudinal or linear strain in square metal bar=\",ec,)\nprint(\"module of elasticity=\",E,\"N/m**2\")\nprint(\"lateral strain in square metal bar=\",elateral,)\nprint(\"poissons ratio=\",poissonsratio,)\n\n#poisson's ratio", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "stress in bar= 240000000.0 n/m**2\nlongitudinal or linear strain in square metal bar= 0.002\nmodule of elasticity= 120000000000.0 N/m**2\nlateral strain in square metal bar= 0.00025\npoissons ratio= 0.125\n" + } + ], + "prompt_number": 12 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/Reshma Ustad/Chapter_2_Properties_Of.ipynb b/sample_notebooks/Reshma Ustad/Chapter_2_Properties_Of.ipynb deleted file mode 100755 index 823b8e71..00000000 --- a/sample_notebooks/Reshma Ustad/Chapter_2_Properties_Of.ipynb +++ /dev/null @@ -1,146 +0,0 @@ -{ - "metadata": { - "name": "Chapter 2 Properties Of Material" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": "Chapter 2 Properties Of Material" - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Example 1 Page No:19" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#Input data\nL=5 # length of steel bar in m\nd=25*10**-3 # diametr of steel bar in mm\ndeltaLt=25*10**-3 #steel \npt=800 # power load of steel bar in N\n\n\n#calculation\nA=((pi/4)*((deltaLt)**2)) #Cross-section area\nsigmat=(pt)/(A) #Stress in steel bar\net=(deltaLt)/L #strain in steel bar\nE=(sigmat)/(et) #Young's modulus\n\n\n#output\nprint(\"value of Cross-section area A=\",A,\"m**2\")\nprint(\"value of tress in steel bar sigmat=\",sigmat,\"MN/m**2\")\nprint(\"value of strain in steel bar et= \",et)\nprint(\"value of Young's modulus E \",E,\"N/m**2\")\n\n\n", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "value of Cross-section area A= 0.0004906250000000001 m**2\nvalue of tress in steel bar sigmat= 1630573.248407643 MN/m**2\nvalue of strain in steel bar et= 0.005\nvalue of Young's modulus E 326114649.6815286 N/m**2\n" - } - ], - "prompt_number": 10 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Example 2 Page No:20\n" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#Input data\nL=300*10**-3 #length of hexagonal prismatic steel bar in mm\nA=500*10**-6 #Area of cross section of steel bar mm**2\nPt=500*10**3 # load of steel bar in KN\nE=210*10**9 # modulus of elasticity GN/m**2\n\n#Calculation\nsigmat=((Pt)/(A)) #stress in steel bar\net=((sigmat)/(E)) #strain steel bar is\ndeltaLt=((et)*(L)) #therefore,elongation of the steel bar is given by\n\n#output\nprint('stress in steel bar =',sigmat,\"N/m**2\")\nprint('therefore,strain steel bar is given by =',et,)\nprint('therefore,elongation of the steel bar is given by=',deltaLt,\"m\")\n\n\n", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "stress in steel bar = 1000000000.0 N/m**2\ntherefore,strain steel bar is given by = 0.004761904761904762\ntherefore,elongation of the steel bar is given by= 0.0014285714285714286 m\n" - } - ], - "prompt_number": 15 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Example 3 Page No:21\n" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#Input Data\nPt=600 #tensils force in N\nd=2*10**-3 #diameter of steel wire in mm\nL=15 #length of wire in m\nE=210*10**9 #modulus of elasticity of the material in GN/M**2\npi=3.1482\n\n\n#Calculation\nA=((pi/4)*((d)**2)) #(1)cross section area\nsigmat=(Pt)/(A) # stress in the steel wire \net=((sigmat)/(E)) #(2)therefore, strain in steel wire is given by\ndeltaLt=et*L #(3)Enlongation of the steel wire is given by \npe=((deltaLt/L)*100) #(4)percentage elongation\n\n\n#Output\nprint(\"cross section area A= \",A,\"m**2\")\nprint(\"stress in the steel wire sigmat=\",sigmat,\"GN/m**2\")\nprint(\"modulus of elasticity et=\",et,)\nprint(\"strain in steel wire deltaLt=\",deltaLt,\"mm\")\nprint(\"percentage elongation\",pe,\"%\")\n\n\n\n", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "cross section area A= 3.1481999999999998e-06 m**2\nstress in the steel wire sigmat= 190585096.24547362 GN/m**2\nmodulus of elasticity et= 0.0009075480773593982\nstrain in steel wire deltaLt= 0.013613221160390973 mm\npercentage elongation 0.09075480773593982 %\n" - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Example 4 Page No:22\n" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#input data\nA=30*30*10**-6 #area of square rod in mm**2\nL=5 #length of square rod in m\nPc=150*10**3 # axial comperessive load of a rod in kN\nE=215*10**9 # modulus of elasticity in GN/m**2\n\n\n#Calculation\nsigmac=((Pc)/(A)) #stress in square rod\nec=((sigmac)/(E)) #modulusof elasticity is E=sigmac/ec ,therefore strain in square rod is\ndeltaLc=ec*5 #therefore shortening of length of the rod \n\n\n#Output\nprint (\"stress in square rod\",sigmac,\"N/m**2\")\nprint(\"strain in square rod ec=\",ec,)\nprint(\"shortening of length of the rod=\",deltaLc,\"m\")", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "stress in square rod 166666666.66666666 N/m**2\nstrain in square rod ec= 0.0007751937984496124\nshortening of length of the rod= 0.003875968992248062 m\n" - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Example 5 Page No:23" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#input data\nd=50*10**-6 #diameter of metalic rod in mm**2\nL=220*10**-3 #length of metalic rod in mm\nPt=40*10**3 #load of metalic rod in KN\ndeltaLt=0.03*10**-3 #elastic enlongation in mm\nypl=160*10**3 # yield point load in KN\nml=250*10**3 #maximum load in KN\nlsf=270*10**-3 #length of specimen at fracture in mm\npi=3.1482\n\n#calculation\nA=(((pi)/(4)*((d)**2))) #(1)cross section area\nsigmat=(Pt/A) #stress in metallic rod\net=(deltaLt/L) #strain n metallic rod\nE=(sigmat/et) #young's modulus\nys=(ypl/A) #(2)yeild strength\nuts=(ml/A) #(3)ultimate tensile strength\nPebf=((lsf-L)/L)*100 #percentage elongation before fracture \n\n\n\n#output\nprint(\"cross section area\",A,\"m**2\")\nprint(\"stress in metallic rod\",sigmat,\"N/m**2\")\nprint(\"strain n metallic rod\",et,)\nprint(\"young's modulus\",E,\"GN/m**2\")\nprint(\"yeild strength\",ys,\"MN/m**2\")\nprint(\"ultimate tensile strength\",uts,\"MN/m**2\")\nprint(\"percentage elongation before fracture\",Pebf,\"%\")\n", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "cross section area 1.967625e-09 m**2\nstress in metallic rod 20329076932850.52 N/m**2\nstrain n metallic rod 0.00013636363636363637\nyoung's modulus 1.4907989750757046e+17 GN/m**2\nyeild strength 81316307731402.08 MN/m**2\nultimate tensile strength 127056730830315.75 MN/m**2\npercentage elongation before fracture 22.727272727272734 %\n" - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Example 6 Page No:24\n" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#input data\nA=50*50*10**-6 #area ofsquare metal bar in mm**2\nPc=600*10**3 #axial compress laod in KN\nL=200*10**-3 # gauge length of metal bar in mm\ndeltaLc=0.4*10**-3 #contraction length of metal bar in mm\ndeltaLlateral=0.05*10**-3 #lateral length of metal bar in mm\n\n#Calculation\nsigmac=((Pc)/(A)) #stress in square metal bar \nec=((deltaLc)/(L)) #longitudinal or linear strain in square metal bar\nE =((sigmac)/(ec)) #smodule of elasticity\nelateral=((deltaLlateral)/(L)) #lateral strain in square metal bar\npoissonsratio=(elateral)/(ec)\n\n\n#output\nprint(\"stress in bar=\",sigmac,\"n/m**2\")\nprint(\"longitudinal or linear strain in square metal bar=\",ec,)\nprint(\"module of elasticity=\",E,\"N/m**2\")\nprint(\"lateral strain in square metal bar=\",elateral,)\nprint(\"poissons ratio=\",poissonsratio,)\n\n#poisson's ratio", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "stress in bar= 240000000.0 n/m**2\nlongitudinal or linear strain in square metal bar= 0.002\nmodule of elasticity= 120000000000.0 N/m**2\nlateral strain in square metal bar= 0.00025\npoissons ratio= 0.125\n" - } - ], - "prompt_number": 12 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/SalilKapur/IntroductionConcept.ipynb b/sample_notebooks/SalilKapur/IntroductionConcept.ipynb new file mode 100755 index 00000000..050d69c7 --- /dev/null +++ b/sample_notebooks/SalilKapur/IntroductionConcept.ipynb @@ -0,0 +1,282 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 1: Introduction—Concept of Stress\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example 1.1, Page number 18 " + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Case(a): Shearing Stress in Pin A = 6790.6 psi\n", + "Case(b): Shearing Stress in Pin C = 7639 psi\n", + "Case(c): Largest Normal Stress in Link ABC = 2286 psi\n", + "Case(d): Average Shearing Stress at B = 171 psi\n", + "Case(e): Bearing Stress in Link at C = 6000 psi\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "#Variable declaration\n", + "Fac = 750 #Force on rod AC(lb)\n", + "D = 0.375 #Diameter at the upper junction of rod ABC(in)\n", + "\n", + "\n", + "#Calculation \n", + "#Case(a)\n", + "A=(1/4)*((math.pi)*pow(D,2)) #Area at the upper junction of rod ABC(in^2) \n", + "tA=(Fac/A) #Shearing Stress in Pin A(psi) \n", + "#Case(b) \n", + "Ab=(1/4)*((math.pi)*pow(0.25,2)) #Area at the lower junction of rod ABC(in^2)\n", + "tC=(((1/2)*Fac)/Ab) #Shearing Stress in Pin C(psi)\n", + "#Case(c)\n", + "Anet=(3/8)*(1.25-0.375) #Area of cross section at A(in^2)\n", + "sA=(Fac/Anet) #Largest Normal Stress in Link ABC(psi)\n", + "#Case(d)\n", + "F1=750/2 #Force on each side(lb)\n", + "Ad=(1.25*1.75) #Area at junction B(in^2)\n", + "tB=(F1/Ad) #Average Shearing Stress at B\n", + "#Case(e)\n", + "Ae=0.25*0.25 #Area at point C(in^2)\n", + "sB=(F1/Ae) #Bearing Stress in Link at C\n", + "\n", + "\n", + "#Result\n", + "print('Case(a): Shearing Stress in Pin A = %.1f psi' %tA)\n", + "print('Case(b): Shearing Stress in Pin C = %.f psi' %tC)\n", + "print('Case(c): Largest Normal Stress in Link ABC = %.f psi' %sA)\n", + "print('Case(d): Average Shearing Stress at B = %.f psi' %tB)\n", + "print('Case(e): Bearing Stress in Link at C = %.f psi' %sB)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example 1.2, Page number 19" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Case(a): Diameter of the bolt = 28 mm\n", + "Case(a): Dimension b at Each End of the Bar = 62 mm\n", + "Case(a): Dimension h of the Bar = 34.300000 mm\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "#Variable declaration\n", + "P = 120 #Maximum allowable tension force \n", + "s = 175 #Maximum allowable stress\n", + "t = 100 #Maximum allowable stress\n", + "Sb = 350 #Maximum allowable stress\n", + "\n", + "\n", + "#Calculation\n", + "#Case(a)\n", + "F1=P/2 #Current(A)\n", + "d=math.sqrt(((P/2)*1000)/((22/(4*7))*(100000000))) #Diameter of bolt(m)\n", + "d=d*1000 #Diameter of bolt(mm)\n", + "d=round(d,0) #Rounding of the value of diameter of bolt(mm)\n", + "Ad=(0.020*0.028) #Area of cross section of plate \n", + "tb=((P*1000)/Ad)/(1000000) #Stress between between the 20-mm-thick plate and the 28-mm-diameter bolt\n", + "tb=round(tb,0) #Rounding of the above calculated stress to check if it is less than 350\n", + "a=(P/2)/((0.02)*(175)) #Dimension of cross section of ring \n", + "a=round(a,2) #Rounding dimension of cross section of ring to two decimal places\n", + "b=28 + (2*(a)) #Dimension b at Each End of the Bar\n", + "b=round(b,2) #Rounding the dimension b to two decimal places \n", + "h=(P)/((0.020)*(175)) #Dimension h of the Bar\n", + "h=round(h,1) #Rounding dimension h of bar to 1 decimal place\n", + "\n", + "\n", + "#Result\n", + "print ('Case(a): Diameter of the bolt = %.f mm' %d)\n", + "print ('Case(a): Dimension b at Each End of the Bar = %.f mm' %b)\n", + "print ('Case(a): Dimension h of the Bar = %f mm' %h)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example 1.3, Page number 34" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Case(a): Diameter of the bolt = 16.730000 mm\n", + "Case(a): Dimension b at Each End of the Bar = 22.000000 mm\n", + "Case(a): Dimension h of the Bar = 6.000000 mm\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "#Variable declaration\n", + "Su = 600 #ultimate normal stress(MPa) \n", + "FS = 3.3 #Factor of safety with respect to failure\n", + "tU=350 #Ultimate shearing stress(MPa)\n", + "Cx=40 #X Component of reaction at C(kN)\n", + "Cy=65 #Y Component of reaction at C(kN)\n", + "Smax=300 #Allowable bearing stress of the steel \n", + "\n", + "#Calculation\n", + "C=math.sqrt((math.pow(40,2))+(math.pow(65,2)))\n", + "\n", + "#Case(a)\n", + "P=(15*0.6 + 50*0.3)/(0.6) #Allowable bearing stress of the steel(MPa)\n", + "Sall=(Su/FS) #Allowable Stress(MPa)\n", + "Sall=round(Sall,1) #Rounding Allowable stress to 1 decimal place(MPa)\n", + "Areqa=(P/(Sall*(1000))) #Cross Sectional area(m^2)\n", + "Areqa=round(Areqa,5) #Rounding cross sectional area to 5 decimal places(m^2)\n", + "dAB=math.sqrt(((Areqa)*(4))/(22/7)) #Diameter of AB(m)\n", + "dAB=dAB*1000 #Diameter of AB(mm)\n", + "dAB=round(dAB,2) #Rounding Diameter of AB(mm)\n", + "\n", + "#Case(b)\n", + "tALL=tU/FS #Stress(MPa)\n", + "tALL=round(tALL,1) #Rounding of Stress\n", + "AreqC=((C/2)/tALL) #Cross sectional area(m^2)\n", + "AreqC=AreqC*1000 \n", + "AreqC=round(AreqC,0) #Rounding the cross sectional area\n", + "dC=math.sqrt((4*AreqC)/(22/7)) #Diameter at point C\n", + "dC=round((dC+1),0) #Rounding of the diameter at C\n", + "\n", + "#Case(c)\n", + "\n", + "Areq=((C/2)/Smax) \n", + "Areq=Areq*1000 #Cross sectional area(mm^2)\n", + "t=(Areq/22) #Thickness of the bracket\n", + "t=round(t,0)\n", + "\n", + "#Result\n", + "print ('Case(a): Diameter of the bolt = % f mm' %dAB)\n", + "print ('Case(a): Dimension b at Each End of the Bar = % f mm' %dC)\n", + "print ('Case(a): Dimension h of the Bar = % f mm' %t)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "# Example 1.4, Page number 35" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Case(a): Control Rod = 5.263672 kips\n", + "Case(b): Bolt at B = 5.156250 kips\n", + "Case(c): Bolt at D = 6.865179 kips\n", + "Case(d): Bolt at C = 5.238095 kips\n", + "Summary. We have found separately four maximum allowable values of the force C. In order to satisfy all these criteria we must choose the smallest value, namely:= 5.156250 kips\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "#Variable declaration\n", + "tU=40 #ultimate tensile stress\n", + "sU=60 #ultimate shearing stress\n", + "FS=3 #Mimnimum factor of safety\n", + "dA=(7/16) #Diameter of bolt at A(in)\n", + "dB=3/8 #Diameter of bolt at B(in) \n", + "dD=3/8 #Diameter of bolt at D(in)\n", + "dC=1/2 #Diameter of bolt at C(in)\n", + "\n", + "\n", + "#Calculation\n", + "Sall=(sU/FS) #Total tensile stress(kips)\n", + "B=Sall*((1/4)*(22/7)*(pow((7/16),2))) #Allowable force in the control rod(kips)\n", + "C1=1.75*(B) #Control Rod(kips)\n", + "tall=(tU/FS) #Total shearing stress\n", + "B=2*(tall*(1/4)*(22/7)*(3/8)*(3/8)) #Allowable magnitude of the force B exerted on the bolt\n", + "C2=1.75*B #Bolt at B(kips) \n", + "D=B #Bolt at D. Since this bolt is the same as bolt B, the allowable force is same(kips) \n", + "C3=2.33*D #Bolt at D(kips)\n", + "C4=2*(tall*(1/4)*(22/7)*(1/2)*(1/2)) #Bolt at C(kips) \n", + "list1=[C1,C2,C3,C4] #Adding all the maximum allowable forces on C(kips) \n", + "\n", + "\n", + "#Result\n", + "print ('Case(a): Control Rod = % f kips' %C1)\n", + "print ('Case(b): Bolt at B = % f kips' %C2)\n", + "print ('Case(c): Bolt at D = % f kips' %C3)\n", + "print ('Case(d): Bolt at C = % f kips' %C4)\n", + "print ('Summary. We have found separately four maximum allowable values of the force C. In order to satisfy all these criteria we must choose the smallest value, namely:= % f kips' %min(list1));" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.5.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/SalilKapur/IntroductionConcept_of.ipynb b/sample_notebooks/SalilKapur/IntroductionConcept_of.ipynb deleted file mode 100755 index 050d69c7..00000000 --- a/sample_notebooks/SalilKapur/IntroductionConcept_of.ipynb +++ /dev/null @@ -1,282 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 1: Introduction—Concept of Stress\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Example 1.1, Page number 18 " - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Case(a): Shearing Stress in Pin A = 6790.6 psi\n", - "Case(b): Shearing Stress in Pin C = 7639 psi\n", - "Case(c): Largest Normal Stress in Link ABC = 2286 psi\n", - "Case(d): Average Shearing Stress at B = 171 psi\n", - "Case(e): Bearing Stress in Link at C = 6000 psi\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "#Variable declaration\n", - "Fac = 750 #Force on rod AC(lb)\n", - "D = 0.375 #Diameter at the upper junction of rod ABC(in)\n", - "\n", - "\n", - "#Calculation \n", - "#Case(a)\n", - "A=(1/4)*((math.pi)*pow(D,2)) #Area at the upper junction of rod ABC(in^2) \n", - "tA=(Fac/A) #Shearing Stress in Pin A(psi) \n", - "#Case(b) \n", - "Ab=(1/4)*((math.pi)*pow(0.25,2)) #Area at the lower junction of rod ABC(in^2)\n", - "tC=(((1/2)*Fac)/Ab) #Shearing Stress in Pin C(psi)\n", - "#Case(c)\n", - "Anet=(3/8)*(1.25-0.375) #Area of cross section at A(in^2)\n", - "sA=(Fac/Anet) #Largest Normal Stress in Link ABC(psi)\n", - "#Case(d)\n", - "F1=750/2 #Force on each side(lb)\n", - "Ad=(1.25*1.75) #Area at junction B(in^2)\n", - "tB=(F1/Ad) #Average Shearing Stress at B\n", - "#Case(e)\n", - "Ae=0.25*0.25 #Area at point C(in^2)\n", - "sB=(F1/Ae) #Bearing Stress in Link at C\n", - "\n", - "\n", - "#Result\n", - "print('Case(a): Shearing Stress in Pin A = %.1f psi' %tA)\n", - "print('Case(b): Shearing Stress in Pin C = %.f psi' %tC)\n", - "print('Case(c): Largest Normal Stress in Link ABC = %.f psi' %sA)\n", - "print('Case(d): Average Shearing Stress at B = %.f psi' %tB)\n", - "print('Case(e): Bearing Stress in Link at C = %.f psi' %sB)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Example 1.2, Page number 19" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Case(a): Diameter of the bolt = 28 mm\n", - "Case(a): Dimension b at Each End of the Bar = 62 mm\n", - "Case(a): Dimension h of the Bar = 34.300000 mm\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "#Variable declaration\n", - "P = 120 #Maximum allowable tension force \n", - "s = 175 #Maximum allowable stress\n", - "t = 100 #Maximum allowable stress\n", - "Sb = 350 #Maximum allowable stress\n", - "\n", - "\n", - "#Calculation\n", - "#Case(a)\n", - "F1=P/2 #Current(A)\n", - "d=math.sqrt(((P/2)*1000)/((22/(4*7))*(100000000))) #Diameter of bolt(m)\n", - "d=d*1000 #Diameter of bolt(mm)\n", - "d=round(d,0) #Rounding of the value of diameter of bolt(mm)\n", - "Ad=(0.020*0.028) #Area of cross section of plate \n", - "tb=((P*1000)/Ad)/(1000000) #Stress between between the 20-mm-thick plate and the 28-mm-diameter bolt\n", - "tb=round(tb,0) #Rounding of the above calculated stress to check if it is less than 350\n", - "a=(P/2)/((0.02)*(175)) #Dimension of cross section of ring \n", - "a=round(a,2) #Rounding dimension of cross section of ring to two decimal places\n", - "b=28 + (2*(a)) #Dimension b at Each End of the Bar\n", - "b=round(b,2) #Rounding the dimension b to two decimal places \n", - "h=(P)/((0.020)*(175)) #Dimension h of the Bar\n", - "h=round(h,1) #Rounding dimension h of bar to 1 decimal place\n", - "\n", - "\n", - "#Result\n", - "print ('Case(a): Diameter of the bolt = %.f mm' %d)\n", - "print ('Case(a): Dimension b at Each End of the Bar = %.f mm' %b)\n", - "print ('Case(a): Dimension h of the Bar = %f mm' %h)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Example 1.3, Page number 34" - ] - }, - { - "cell_type": "code", - "execution_count": 45, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Case(a): Diameter of the bolt = 16.730000 mm\n", - "Case(a): Dimension b at Each End of the Bar = 22.000000 mm\n", - "Case(a): Dimension h of the Bar = 6.000000 mm\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "#Variable declaration\n", - "Su = 600 #ultimate normal stress(MPa) \n", - "FS = 3.3 #Factor of safety with respect to failure\n", - "tU=350 #Ultimate shearing stress(MPa)\n", - "Cx=40 #X Component of reaction at C(kN)\n", - "Cy=65 #Y Component of reaction at C(kN)\n", - "Smax=300 #Allowable bearing stress of the steel \n", - "\n", - "#Calculation\n", - "C=math.sqrt((math.pow(40,2))+(math.pow(65,2)))\n", - "\n", - "#Case(a)\n", - "P=(15*0.6 + 50*0.3)/(0.6) #Allowable bearing stress of the steel(MPa)\n", - "Sall=(Su/FS) #Allowable Stress(MPa)\n", - "Sall=round(Sall,1) #Rounding Allowable stress to 1 decimal place(MPa)\n", - "Areqa=(P/(Sall*(1000))) #Cross Sectional area(m^2)\n", - "Areqa=round(Areqa,5) #Rounding cross sectional area to 5 decimal places(m^2)\n", - "dAB=math.sqrt(((Areqa)*(4))/(22/7)) #Diameter of AB(m)\n", - "dAB=dAB*1000 #Diameter of AB(mm)\n", - "dAB=round(dAB,2) #Rounding Diameter of AB(mm)\n", - "\n", - "#Case(b)\n", - "tALL=tU/FS #Stress(MPa)\n", - "tALL=round(tALL,1) #Rounding of Stress\n", - "AreqC=((C/2)/tALL) #Cross sectional area(m^2)\n", - "AreqC=AreqC*1000 \n", - "AreqC=round(AreqC,0) #Rounding the cross sectional area\n", - "dC=math.sqrt((4*AreqC)/(22/7)) #Diameter at point C\n", - "dC=round((dC+1),0) #Rounding of the diameter at C\n", - "\n", - "#Case(c)\n", - "\n", - "Areq=((C/2)/Smax) \n", - "Areq=Areq*1000 #Cross sectional area(mm^2)\n", - "t=(Areq/22) #Thickness of the bracket\n", - "t=round(t,0)\n", - "\n", - "#Result\n", - "print ('Case(a): Diameter of the bolt = % f mm' %dAB)\n", - "print ('Case(a): Dimension b at Each End of the Bar = % f mm' %dC)\n", - "print ('Case(a): Dimension h of the Bar = % f mm' %t)" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "collapsed": true - }, - "source": [ - "# Example 1.4, Page number 35" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Case(a): Control Rod = 5.263672 kips\n", - "Case(b): Bolt at B = 5.156250 kips\n", - "Case(c): Bolt at D = 6.865179 kips\n", - "Case(d): Bolt at C = 5.238095 kips\n", - "Summary. We have found separately four maximum allowable values of the force C. In order to satisfy all these criteria we must choose the smallest value, namely:= 5.156250 kips\n" - ] - } - ], - "source": [ - "import math\n", - "\n", - "#Variable declaration\n", - "tU=40 #ultimate tensile stress\n", - "sU=60 #ultimate shearing stress\n", - "FS=3 #Mimnimum factor of safety\n", - "dA=(7/16) #Diameter of bolt at A(in)\n", - "dB=3/8 #Diameter of bolt at B(in) \n", - "dD=3/8 #Diameter of bolt at D(in)\n", - "dC=1/2 #Diameter of bolt at C(in)\n", - "\n", - "\n", - "#Calculation\n", - "Sall=(sU/FS) #Total tensile stress(kips)\n", - "B=Sall*((1/4)*(22/7)*(pow((7/16),2))) #Allowable force in the control rod(kips)\n", - "C1=1.75*(B) #Control Rod(kips)\n", - "tall=(tU/FS) #Total shearing stress\n", - "B=2*(tall*(1/4)*(22/7)*(3/8)*(3/8)) #Allowable magnitude of the force B exerted on the bolt\n", - "C2=1.75*B #Bolt at B(kips) \n", - "D=B #Bolt at D. Since this bolt is the same as bolt B, the allowable force is same(kips) \n", - "C3=2.33*D #Bolt at D(kips)\n", - "C4=2*(tall*(1/4)*(22/7)*(1/2)*(1/2)) #Bolt at C(kips) \n", - "list1=[C1,C2,C3,C4] #Adding all the maximum allowable forces on C(kips) \n", - "\n", - "\n", - "#Result\n", - "print ('Case(a): Control Rod = % f kips' %C1)\n", - "print ('Case(b): Bolt at B = % f kips' %C2)\n", - "print ('Case(c): Bolt at D = % f kips' %C3)\n", - "print ('Case(d): Bolt at C = % f kips' %C4)\n", - "print ('Summary. We have found separately four maximum allowable values of the force C. In order to satisfy all these criteria we must choose the smallest value, namely:= % f kips' %min(list1));" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.5.1" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/SrutiGoyal/SrutiGoyal_version_backup/Chapter_11-_Object_Initialization.ipynb b/sample_notebooks/SrutiGoyal/SrutiGoyal_version_backup/Chapter_11-_Object_Initialization.ipynb new file mode 100755 index 00000000..d3bdda01 --- /dev/null +++ b/sample_notebooks/SrutiGoyal/SrutiGoyal_version_backup/Chapter_11-_Object_Initialization.ipynb @@ -0,0 +1,1779 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:64b755d597a2016634dadbbc81a598a60446119cc89f4f94fd9140b5bc077b77" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 11: Object Initialization and clean up" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example- bag.cpp, Page-392" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_ITEMS=25\n", + "def show(self):\n", + " for i in range(self.ItemCount):\n", + " print self._Bag__contents[i],\n", + "class Bag:\n", + " __contents=[int]*MAX_ITEMS\n", + " __ItemCount=int\n", + " def SetEmpty(self):\n", + " self.ItemCount=0\n", + " def put(self,item):\n", + " self._Bag__contents[self.ItemCount]=item\n", + " self.ItemCount+=1\n", + " show=show\n", + "bag=Bag() #object of class Bag\n", + "bag.SetEmpty() #initialize the object\n", + "while 1:\n", + " item=int(raw_input(\"\\nEnter Item Number to be put into the bag <0-no item>: \"))\n", + " if item==0:\n", + " break\n", + " bag.put(item)\n", + " print \"Items in bag:\",\n", + " bag.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Items in bag: 1" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag: 1 3" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag: 1 3 2" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag: 1 3 2 4" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example- newbag.cpp, Page-395" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_ITEMS=25 #size of array contents\n", + "def show(self):\n", + " for i in range(self.ItemCount):\n", + " print self._Bag__contents[i],\n", + "class Bag:\n", + " __contents=[int]*MAX_ITEMS #int 1D array\n", + " __ItemCount=int\n", + " def __init__(self): #Constructor\n", + " self.ItemCount=0\n", + " def put(self,item): #member function defined inside the class\n", + " self._Bag__contents[self.ItemCount]=item\n", + " self.ItemCount+=1\n", + " show=show #member function defined outside the class\n", + "bag=Bag() #object of class Bag\n", + "while 1:\n", + " item=int(raw_input(\"\\nEnter Item Number to be put into the bag <0-no item>: \"))\n", + " if item==0:\n", + " break\n", + " bag.put(item)\n", + " print \"Items in bag:\",\n", + " bag.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Items in bag: 1" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag: 1 3" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag: 1 3 2" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag: 1 3 2 4" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-test1.cpp, Page-396" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __init__(self):\n", + " print \"Constructor of class test called\"\n", + "class Test:\n", + " __init__=__init__ #Constructor\n", + "G=Test()\n", + "def func():\n", + " L=Test()\n", + " print \"Here's function func()\"\n", + "X=Test()\n", + "print \"main() function\"\n", + "func()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructor of class test called\n", + "Constructor of class test called\n", + "main() function\n", + "Constructor of class test called\n", + "Here's function func()\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example- giftbag.cpp, Page- 398" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX_ITEMS=25\n", + "def show(self):\n", + " if self.ItemCount:\n", + " for i in range(self.ItemCount):\n", + " print self._Bag__contents[i],\n", + " else:\n", + " print \"Nil\"\n", + "class Bag:\n", + " __contents=[int]*MAX_ITEMS\n", + " __ItemCount=int\n", + " def __init__(self, item=None): #parameterized constructor: Python does not support overloading of functions\n", + " if isinstance(item, int):\n", + " self._Bag__contents[0]=item\n", + " self.ItemCount=1\n", + " else:\n", + " self.ItemCount=0\n", + " def put(self,item):\n", + " self._Bag__contents[self.ItemCount]=item\n", + " self.ItemCount+=1\n", + " show=show\n", + "bag1=Bag()\n", + "bag2=Bag(4) #object created using the parameterized constructor\n", + "print \"Gifted bag1 initially has:\",\n", + "bag1.show()\n", + "print \"Gifted bag2 initially has:\",\n", + "bag2.show()\n", + "while 1:\n", + " item=int(raw_input(\"\\nEnter Item Number to be put into the bag <0-no item>: \"))\n", + " if item==0:\n", + " break\n", + " bag2.put(item)\n", + " print \"Items in bag2:\",\n", + " bag2.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Gifted bag1 initially has: Nil\n", + "Gifted bag2 initially has: 4" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag2: 4 1" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag2: 4 1 2" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Items in bag2: 4 1 2 3" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter Item Number to be put into the bag <0-no item>: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-test.cpp, Page-400 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __init__(self):\n", + " print \"Constructor of class Test called\"\n", + "def __del__(self):\n", + " print \"Destructor of class Test called\"\n", + "class Test:\n", + " __init__=__init__ #Constructor\n", + " __del__=__del__ #Destructor\n", + "x=Test()\n", + "print \"Terminating main\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructor of class Test called\n", + "Destructor of class Test called\n", + "Terminating main\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-count.cpp, Page-401" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "nobjects=0\n", + "nobj_alive=0\n", + "class MyClass:\n", + " def __init__(self):\n", + " global nobjects #using the global nobjects\n", + " global nobj_alive #using the global nobj_alive\n", + " nobjects+=1\n", + " nobj_alive+=1\n", + " def __del__(self):\n", + " global nobj_alive #using the global nobjects\n", + " nobj_alive-=1\n", + " def show(self):\n", + " global nobjects\n", + " global nobj_alive\n", + " print \"Total number of objects created: \", nobjects\n", + " print \"Number of objects currently alive: \", nobj_alive\n", + "obj1=MyClass()\n", + "obj1.show()\n", + "def func():\n", + " obj1=MyClass()\n", + " obj2=MyClass()\n", + " obj2.show()\n", + " del obj1\n", + " del obj2\n", + "func()\n", + "obj1.show()\n", + "obj2=MyClass()\n", + "obj3=MyClass()\n", + "obj2.show()\n", + "del obj1\n", + "del obj2\n", + "del obj3" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total number of objects created: 1\n", + "Number of objects currently alive: 1\n", + "Total number of objects created: 3\n", + "Number of objects currently alive: 3\n", + "Total number of objects created: 3\n", + "Number of objects currently alive: 1\n", + "Total number of objects created: 5\n", + "Number of objects currently alive: 3\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Example-account.cpp, Page- 403" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def MoneyTransfer(self, acc , amount):\n", + " self._AccClass__balance=self._AccClass__balance-amount\n", + " acc._AccClass__balance=acc._AccClass__balance + amount\n", + "class AccClass:\n", + " __accno=int\n", + " __balance=float\n", + " def __init__(self, an=None, bal=0.0):\n", + " if isinstance(an, int):\n", + " self.accno=an\n", + " self.__balance=bal\n", + " else:\n", + " self.accno=raw_input(\"Enter account number for acc1 object: \")\n", + " self.__balance=float(raw_input(\"Enter the balance: \"))\n", + " def display(self):\n", + " print \"Acoount number is: \", self.accno\n", + " print \"Balance is: \", self.__balance\n", + " MoneyTransfer=MoneyTransfer\n", + "acc1=AccClass()\n", + "acc2=AccClass(10)\n", + "acc3=AccClass(20, 750.5)\n", + "print \"Acoount information...\"\n", + "acc1.display()\n", + "acc2.display()\n", + "acc3.display()\n", + "trans_money=float(raw_input(\"How much money is to be transferred from acc3 to acc1: \"))\n", + "acc3.MoneyTransfer(acc1, trans_money)\n", + "print \"Updated information about accounts...\"\n", + "acc1.display()\n", + "acc2.display()\n", + "acc3.display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter account number for acc1 object: 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the balance: 100\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Acoount information...\n", + "Acoount number is: 1\n", + "Balance is: 100.0\n", + "Acoount number is: 10\n", + "Balance is: 0.0\n", + "Acoount number is: 20\n", + "Balance is: 750.5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How much money is to be transferred from acc3 to acc1: 200\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Updated information about accounts...\n", + "Acoount number is: 1\n", + "Balance is: 300.0\n", + "Acoount number is: 10\n", + "Balance is: 0.0\n", + "Acoount number is: 20\n", + "Balance is: 550.5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-test2.cpp. Page- 405" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __init__(self, NameIn=None):\n", + " if isinstance(NameIn, str):\n", + " self.name=NameIn\n", + " print \"Test Object \", NameIn, \" created\"\n", + " else:\n", + " self.name=\"unnamed\"\n", + " print \"Test object 'unnamed' created\"\n", + "def __del__(self):\n", + " print \"Test Object \", self.name, \" destroyed\"\n", + " del self.name\n", + "class Test:\n", + " __name=[str]\n", + " __init__=__init__\n", + " __del__=__del__\n", + "g=Test(\"global\")\n", + "def func():\n", + " l=Test(\"func\")\n", + " print \"here's function func()\"\n", + "x=Test(\"main\")\n", + "func()\n", + "print \"main() function - termination\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Test Object global created\n", + "Test Object global destroyed\n", + "Test Object main created\n", + "Test Object main destroyed\n", + "Test Object func created\n", + "here's function func()\n", + "Test Object func destroyed\n", + "main() function - termination\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-complex1.cpp, Page- 407" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "def add (self, c2):\n", + " temp=Complex()\n", + " temp._Complex__real=self._Complex__real+c2._Complex__real\n", + " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", + " return temp\n", + "class Complex:\n", + " __real=float\n", + " __imag=float\n", + " def __init__(self, real_in=None, imag_in=0.0):\n", + " if isinstance(real_in, float):\n", + " self.__real=real_in\n", + " self.__imag=imag_in\n", + " else:\n", + " self.__real=self.__imag=0.0\n", + " def show(self, msg):\n", + " print msg, \n", + " print self.__real,\n", + " if self.__imag<0:\n", + " print \"-i\",\n", + " else:\n", + " print \"+i\",\n", + " print math.fabs(self.__imag) #print absolute value\n", + " add=add\n", + "c1=Complex(1.5,2.0)\n", + "c2=Complex(2.2)\n", + "c3=Complex()\n", + "c1.show(\"c1=\")\n", + "c2.show(\"c2=\")\n", + "c3=c1.add(c2)\n", + "c3.show(\"c3=c1.add(c2):\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c1= 1.5 +i 2.0\n", + "c2= 2.2 +i 0.0\n", + "c3=c1.add(c2): 3.7 +i 2.0\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example- noname.cpp, Page- 410" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class nameless:\n", + " __a=int\n", + " def __init__(self):\n", + " print \"Constructor\"\n", + " def __del__(self):\n", + " print \"Destructor\"\n", + "nameless() #nameless object created\n", + "n1=nameless()\n", + "n2=nameless()\n", + "print \"Program terminates\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructor\n", + "Destructor\n", + "Constructor\n", + "Destructor\n", + "Constructor\n", + "Destructor\n", + "Program terminates\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-name.cpp, Page-411" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def show(self, msg):\n", + " print msg\n", + " print \"First Name: \", self._name__first\n", + " if self._name__middle[0]:\n", + " print \"Middle Name: \", self._name__middle\n", + " if self._name__last[0]:\n", + " print \"Last Name: \", self._name__last\n", + "class name:\n", + " __first=[None]*15\n", + " __middle=[None]*15\n", + " __last=[None]*15\n", + " def __init__(self, FirstName=None, MiddleName=None, LastName=None):\n", + " if isinstance(LastName, str):\n", + " self.__last=LastName\n", + " self.__middle=MiddleName\n", + " self.__first=FirstName\n", + " elif isinstance(MiddleName, str):\n", + " self.__middle=MiddleName\n", + " self.__first=FirstName\n", + " elif isinstance(FirstName, str):\n", + " self.__first=FirstName\n", + " else:\n", + " self.__last='\\0' #initialized to NULL\n", + " self.__middle='\\0'\n", + " self.__first='\\0'\n", + " show=show\n", + "n1=name()\n", + "n2=name()\n", + "n3=name()\n", + "n1=name(\"Rajkumar\")\n", + "n2=name(\"Savithri\", \"S\")\n", + "n3=name(\"Veugopal\", \"K\", \"R\")\n", + "n1.show(\"First prson details...\")\n", + "n2.show(\"Second prson details...\")\n", + "n3.show(\"Third prson details...\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "First prson details...\n", + "First Name: Rajkumar\n", + "Second prson details...\n", + "First Name: Savithri\n", + "Middle Name: S\n", + "Third prson details...\n", + "First Name: Veugopal\n", + "Middle Name: K\n", + "Last Name: R\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-vector1.cpp, Page-413" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def read(self):\n", + " for i in range(self._vector__sz):\n", + " print \"Enter vector [\", i, \"]? \",\n", + " self._vector__v[i]=int(raw_input())\n", + "def show_sum(self):\n", + " Sum=0\n", + " for i in range(self._vector__sz):\n", + " Sum+=self._vector__v[i]\n", + " print \"Vector sum= \", Sum\n", + "class vector:\n", + " __v=[int] #array of type integer\n", + " __sz=int\n", + " def __init__(self, size):\n", + " self.__sz= size\n", + " self.__v=[int]*size #dynamically allocating size to integer array\n", + " def __del__(self):\n", + " del self.__v\n", + " read=read\n", + " show_sum=show_sum\n", + "count = int\n", + "count=int(raw_input(\"How many elements are there in the vector: \"))\n", + "v1= vector(count)\n", + "v1.read()\n", + "v1.show_sum()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many elements are there in the vector: 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter vector [ 0 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter vector [ 1 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter vector [ 2 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter vector [ 3 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter vector [ 4 ]? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Vector sum= 15\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-vector2.cpp, Page-415" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def show(self):\n", + " for i in range(self._vector__size):\n", + " print self.elem(i), \", \",\n", + "class vector:\n", + " __v=[int]\n", + " __size=int\n", + " def __init__(self, vector_size):\n", + " if isinstance(vector_size, int):\n", + " self.__size= vector_size\n", + " self.__v=[int]*vector_size\n", + " else:\n", + " print \"Copy construcor invoked\"\n", + " self.__size=vector_size.__size\n", + " self.__v=[int]*vector_size.__size\n", + " for i in range(vector_size.__size):\n", + " self.__v[i]=vector_size.__v[i]\n", + " def elem(self,i):\n", + " if i>=self.__size:\n", + " print \"Error: Out of Range\"\n", + " return -1\n", + " return self.__v[i]\n", + " def __del__(self):\n", + " del self.__v\n", + " show=show\n", + "v1=vector(5)\n", + "v2=vector(5)\n", + "for i in range(5):\n", + " if v2.elem(i)!=-1:\n", + " v2._vector__v[i]=i+1\n", + "v1=v2\n", + "v3=vector(v2)\n", + "print \"Vector v1: \",\n", + "v1.show()\n", + "print \"\\nvector v2: \",\n", + "v2.show()\n", + "print \"\\nvector v3: \",\n", + "v3.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Copy construcor invoked\n", + "Vector v1: 1 , 2 , 3 , 4 , 5 , \n", + "vector v2: 1 , 2 , 3 , 4 , 5 , \n", + "vector v3: 1 , 2 , 3 , 4 , 5 , \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-matrix.cpp, Page-418" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "TRUE=1\n", + "FALSE=0\n", + "def __del__(self):\n", + " for i in range(self._matrix__MaxRow):\n", + " del self._matrix__p[i]\n", + " del self._matrix__p\n", + "def add(self, a, b):\n", + " self._matrix__MaxRow=a._matrix__MaxRow\n", + " self._matrix__MaxCol=a._matrix__MaxCol\n", + " if (a._matrix__MaxRow!=b._matrix__MaxRow)|(a._matrix__MaxCol!=b._matrix__MaxCol):\n", + " print \"Error: invalid matrix order for addition\"\n", + " return\n", + " for i in range(self._matrix__MaxRow):\n", + " for j in range(self._matrix__MaxCol):\n", + " self._matrix__p[i][j]=a._matrix__p[i][j]+b._matrix__p[i][j]\n", + "def sub(self, a, b):\n", + " self._matrix__MaxRow=a._matrix__MaxRow\n", + " self._matrix__MaxCol=a._matrix__MaxCol\n", + " if (a._matrix__MaxRow!=b._matrix__MaxRow)|(a._matrix__MaxCol!=b._matrix__MaxCol):\n", + " print \"Error: invalid matrix order for subtraction\"\n", + " return\n", + " for i in range(self._matrix__MaxRow):\n", + " for j in range(self._matrix__MaxCol):\n", + " self._matrix__p[i][j]=a._matrix__p[i][j]-b._matrix__p[i][j]\n", + "def mul(self, a, b):\n", + " self._matrix__MaxRow=a._matrix__MaxRow\n", + " self._matrix__MaxCol=a._matrix__MaxCol\n", + " if (a._matrix__MaxCol!=b._matrix__MaxRow):\n", + " print \"Error: invalid matrix order for multiplication\"\n", + " return\n", + " for i in range(a._matrix__MaxRow):\n", + " for j in range(b._matrix__MaxCol):\n", + " self._matrix__p[i][j]=0\n", + " for k in range(a._matrix__MaxCol):\n", + " self._matrix__p[i][j]+=a._matrix__p[i][j]*b._matrix__p[i][j]\n", + "def eql(self, b):\n", + " for i in range(self._matrix__MaxRow):\n", + " for j in range(self._matrix__MaxCol):\n", + " if self._matrix__p[i][i]!=b._matrix__p[i][j]:\n", + " return 0\n", + " return 1\n", + "def read(self):\n", + " for i in range(self._matrix__MaxRow):\n", + " for j in range(self._matrix__MaxCol):\n", + " print \"Matrix[\", i, \",\",j,\"] =? \",\n", + " self._matrix__p[i][j]=int(raw_input())\n", + "def show(self):\n", + " for i in range(self._matrix__MaxRow):\n", + " for j in range(self._matrix__MaxCol):\n", + " print self._matrix__p[i][j], \" \",\n", + " print \"\"\n", + "class matrix:\n", + " __MaxRow=int\n", + " __MaxCol=int\n", + " __p=[int]\n", + " def __init__(self, row=0, col=0):\n", + " self.__MaxRow=row\n", + " self.__MaxCol=col\n", + " if row>0:\n", + " self.__p=[[int]*self.__MaxCol]*self.__MaxRow\n", + " __del__=__del__\n", + " read=read\n", + " show=show\n", + " add=add\n", + " sub=sub\n", + " mul=mul\n", + " eql=eql\n", + "print \"Enter Matrix A details...\"\n", + "m=int(raw_input(\"How many rows? \"))\n", + "n=int(raw_input(\"How many columns? \"))\n", + "a=matrix(m,n)\n", + "a.read()\n", + "print \"Enter Matrix B details...\"\n", + "p=int(raw_input(\"How many rows? \"))\n", + "q=int(raw_input(\"How many columns? \"))\n", + "b=matrix(p,q)\n", + "b.read()\n", + "print \"Matrix A is...\"\n", + "a.show()\n", + "print \"Matrix B is...\"\n", + "b.show()\n", + "c=matrix(m,n)\n", + "c.add(a,b)\n", + "print \"C=A+B...\"\n", + "c.show()\n", + "d=matrix(m,n)\n", + "d.sub(a,b)\n", + "print \"D=A-B...\"\n", + "d.show()\n", + "e=matrix(m,q)\n", + "e.mul(a,b)\n", + "print \"E=A*B...\"\n", + "e.show()\n", + "print \"(Is matrix A equal to matrix B)? \",\n", + "if(a.eql(b)):\n", + " print \"Yes\"\n", + "else:\n", + " print \"No\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Matrix A details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many rows? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many columns? 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Matrix[ 0 , 0 ] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 0 , 1 ] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 0 , 2 ] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 1 , 0 ] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 1 , 1 ] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 1 , 2 ] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 2 , 0 ] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 2 , 1 ] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 2 , 2 ] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Matrix B details...\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many rows? 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many columns? 3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Matrix[ 0 , 0 ] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 0 , 1 ] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 0 , 2 ] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 1 , 0 ] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 1 , 1 ] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 1 , 2 ] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 2 , 0 ] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 2 , 1 ] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix[ 2 , 2 ] =? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Matrix A is...\n", + "2 2 2 \n", + "2 2 2 \n", + "2 2 2 \n", + "Matrix B is...\n", + "1 1 1 \n", + "1 1 1 \n", + "1 1 1 \n", + "C=A+B...\n", + "3 3 3 \n", + "3 3 3 \n", + "3 3 3 \n", + "D=A-B...\n", + "1 1 1 \n", + "1 1 1 \n", + "1 1 1 \n", + "E=A*B...\n", + "6 6 6 \n", + "6 6 6 \n", + "6 6 6 \n", + "(Is matrix A equal to matrix B)? No\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-person.cpp, Page-423" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __init__(self, NameIn, AddressIn, PhoneIn):\n", + " self._Person__name=NameIn\n", + " self._Person__address=AddressIn\n", + " self._Person__phone=PhoneIn\n", + "#inline\n", + "def __del__(self):\n", + " del self._Person__name\n", + " del self._Person__address\n", + " del self._Person__phone\n", + "def getname(self):\n", + " return self._Person__name\n", + "def getaddress(self):\n", + " return self._Person__address\n", + "def getphone(self):\n", + " return self._Person__phone\n", + "def changename(self, NameIn):\n", + " if(self._Person__name):\n", + " del self._Person__name\n", + " self._Person__name=NameIn\n", + "class Person:\n", + " __name=[str]\n", + " __address=[str]\n", + " __phone=[str]\n", + " __init__=__init__\n", + " __del__=__del__\n", + " getname=getname\n", + " getaddress=getaddress\n", + " getphone=getphone\n", + " changename=changename\n", + "def printperson(p):\n", + " if(p.getname()):\n", + " print \"Name: \", p.getname()\n", + " if(p.getaddress()):\n", + " print \"Address: \", p.getaddress()\n", + " if(p.getphone()):\n", + " print \"Phone: \", p.getphone()\n", + "me=Person(\"Rajkumar\", \"E-mail: raj@cdabc.erne.in\", \"91-080-5584271\")\n", + "printperson(me)\n", + "you=Person(\"XYZ\", \"-not sure-\", \"-not sure-\")\n", + "print \"You XYZ by default...\"\n", + "printperson(you)\n", + "you.changename(\"ABC\")\n", + "print \"You changed XYZ to ABC...\"\n", + "printperson(you)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: Rajkumar\n", + "Address: E-mail: raj@cdabc.erne.in\n", + "Phone: 91-080-5584271\n", + "You XYZ by default...\n", + "Name: XYZ\n", + "Address: -not sure-\n", + "Phone: -not sure-\n", + "You changed XYZ to ABC...\n", + "Name: ABC\n", + "Address: -not sure-\n", + "Phone: -not sure-\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example-graph.cpp, Page-425" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def __init__(self):\n", + " if(self._Graphics__nobjects[0]==False):\n", + " self._Graphics__setgraphicsmode()\n", + " self._Graphics__nobjects[0]+=1\n", + "def __del__(self):\n", + " self._Graphics__nobjects[0]-=1\n", + " if(self._Graphics__nobjects[0]==False):\n", + " self._Graphics__settextmode()\n", + "class Graphics:\n", + " __nobjects=[0]\n", + " def __setgraphicsmode(self):\n", + " pass\n", + " def __settextmode(self):\n", + " pass\n", + " __init__=__init__\n", + " __del__=__del__\n", + " def getcount(self):\n", + " return self.__nobjects[0]\n", + "def my_func():\n", + " obj=Graphics()\n", + " print \"No. of Graphics' objects while in my_func=\", obj.getcount()\n", + "obj1=Graphics()\n", + "print \"No. of Graphics' objects before in my_func=\", obj1.getcount()\n", + "my_func()\n", + "print \"No. of Graphics' objects after in my_func=\", obj1.getcount()\n", + "obj2=Graphics()\n", + "obj3=Graphics()\n", + "obj4=Graphics()\n", + "print \"Value of static member nobjects after all 3 more objects...\"\n", + "print \"In obj1= \", obj1.getcount()\n", + "print \"In obj2= \", obj2.getcount()\n", + "print \"In obj3= \", obj3.getcount()\n", + "print \"In obj4= \", obj4.getcount()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No. of Graphics' objects before in my_func= 1\n", + "No. of Graphics' objects while in my_func= 2\n", + "No. of Graphics' objects after in my_func= 1\n", + "Value of static member nobjects after all 3 more objects...\n", + "In obj1= 4\n", + "In obj2= 4\n", + "In obj3= 4\n", + "In obj4= 4\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example Page-428" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def distance(self, a, b):\n", + " self.x=a.x-b.x\n", + " self.y=a.y-b.y\n", + "def display(self):\n", + " print \"x= \",self.x\n", + " print \"y= \", self.y\n", + "class point:\n", + " __x=int\n", + " __y=int\n", + " def __init__(self, a=None, b=None):\n", + " if isinstance(a, int):\n", + " self.x=a\n", + " self.y=b\n", + " else:\n", + " self.x=self.y=0\n", + " def __del__(self):\n", + " pass\n", + " distance=distance\n", + " display=display\n", + "p1=point(40,18)\n", + "p2=point(12,9)\n", + "p3=point()\n", + "p3.distance(p1,p2)\n", + "print \"Coordinates of P1: \"\n", + "p1.display()\n", + "print \"Coordinates of P2: \"\n", + "p2.display()\n", + "print \"distance between P1 and P2: \"\n", + "p3.display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Coordinates of P1: \n", + "x= 40\n", + "y= 18\n", + "Coordinates of P2: \n", + "x= 12\n", + "y= 9\n", + "distance between P1 and P2: \n", + "x= 28\n", + "y= 9\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example Page-430" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def display(self):\n", + " print \"a =\", self.a,\n", + " print \"b =\", self.b\n", + "class data:\n", + " __a=int\n", + " __b=float\n", + " def __init__(self, x=None, y=None):\n", + " if isinstance(x, int):\n", + " self.a=x\n", + " self.b=y\n", + " elif isinstance(x, data):\n", + " self.a=x.a\n", + " self.b=x.b\n", + " else:\n", + " self.a=0\n", + " self.b=0\n", + " display=display\n", + "d1=data()\n", + "d2=data(12,9.9)\n", + "d3=data(d2)\n", + "print \"For default constructor: \"\n", + "d1.display()\n", + "print\"For parameterized constructor: \"\n", + "d2.display()\n", + "print \"For Copy Constructor: \"\n", + "d3.display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "For default constructor: \n", + "a = 0 b = 0\n", + "For parameterized constructor: \n", + "a = 12 b = 9.9\n", + "For Copy Constructor: \n", + "a = 12 b = 9.9\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/SrutiGoyal/SrutiGoyal_version_backup/Chapter_11-_Object_Initialization_and.ipynb b/sample_notebooks/SrutiGoyal/SrutiGoyal_version_backup/Chapter_11-_Object_Initialization_and.ipynb deleted file mode 100755 index d3bdda01..00000000 --- a/sample_notebooks/SrutiGoyal/SrutiGoyal_version_backup/Chapter_11-_Object_Initialization_and.ipynb +++ /dev/null @@ -1,1779 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:64b755d597a2016634dadbbc81a598a60446119cc89f4f94fd9140b5bc077b77" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 11: Object Initialization and clean up" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example- bag.cpp, Page-392" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_ITEMS=25\n", - "def show(self):\n", - " for i in range(self.ItemCount):\n", - " print self._Bag__contents[i],\n", - "class Bag:\n", - " __contents=[int]*MAX_ITEMS\n", - " __ItemCount=int\n", - " def SetEmpty(self):\n", - " self.ItemCount=0\n", - " def put(self,item):\n", - " self._Bag__contents[self.ItemCount]=item\n", - " self.ItemCount+=1\n", - " show=show\n", - "bag=Bag() #object of class Bag\n", - "bag.SetEmpty() #initialize the object\n", - "while 1:\n", - " item=int(raw_input(\"\\nEnter Item Number to be put into the bag <0-no item>: \"))\n", - " if item==0:\n", - " break\n", - " bag.put(item)\n", - " print \"Items in bag:\",\n", - " bag.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Items in bag: 1" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag: 1 3" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag: 1 3 2" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag: 1 3 2 4" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example- newbag.cpp, Page-395" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_ITEMS=25 #size of array contents\n", - "def show(self):\n", - " for i in range(self.ItemCount):\n", - " print self._Bag__contents[i],\n", - "class Bag:\n", - " __contents=[int]*MAX_ITEMS #int 1D array\n", - " __ItemCount=int\n", - " def __init__(self): #Constructor\n", - " self.ItemCount=0\n", - " def put(self,item): #member function defined inside the class\n", - " self._Bag__contents[self.ItemCount]=item\n", - " self.ItemCount+=1\n", - " show=show #member function defined outside the class\n", - "bag=Bag() #object of class Bag\n", - "while 1:\n", - " item=int(raw_input(\"\\nEnter Item Number to be put into the bag <0-no item>: \"))\n", - " if item==0:\n", - " break\n", - " bag.put(item)\n", - " print \"Items in bag:\",\n", - " bag.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Items in bag: 1" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag: 1 3" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag: 1 3 2" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag: 1 3 2 4" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-test1.cpp, Page-396" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __init__(self):\n", - " print \"Constructor of class test called\"\n", - "class Test:\n", - " __init__=__init__ #Constructor\n", - "G=Test()\n", - "def func():\n", - " L=Test()\n", - " print \"Here's function func()\"\n", - "X=Test()\n", - "print \"main() function\"\n", - "func()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Constructor of class test called\n", - "Constructor of class test called\n", - "main() function\n", - "Constructor of class test called\n", - "Here's function func()\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example- giftbag.cpp, Page- 398" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "MAX_ITEMS=25\n", - "def show(self):\n", - " if self.ItemCount:\n", - " for i in range(self.ItemCount):\n", - " print self._Bag__contents[i],\n", - " else:\n", - " print \"Nil\"\n", - "class Bag:\n", - " __contents=[int]*MAX_ITEMS\n", - " __ItemCount=int\n", - " def __init__(self, item=None): #parameterized constructor: Python does not support overloading of functions\n", - " if isinstance(item, int):\n", - " self._Bag__contents[0]=item\n", - " self.ItemCount=1\n", - " else:\n", - " self.ItemCount=0\n", - " def put(self,item):\n", - " self._Bag__contents[self.ItemCount]=item\n", - " self.ItemCount+=1\n", - " show=show\n", - "bag1=Bag()\n", - "bag2=Bag(4) #object created using the parameterized constructor\n", - "print \"Gifted bag1 initially has:\",\n", - "bag1.show()\n", - "print \"Gifted bag2 initially has:\",\n", - "bag2.show()\n", - "while 1:\n", - " item=int(raw_input(\"\\nEnter Item Number to be put into the bag <0-no item>: \"))\n", - " if item==0:\n", - " break\n", - " bag2.put(item)\n", - " print \"Items in bag2:\",\n", - " bag2.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Gifted bag1 initially has: Nil\n", - "Gifted bag2 initially has: 4" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag2: 4 1" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag2: 4 1 2" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Items in bag2: 4 1 2 3" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "Enter Item Number to be put into the bag <0-no item>: 0\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-test.cpp, Page-400 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __init__(self):\n", - " print \"Constructor of class Test called\"\n", - "def __del__(self):\n", - " print \"Destructor of class Test called\"\n", - "class Test:\n", - " __init__=__init__ #Constructor\n", - " __del__=__del__ #Destructor\n", - "x=Test()\n", - "print \"Terminating main\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Constructor of class Test called\n", - "Destructor of class Test called\n", - "Terminating main\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-count.cpp, Page-401" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "nobjects=0\n", - "nobj_alive=0\n", - "class MyClass:\n", - " def __init__(self):\n", - " global nobjects #using the global nobjects\n", - " global nobj_alive #using the global nobj_alive\n", - " nobjects+=1\n", - " nobj_alive+=1\n", - " def __del__(self):\n", - " global nobj_alive #using the global nobjects\n", - " nobj_alive-=1\n", - " def show(self):\n", - " global nobjects\n", - " global nobj_alive\n", - " print \"Total number of objects created: \", nobjects\n", - " print \"Number of objects currently alive: \", nobj_alive\n", - "obj1=MyClass()\n", - "obj1.show()\n", - "def func():\n", - " obj1=MyClass()\n", - " obj2=MyClass()\n", - " obj2.show()\n", - " del obj1\n", - " del obj2\n", - "func()\n", - "obj1.show()\n", - "obj2=MyClass()\n", - "obj3=MyClass()\n", - "obj2.show()\n", - "del obj1\n", - "del obj2\n", - "del obj3" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Total number of objects created: 1\n", - "Number of objects currently alive: 1\n", - "Total number of objects created: 3\n", - "Number of objects currently alive: 3\n", - "Total number of objects created: 3\n", - "Number of objects currently alive: 1\n", - "Total number of objects created: 5\n", - "Number of objects currently alive: 3\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Example-account.cpp, Page- 403" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def MoneyTransfer(self, acc , amount):\n", - " self._AccClass__balance=self._AccClass__balance-amount\n", - " acc._AccClass__balance=acc._AccClass__balance + amount\n", - "class AccClass:\n", - " __accno=int\n", - " __balance=float\n", - " def __init__(self, an=None, bal=0.0):\n", - " if isinstance(an, int):\n", - " self.accno=an\n", - " self.__balance=bal\n", - " else:\n", - " self.accno=raw_input(\"Enter account number for acc1 object: \")\n", - " self.__balance=float(raw_input(\"Enter the balance: \"))\n", - " def display(self):\n", - " print \"Acoount number is: \", self.accno\n", - " print \"Balance is: \", self.__balance\n", - " MoneyTransfer=MoneyTransfer\n", - "acc1=AccClass()\n", - "acc2=AccClass(10)\n", - "acc3=AccClass(20, 750.5)\n", - "print \"Acoount information...\"\n", - "acc1.display()\n", - "acc2.display()\n", - "acc3.display()\n", - "trans_money=float(raw_input(\"How much money is to be transferred from acc3 to acc1: \"))\n", - "acc3.MoneyTransfer(acc1, trans_money)\n", - "print \"Updated information about accounts...\"\n", - "acc1.display()\n", - "acc2.display()\n", - "acc3.display()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter account number for acc1 object: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter the balance: 100\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Acoount information...\n", - "Acoount number is: 1\n", - "Balance is: 100.0\n", - "Acoount number is: 10\n", - "Balance is: 0.0\n", - "Acoount number is: 20\n", - "Balance is: 750.5\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How much money is to be transferred from acc3 to acc1: 200\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Updated information about accounts...\n", - "Acoount number is: 1\n", - "Balance is: 300.0\n", - "Acoount number is: 10\n", - "Balance is: 0.0\n", - "Acoount number is: 20\n", - "Balance is: 550.5\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-test2.cpp. Page- 405" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __init__(self, NameIn=None):\n", - " if isinstance(NameIn, str):\n", - " self.name=NameIn\n", - " print \"Test Object \", NameIn, \" created\"\n", - " else:\n", - " self.name=\"unnamed\"\n", - " print \"Test object 'unnamed' created\"\n", - "def __del__(self):\n", - " print \"Test Object \", self.name, \" destroyed\"\n", - " del self.name\n", - "class Test:\n", - " __name=[str]\n", - " __init__=__init__\n", - " __del__=__del__\n", - "g=Test(\"global\")\n", - "def func():\n", - " l=Test(\"func\")\n", - " print \"here's function func()\"\n", - "x=Test(\"main\")\n", - "func()\n", - "print \"main() function - termination\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Test Object global created\n", - "Test Object global destroyed\n", - "Test Object main created\n", - "Test Object main destroyed\n", - "Test Object func created\n", - "here's function func()\n", - "Test Object func destroyed\n", - "main() function - termination\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-complex1.cpp, Page- 407" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "def add (self, c2):\n", - " temp=Complex()\n", - " temp._Complex__real=self._Complex__real+c2._Complex__real\n", - " temp._Complex__imag=self._Complex__imag+c2._Complex__imag\n", - " return temp\n", - "class Complex:\n", - " __real=float\n", - " __imag=float\n", - " def __init__(self, real_in=None, imag_in=0.0):\n", - " if isinstance(real_in, float):\n", - " self.__real=real_in\n", - " self.__imag=imag_in\n", - " else:\n", - " self.__real=self.__imag=0.0\n", - " def show(self, msg):\n", - " print msg, \n", - " print self.__real,\n", - " if self.__imag<0:\n", - " print \"-i\",\n", - " else:\n", - " print \"+i\",\n", - " print math.fabs(self.__imag) #print absolute value\n", - " add=add\n", - "c1=Complex(1.5,2.0)\n", - "c2=Complex(2.2)\n", - "c3=Complex()\n", - "c1.show(\"c1=\")\n", - "c2.show(\"c2=\")\n", - "c3=c1.add(c2)\n", - "c3.show(\"c3=c1.add(c2):\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "c1= 1.5 +i 2.0\n", - "c2= 2.2 +i 0.0\n", - "c3=c1.add(c2): 3.7 +i 2.0\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example- noname.cpp, Page- 410" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class nameless:\n", - " __a=int\n", - " def __init__(self):\n", - " print \"Constructor\"\n", - " def __del__(self):\n", - " print \"Destructor\"\n", - "nameless() #nameless object created\n", - "n1=nameless()\n", - "n2=nameless()\n", - "print \"Program terminates\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Constructor\n", - "Destructor\n", - "Constructor\n", - "Destructor\n", - "Constructor\n", - "Destructor\n", - "Program terminates\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-name.cpp, Page-411" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def show(self, msg):\n", - " print msg\n", - " print \"First Name: \", self._name__first\n", - " if self._name__middle[0]:\n", - " print \"Middle Name: \", self._name__middle\n", - " if self._name__last[0]:\n", - " print \"Last Name: \", self._name__last\n", - "class name:\n", - " __first=[None]*15\n", - " __middle=[None]*15\n", - " __last=[None]*15\n", - " def __init__(self, FirstName=None, MiddleName=None, LastName=None):\n", - " if isinstance(LastName, str):\n", - " self.__last=LastName\n", - " self.__middle=MiddleName\n", - " self.__first=FirstName\n", - " elif isinstance(MiddleName, str):\n", - " self.__middle=MiddleName\n", - " self.__first=FirstName\n", - " elif isinstance(FirstName, str):\n", - " self.__first=FirstName\n", - " else:\n", - " self.__last='\\0' #initialized to NULL\n", - " self.__middle='\\0'\n", - " self.__first='\\0'\n", - " show=show\n", - "n1=name()\n", - "n2=name()\n", - "n3=name()\n", - "n1=name(\"Rajkumar\")\n", - "n2=name(\"Savithri\", \"S\")\n", - "n3=name(\"Veugopal\", \"K\", \"R\")\n", - "n1.show(\"First prson details...\")\n", - "n2.show(\"Second prson details...\")\n", - "n3.show(\"Third prson details...\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "First prson details...\n", - "First Name: Rajkumar\n", - "Second prson details...\n", - "First Name: Savithri\n", - "Middle Name: S\n", - "Third prson details...\n", - "First Name: Veugopal\n", - "Middle Name: K\n", - "Last Name: R\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-vector1.cpp, Page-413" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def read(self):\n", - " for i in range(self._vector__sz):\n", - " print \"Enter vector [\", i, \"]? \",\n", - " self._vector__v[i]=int(raw_input())\n", - "def show_sum(self):\n", - " Sum=0\n", - " for i in range(self._vector__sz):\n", - " Sum+=self._vector__v[i]\n", - " print \"Vector sum= \", Sum\n", - "class vector:\n", - " __v=[int] #array of type integer\n", - " __sz=int\n", - " def __init__(self, size):\n", - " self.__sz= size\n", - " self.__v=[int]*size #dynamically allocating size to integer array\n", - " def __del__(self):\n", - " del self.__v\n", - " read=read\n", - " show_sum=show_sum\n", - "count = int\n", - "count=int(raw_input(\"How many elements are there in the vector: \"))\n", - "v1= vector(count)\n", - "v1.read()\n", - "v1.show_sum()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many elements are there in the vector: 5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter vector [ 0 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter vector [ 1 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter vector [ 2 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter vector [ 3 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter vector [ 4 ]? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Vector sum= 15\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-vector2.cpp, Page-415" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def show(self):\n", - " for i in range(self._vector__size):\n", - " print self.elem(i), \", \",\n", - "class vector:\n", - " __v=[int]\n", - " __size=int\n", - " def __init__(self, vector_size):\n", - " if isinstance(vector_size, int):\n", - " self.__size= vector_size\n", - " self.__v=[int]*vector_size\n", - " else:\n", - " print \"Copy construcor invoked\"\n", - " self.__size=vector_size.__size\n", - " self.__v=[int]*vector_size.__size\n", - " for i in range(vector_size.__size):\n", - " self.__v[i]=vector_size.__v[i]\n", - " def elem(self,i):\n", - " if i>=self.__size:\n", - " print \"Error: Out of Range\"\n", - " return -1\n", - " return self.__v[i]\n", - " def __del__(self):\n", - " del self.__v\n", - " show=show\n", - "v1=vector(5)\n", - "v2=vector(5)\n", - "for i in range(5):\n", - " if v2.elem(i)!=-1:\n", - " v2._vector__v[i]=i+1\n", - "v1=v2\n", - "v3=vector(v2)\n", - "print \"Vector v1: \",\n", - "v1.show()\n", - "print \"\\nvector v2: \",\n", - "v2.show()\n", - "print \"\\nvector v3: \",\n", - "v3.show()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Copy construcor invoked\n", - "Vector v1: 1 , 2 , 3 , 4 , 5 , \n", - "vector v2: 1 , 2 , 3 , 4 , 5 , \n", - "vector v3: 1 , 2 , 3 , 4 , 5 , \n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-matrix.cpp, Page-418" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "TRUE=1\n", - "FALSE=0\n", - "def __del__(self):\n", - " for i in range(self._matrix__MaxRow):\n", - " del self._matrix__p[i]\n", - " del self._matrix__p\n", - "def add(self, a, b):\n", - " self._matrix__MaxRow=a._matrix__MaxRow\n", - " self._matrix__MaxCol=a._matrix__MaxCol\n", - " if (a._matrix__MaxRow!=b._matrix__MaxRow)|(a._matrix__MaxCol!=b._matrix__MaxCol):\n", - " print \"Error: invalid matrix order for addition\"\n", - " return\n", - " for i in range(self._matrix__MaxRow):\n", - " for j in range(self._matrix__MaxCol):\n", - " self._matrix__p[i][j]=a._matrix__p[i][j]+b._matrix__p[i][j]\n", - "def sub(self, a, b):\n", - " self._matrix__MaxRow=a._matrix__MaxRow\n", - " self._matrix__MaxCol=a._matrix__MaxCol\n", - " if (a._matrix__MaxRow!=b._matrix__MaxRow)|(a._matrix__MaxCol!=b._matrix__MaxCol):\n", - " print \"Error: invalid matrix order for subtraction\"\n", - " return\n", - " for i in range(self._matrix__MaxRow):\n", - " for j in range(self._matrix__MaxCol):\n", - " self._matrix__p[i][j]=a._matrix__p[i][j]-b._matrix__p[i][j]\n", - "def mul(self, a, b):\n", - " self._matrix__MaxRow=a._matrix__MaxRow\n", - " self._matrix__MaxCol=a._matrix__MaxCol\n", - " if (a._matrix__MaxCol!=b._matrix__MaxRow):\n", - " print \"Error: invalid matrix order for multiplication\"\n", - " return\n", - " for i in range(a._matrix__MaxRow):\n", - " for j in range(b._matrix__MaxCol):\n", - " self._matrix__p[i][j]=0\n", - " for k in range(a._matrix__MaxCol):\n", - " self._matrix__p[i][j]+=a._matrix__p[i][j]*b._matrix__p[i][j]\n", - "def eql(self, b):\n", - " for i in range(self._matrix__MaxRow):\n", - " for j in range(self._matrix__MaxCol):\n", - " if self._matrix__p[i][i]!=b._matrix__p[i][j]:\n", - " return 0\n", - " return 1\n", - "def read(self):\n", - " for i in range(self._matrix__MaxRow):\n", - " for j in range(self._matrix__MaxCol):\n", - " print \"Matrix[\", i, \",\",j,\"] =? \",\n", - " self._matrix__p[i][j]=int(raw_input())\n", - "def show(self):\n", - " for i in range(self._matrix__MaxRow):\n", - " for j in range(self._matrix__MaxCol):\n", - " print self._matrix__p[i][j], \" \",\n", - " print \"\"\n", - "class matrix:\n", - " __MaxRow=int\n", - " __MaxCol=int\n", - " __p=[int]\n", - " def __init__(self, row=0, col=0):\n", - " self.__MaxRow=row\n", - " self.__MaxCol=col\n", - " if row>0:\n", - " self.__p=[[int]*self.__MaxCol]*self.__MaxRow\n", - " __del__=__del__\n", - " read=read\n", - " show=show\n", - " add=add\n", - " sub=sub\n", - " mul=mul\n", - " eql=eql\n", - "print \"Enter Matrix A details...\"\n", - "m=int(raw_input(\"How many rows? \"))\n", - "n=int(raw_input(\"How many columns? \"))\n", - "a=matrix(m,n)\n", - "a.read()\n", - "print \"Enter Matrix B details...\"\n", - "p=int(raw_input(\"How many rows? \"))\n", - "q=int(raw_input(\"How many columns? \"))\n", - "b=matrix(p,q)\n", - "b.read()\n", - "print \"Matrix A is...\"\n", - "a.show()\n", - "print \"Matrix B is...\"\n", - "b.show()\n", - "c=matrix(m,n)\n", - "c.add(a,b)\n", - "print \"C=A+B...\"\n", - "c.show()\n", - "d=matrix(m,n)\n", - "d.sub(a,b)\n", - "print \"D=A-B...\"\n", - "d.show()\n", - "e=matrix(m,q)\n", - "e.mul(a,b)\n", - "print \"E=A*B...\"\n", - "e.show()\n", - "print \"(Is matrix A equal to matrix B)? \",\n", - "if(a.eql(b)):\n", - " print \"Yes\"\n", - "else:\n", - " print \"No\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter Matrix A details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many rows? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many columns? 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Matrix[ 0 , 0 ] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 0 , 1 ] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 0 , 2 ] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 1 , 0 ] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 1 , 1 ] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 1 , 2 ] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 2 , 0 ] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 2 , 1 ] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 2 , 2 ] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Enter Matrix B details...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many rows? 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "How many columns? 3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Matrix[ 0 , 0 ] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 0 , 1 ] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 0 , 2 ] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 1 , 0 ] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 1 , 1 ] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 1 , 2 ] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 2 , 0 ] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 2 , 1 ] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix[ 2 , 2 ] =? " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " Matrix A is...\n", - "2 2 2 \n", - "2 2 2 \n", - "2 2 2 \n", - "Matrix B is...\n", - "1 1 1 \n", - "1 1 1 \n", - "1 1 1 \n", - "C=A+B...\n", - "3 3 3 \n", - "3 3 3 \n", - "3 3 3 \n", - "D=A-B...\n", - "1 1 1 \n", - "1 1 1 \n", - "1 1 1 \n", - "E=A*B...\n", - "6 6 6 \n", - "6 6 6 \n", - "6 6 6 \n", - "(Is matrix A equal to matrix B)? No\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-person.cpp, Page-423" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __init__(self, NameIn, AddressIn, PhoneIn):\n", - " self._Person__name=NameIn\n", - " self._Person__address=AddressIn\n", - " self._Person__phone=PhoneIn\n", - "#inline\n", - "def __del__(self):\n", - " del self._Person__name\n", - " del self._Person__address\n", - " del self._Person__phone\n", - "def getname(self):\n", - " return self._Person__name\n", - "def getaddress(self):\n", - " return self._Person__address\n", - "def getphone(self):\n", - " return self._Person__phone\n", - "def changename(self, NameIn):\n", - " if(self._Person__name):\n", - " del self._Person__name\n", - " self._Person__name=NameIn\n", - "class Person:\n", - " __name=[str]\n", - " __address=[str]\n", - " __phone=[str]\n", - " __init__=__init__\n", - " __del__=__del__\n", - " getname=getname\n", - " getaddress=getaddress\n", - " getphone=getphone\n", - " changename=changename\n", - "def printperson(p):\n", - " if(p.getname()):\n", - " print \"Name: \", p.getname()\n", - " if(p.getaddress()):\n", - " print \"Address: \", p.getaddress()\n", - " if(p.getphone()):\n", - " print \"Phone: \", p.getphone()\n", - "me=Person(\"Rajkumar\", \"E-mail: raj@cdabc.erne.in\", \"91-080-5584271\")\n", - "printperson(me)\n", - "you=Person(\"XYZ\", \"-not sure-\", \"-not sure-\")\n", - "print \"You XYZ by default...\"\n", - "printperson(you)\n", - "you.changename(\"ABC\")\n", - "print \"You changed XYZ to ABC...\"\n", - "printperson(you)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Name: Rajkumar\n", - "Address: E-mail: raj@cdabc.erne.in\n", - "Phone: 91-080-5584271\n", - "You XYZ by default...\n", - "Name: XYZ\n", - "Address: -not sure-\n", - "Phone: -not sure-\n", - "You changed XYZ to ABC...\n", - "Name: ABC\n", - "Address: -not sure-\n", - "Phone: -not sure-\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example-graph.cpp, Page-425" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def __init__(self):\n", - " if(self._Graphics__nobjects[0]==False):\n", - " self._Graphics__setgraphicsmode()\n", - " self._Graphics__nobjects[0]+=1\n", - "def __del__(self):\n", - " self._Graphics__nobjects[0]-=1\n", - " if(self._Graphics__nobjects[0]==False):\n", - " self._Graphics__settextmode()\n", - "class Graphics:\n", - " __nobjects=[0]\n", - " def __setgraphicsmode(self):\n", - " pass\n", - " def __settextmode(self):\n", - " pass\n", - " __init__=__init__\n", - " __del__=__del__\n", - " def getcount(self):\n", - " return self.__nobjects[0]\n", - "def my_func():\n", - " obj=Graphics()\n", - " print \"No. of Graphics' objects while in my_func=\", obj.getcount()\n", - "obj1=Graphics()\n", - "print \"No. of Graphics' objects before in my_func=\", obj1.getcount()\n", - "my_func()\n", - "print \"No. of Graphics' objects after in my_func=\", obj1.getcount()\n", - "obj2=Graphics()\n", - "obj3=Graphics()\n", - "obj4=Graphics()\n", - "print \"Value of static member nobjects after all 3 more objects...\"\n", - "print \"In obj1= \", obj1.getcount()\n", - "print \"In obj2= \", obj2.getcount()\n", - "print \"In obj3= \", obj3.getcount()\n", - "print \"In obj4= \", obj4.getcount()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No. of Graphics' objects before in my_func= 1\n", - "No. of Graphics' objects while in my_func= 2\n", - "No. of Graphics' objects after in my_func= 1\n", - "Value of static member nobjects after all 3 more objects...\n", - "In obj1= 4\n", - "In obj2= 4\n", - "In obj3= 4\n", - "In obj4= 4\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example Page-428" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def distance(self, a, b):\n", - " self.x=a.x-b.x\n", - " self.y=a.y-b.y\n", - "def display(self):\n", - " print \"x= \",self.x\n", - " print \"y= \", self.y\n", - "class point:\n", - " __x=int\n", - " __y=int\n", - " def __init__(self, a=None, b=None):\n", - " if isinstance(a, int):\n", - " self.x=a\n", - " self.y=b\n", - " else:\n", - " self.x=self.y=0\n", - " def __del__(self):\n", - " pass\n", - " distance=distance\n", - " display=display\n", - "p1=point(40,18)\n", - "p2=point(12,9)\n", - "p3=point()\n", - "p3.distance(p1,p2)\n", - "print \"Coordinates of P1: \"\n", - "p1.display()\n", - "print \"Coordinates of P2: \"\n", - "p2.display()\n", - "print \"distance between P1 and P2: \"\n", - "p3.display()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Coordinates of P1: \n", - "x= 40\n", - "y= 18\n", - "Coordinates of P2: \n", - "x= 12\n", - "y= 9\n", - "distance between P1 and P2: \n", - "x= 28\n", - "y= 9\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example Page-430" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def display(self):\n", - " print \"a =\", self.a,\n", - " print \"b =\", self.b\n", - "class data:\n", - " __a=int\n", - " __b=float\n", - " def __init__(self, x=None, y=None):\n", - " if isinstance(x, int):\n", - " self.a=x\n", - " self.b=y\n", - " elif isinstance(x, data):\n", - " self.a=x.a\n", - " self.b=x.b\n", - " else:\n", - " self.a=0\n", - " self.b=0\n", - " display=display\n", - "d1=data()\n", - "d2=data(12,9.9)\n", - "d3=data(d2)\n", - "print \"For default constructor: \"\n", - "d1.display()\n", - "print\"For parameterized constructor: \"\n", - "d2.display()\n", - "print \"For Copy Constructor: \"\n", - "d3.display()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "For default constructor: \n", - "a = 0 b = 0\n", - "For parameterized constructor: \n", - "a = 12 b = 9.9\n", - "For Copy Constructor: \n", - "a = 12 b = 9.9\n" - ] - } - ], - "prompt_number": 1 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/SudheerBommisetty/SudheerBommisetty_version_backup/Chapter_4_Op_Amps_as.ipynb b/sample_notebooks/SudheerBommisetty/SudheerBommisetty_version_backup/Chapter_4_Op_Amps_as.ipynb new file mode 100755 index 00000000..42bcd226 --- /dev/null +++ b/sample_notebooks/SudheerBommisetty/SudheerBommisetty_version_backup/Chapter_4_Op_Amps_as.ipynb @@ -0,0 +1,363 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4 Op Amps as AC Amplifiers" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## exa 4.1 page.no: 65" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "R1max= 140000.0\n", + "Xc1=R1/10 at F1\n", + "C1= 2.65258238486e-07 farad\n", + "C2= 8.16179195343e-07 farad\n", + "The circuit voltage should be normally between 9 to 18 volts\n" + ] + } + ], + "source": [ + "# capacitor coupled voltage follower design \n", + "from math import pi\n", + "\n", + "Vbe =0.7\n", + "Ibmax =500*10**-9\n", + "R1max=0.1* Vbe/ Ibmax\n", + "print \"R1max= \",R1max\n", + "# assume R1=120Kohms\n", + "R1=120000\n", + "f1=50\n", + "print \"Xc1=R1/10 at F1\"\n", + "# C1=1/(2∗pi∗f1∗(R1/10))\n", + "C1=1/(2*pi*f1*(R1/10))\n", + "print \"C1=\",C1,\" farad\"\n", + "Rl=3900\n", + "C2=1/(2*pi*f1*Rl)\n", + "print \"C2=\",C2,\" farad\"\n", + "print \"The circuit voltage should be normally between 9 to 18 volts\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## exa 4.2 page.no: 66" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "C1= 3.18309886184e-08 farad\n", + "C2= 8.16179195343e-07 farad\n", + "The circuit voltage should be normally between 9 to 18 volts\n" + ] + } + ], + "source": [ + "# capacitor coupled voltage follower design using BIFET \n", + "from math import pi\n", + "\n", + "R1 =1000000\n", + "f1=50\n", + "C1=1/(2*pi*f1*(R1/10))\n", + "print \"C1=\",C1,\" farad\"\n", + "Rl=3900\n", + "C2=1/(2*pi*f1*Rl)\n", + "print \"C2=\",C2,\" farad\"\n", + "print \"The circuit voltage should be normally between 9 to 18 volts\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## exa 4.3 page.no: 68" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "C1= 4.681027738e-07 farad\n", + "C2= 4.681027738e-07 farad\n", + "Zin= 3400068000 ohms\n", + "The circuit voltage should be normally between 9 to 18 volts\n" + ] + } + ], + "source": [ + "#capacitor coupled voltage follower design \n", + "from math import pi \n", + "\n", + "Vbe =0.7\n", + "Ibmax =500*10**-9\n", + "R1max=0.1* Vbe/ Ibmax\n", + "R1=R1max/2\n", + "R2=R1\n", + "R1=68000\n", + "f1=50\n", + "C1=1/(2*pi*f1*(R1/10))\n", + "print \"C1=\",C1,\" farad\"\n", + "C2=C1\n", + "print \"C2=\",C2,\" farad\"\n", + "Rl=3900\n", + "M=50000\n", + "Zin=(1+M)*R1\n", + "print \"Zin= \",Zin,\"ohms\"\n", + "print \"The circuit voltage should be normally between 9 to 18 volts\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## exa 4.4 page.no: 69" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "C1= 1.10524266036e-07 farad\n", + "C2= 6.02859632924e-07 farad\n", + "The circuit voltage should be normally between 9 to 18 volts\n" + ] + } + ], + "source": [ + "#capacitor coupled non inverting amplifier design \n", + "#lower cut off frequency for the circuit =120Hz\n", + "from math import pi\n", + "\n", + "Vbe =0.7\n", + "Ibmax =500*10**-9\n", + "R1max=0.1* Vbe/ Ibmax\n", + "R1=120000\n", + "f1=120\n", + "C1=1/(2*pi*f1*(R1/10))\n", + "print \"C1=\",C1,\" farad\"\n", + "Rl=2200\n", + "C2=1/(2*pi*f1*Rl)\n", + "print \"C2=\",C2,\" farad\"\n", + "print \"The circuit voltage should be normally between 9 to 18 volts\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## exa 4.5 page.no: 69" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "R1= 994974.874372\n", + "C2= 1.58359168376e-07 farad\n", + "C1=1000pF much larger than stray capacitance\n", + "C2= 6.63145596216e-07 farad\n", + "The circuit voltage should be normally between 9 to 18 volts\n" + ] + } + ], + "source": [ + "#capacitor coupled non inverting high impedence follower design \n", + "#lower cut off frequency for the circuit =200Hz \n", + "from math import pi\n", + "\n", + "Vo=3\n", + "Vi=0.015\n", + "Av=Vo/Vi\n", + "R2 =1000000\n", + "R3=R2/(Av-1)\n", + "f1=200\n", + "R1=R2-R3\n", + "print\"R1=\",R1\n", + "C2=1/(2*pi*f1*(R3))\n", + "print \"C2=\",C2,\" farad\"\n", + "print \"C1=1000pF much larger than stray capacitance\"\n", + "Rl=12000\n", + "C2=1/(2*pi*f1*(Rl/10))\n", + "print \"C2=\",C2,\" farad\"\n", + "print \"The circuit voltage should be normally between 9 to 18 volts\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## exa 4.6 page.no: 71" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "C1= 0.000159154943092 farad\n", + "C2= 6.36619772368e-05 farad\n", + "Cf= 3.38627538493e-07 farad\n", + "The circuit voltage should be normally between 9 to 18 volts\n" + ] + } + ], + "source": [ + "#capacitor coupled inverting amplifier design \n", + "#frequency range for the circuit =10Hz to 1KHz\n", + "from math import pi\n", + "R1 =1000\n", + "f1=10\n", + "C1=1/(2*pi*f1*(R1/10))\n", + "print \"C1=\",C1,\" farad\"\n", + "Rl=250\n", + "C2=1/(2*pi*f1*Rl)\n", + "print \"C2=\",C2,\" farad\"\n", + "R2=47000\n", + "Cf=1/(2*pi*f1*R2)\n", + "print \"Cf=\",Cf,\" farad\"\n", + "print \"The circuit voltage should be normally between 9 to 18 volts\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## exa 4.7 page.no: 72" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "R1= 240000.0 ohms\n", + "R2= 240000.0 ohms\n", + "R4= 1000.0 ohms\n", + "R3= 99000.0 ohms\n", + "Rp= 114782.608696 ohms\n", + "C1= 1.84876954097e-07 farad\n", + "C2= 3.78940340695e-06 farad\n", + "C3= 2.12206590789e-06 farad\n", + "The circuit voltage should be normally between 9 to 18 volts\n" + ] + } + ], + "source": [ + "#capacitor coupled non design\n", + "from math import pi\n", + "\n", + "Av =100.\n", + "Vcc =24.\n", + "Vo=5.\n", + "#lower cut off frequency for the circuit =75Hz\n", + "Vbe=0.7\n", + "Ibmax =500*10**-9\n", + "#I2>>Ibmax\n", + "I2 =100* Ibmax\n", + "R1=(Vcc/2)/I2\n", + "print\"R1=\",R1,\" ohms\"\n", + "R2=(Vcc/2)/I2\n", + "print\"R2=\",R2,\" ohms\"\n", + "#assume R1=220Kohms\n", + "Vi=Vo/Av\n", + "R1=220000.\n", + "I4 =100* Ibmax\n", + "R4=Vi/I4\n", + "print\"R4=\",R4,\" ohms\"\n", + "R3=(Vo/I4)-R4\n", + "print\"R3=\",R3,\" ohms\"\n", + "Rp=(R1*R2)/(R1+R2)\n", + "print\"Rp=\",Rp,\" ohms\"\n", + "f1=75.\n", + "C1=1/(2*pi*f1*(Rp/10))\n", + "print \"C1=\",C1,\" farad\"\n", + "Rl=5600.\n", + "C2=1/(2*pi*f1*(Rl/10))\n", + "print \"C2=\",C2,\" farad\"\n", + "C3=1/(2*pi*f1*R4)\n", + "print \"C3=\",C3,\" farad\"\n", + "print \"The circuit voltage should be normally between 9 to 18 volts\"" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/SudheerBommisetty/SudheerBommisetty_version_backup/Chapter_4_Op_Amps_as_AC.ipynb b/sample_notebooks/SudheerBommisetty/SudheerBommisetty_version_backup/Chapter_4_Op_Amps_as_AC.ipynb deleted file mode 100755 index 42bcd226..00000000 --- a/sample_notebooks/SudheerBommisetty/SudheerBommisetty_version_backup/Chapter_4_Op_Amps_as_AC.ipynb +++ /dev/null @@ -1,363 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 4 Op Amps as AC Amplifiers" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## exa 4.1 page.no: 65" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "R1max= 140000.0\n", - "Xc1=R1/10 at F1\n", - "C1= 2.65258238486e-07 farad\n", - "C2= 8.16179195343e-07 farad\n", - "The circuit voltage should be normally between 9 to 18 volts\n" - ] - } - ], - "source": [ - "# capacitor coupled voltage follower design \n", - "from math import pi\n", - "\n", - "Vbe =0.7\n", - "Ibmax =500*10**-9\n", - "R1max=0.1* Vbe/ Ibmax\n", - "print \"R1max= \",R1max\n", - "# assume R1=120Kohms\n", - "R1=120000\n", - "f1=50\n", - "print \"Xc1=R1/10 at F1\"\n", - "# C1=1/(2∗pi∗f1∗(R1/10))\n", - "C1=1/(2*pi*f1*(R1/10))\n", - "print \"C1=\",C1,\" farad\"\n", - "Rl=3900\n", - "C2=1/(2*pi*f1*Rl)\n", - "print \"C2=\",C2,\" farad\"\n", - "print \"The circuit voltage should be normally between 9 to 18 volts\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## exa 4.2 page.no: 66" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "C1= 3.18309886184e-08 farad\n", - "C2= 8.16179195343e-07 farad\n", - "The circuit voltage should be normally between 9 to 18 volts\n" - ] - } - ], - "source": [ - "# capacitor coupled voltage follower design using BIFET \n", - "from math import pi\n", - "\n", - "R1 =1000000\n", - "f1=50\n", - "C1=1/(2*pi*f1*(R1/10))\n", - "print \"C1=\",C1,\" farad\"\n", - "Rl=3900\n", - "C2=1/(2*pi*f1*Rl)\n", - "print \"C2=\",C2,\" farad\"\n", - "print \"The circuit voltage should be normally between 9 to 18 volts\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## exa 4.3 page.no: 68" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "C1= 4.681027738e-07 farad\n", - "C2= 4.681027738e-07 farad\n", - "Zin= 3400068000 ohms\n", - "The circuit voltage should be normally between 9 to 18 volts\n" - ] - } - ], - "source": [ - "#capacitor coupled voltage follower design \n", - "from math import pi \n", - "\n", - "Vbe =0.7\n", - "Ibmax =500*10**-9\n", - "R1max=0.1* Vbe/ Ibmax\n", - "R1=R1max/2\n", - "R2=R1\n", - "R1=68000\n", - "f1=50\n", - "C1=1/(2*pi*f1*(R1/10))\n", - "print \"C1=\",C1,\" farad\"\n", - "C2=C1\n", - "print \"C2=\",C2,\" farad\"\n", - "Rl=3900\n", - "M=50000\n", - "Zin=(1+M)*R1\n", - "print \"Zin= \",Zin,\"ohms\"\n", - "print \"The circuit voltage should be normally between 9 to 18 volts\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## exa 4.4 page.no: 69" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "C1= 1.10524266036e-07 farad\n", - "C2= 6.02859632924e-07 farad\n", - "The circuit voltage should be normally between 9 to 18 volts\n" - ] - } - ], - "source": [ - "#capacitor coupled non inverting amplifier design \n", - "#lower cut off frequency for the circuit =120Hz\n", - "from math import pi\n", - "\n", - "Vbe =0.7\n", - "Ibmax =500*10**-9\n", - "R1max=0.1* Vbe/ Ibmax\n", - "R1=120000\n", - "f1=120\n", - "C1=1/(2*pi*f1*(R1/10))\n", - "print \"C1=\",C1,\" farad\"\n", - "Rl=2200\n", - "C2=1/(2*pi*f1*Rl)\n", - "print \"C2=\",C2,\" farad\"\n", - "print \"The circuit voltage should be normally between 9 to 18 volts\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## exa 4.5 page.no: 69" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "R1= 994974.874372\n", - "C2= 1.58359168376e-07 farad\n", - "C1=1000pF much larger than stray capacitance\n", - "C2= 6.63145596216e-07 farad\n", - "The circuit voltage should be normally between 9 to 18 volts\n" - ] - } - ], - "source": [ - "#capacitor coupled non inverting high impedence follower design \n", - "#lower cut off frequency for the circuit =200Hz \n", - "from math import pi\n", - "\n", - "Vo=3\n", - "Vi=0.015\n", - "Av=Vo/Vi\n", - "R2 =1000000\n", - "R3=R2/(Av-1)\n", - "f1=200\n", - "R1=R2-R3\n", - "print\"R1=\",R1\n", - "C2=1/(2*pi*f1*(R3))\n", - "print \"C2=\",C2,\" farad\"\n", - "print \"C1=1000pF much larger than stray capacitance\"\n", - "Rl=12000\n", - "C2=1/(2*pi*f1*(Rl/10))\n", - "print \"C2=\",C2,\" farad\"\n", - "print \"The circuit voltage should be normally between 9 to 18 volts\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## exa 4.6 page.no: 71" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "C1= 0.000159154943092 farad\n", - "C2= 6.36619772368e-05 farad\n", - "Cf= 3.38627538493e-07 farad\n", - "The circuit voltage should be normally between 9 to 18 volts\n" - ] - } - ], - "source": [ - "#capacitor coupled inverting amplifier design \n", - "#frequency range for the circuit =10Hz to 1KHz\n", - "from math import pi\n", - "R1 =1000\n", - "f1=10\n", - "C1=1/(2*pi*f1*(R1/10))\n", - "print \"C1=\",C1,\" farad\"\n", - "Rl=250\n", - "C2=1/(2*pi*f1*Rl)\n", - "print \"C2=\",C2,\" farad\"\n", - "R2=47000\n", - "Cf=1/(2*pi*f1*R2)\n", - "print \"Cf=\",Cf,\" farad\"\n", - "print \"The circuit voltage should be normally between 9 to 18 volts\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## exa 4.7 page.no: 72" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "R1= 240000.0 ohms\n", - "R2= 240000.0 ohms\n", - "R4= 1000.0 ohms\n", - "R3= 99000.0 ohms\n", - "Rp= 114782.608696 ohms\n", - "C1= 1.84876954097e-07 farad\n", - "C2= 3.78940340695e-06 farad\n", - "C3= 2.12206590789e-06 farad\n", - "The circuit voltage should be normally between 9 to 18 volts\n" - ] - } - ], - "source": [ - "#capacitor coupled non design\n", - "from math import pi\n", - "\n", - "Av =100.\n", - "Vcc =24.\n", - "Vo=5.\n", - "#lower cut off frequency for the circuit =75Hz\n", - "Vbe=0.7\n", - "Ibmax =500*10**-9\n", - "#I2>>Ibmax\n", - "I2 =100* Ibmax\n", - "R1=(Vcc/2)/I2\n", - "print\"R1=\",R1,\" ohms\"\n", - "R2=(Vcc/2)/I2\n", - "print\"R2=\",R2,\" ohms\"\n", - "#assume R1=220Kohms\n", - "Vi=Vo/Av\n", - "R1=220000.\n", - "I4 =100* Ibmax\n", - "R4=Vi/I4\n", - "print\"R4=\",R4,\" ohms\"\n", - "R3=(Vo/I4)-R4\n", - "print\"R3=\",R3,\" ohms\"\n", - "Rp=(R1*R2)/(R1+R2)\n", - "print\"Rp=\",Rp,\" ohms\"\n", - "f1=75.\n", - "C1=1/(2*pi*f1*(Rp/10))\n", - "print \"C1=\",C1,\" farad\"\n", - "Rl=5600.\n", - "C2=1/(2*pi*f1*(Rl/10))\n", - "print \"C2=\",C2,\" farad\"\n", - "C3=1/(2*pi*f1*R4)\n", - "print \"C3=\",C3,\" farad\"\n", - "print \"The circuit voltage should be normally between 9 to 18 volts\"" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/SumadhuriDamerla/Chapter_1.ipynb b/sample_notebooks/SumadhuriDamerla/Chapter_1.ipynb new file mode 100755 index 00000000..916e874c --- /dev/null +++ b/sample_notebooks/SumadhuriDamerla/Chapter_1.ipynb @@ -0,0 +1,370 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 1 Passive Circuits" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.2.2, Pg.no.5" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of resistance R is 16.61 ohm\n", + "The value of resistance R3 is 66.82 ohm\n" + ] + } + ], + "source": [ + "import math\n", + "#given\n", + "Ro=50.0\n", + "ILdB=6.0 #T−type attenuator provide 6−dB insertion loss \n", + "#calculation\n", + "IL=10**-(ILdB/20) #Determination of R\n", + "R=Ro*(1-IL)/(1+IL)\n", + "R=round(R,2)\n", + "print 'The value of resistance R is',R,'ohm' \n", + "#Determination of R3\n", + "R3=(2*Ro*IL)/(1-(0.5)**2)\n", + "R3=round(R3,2)\n", + "print 'The value of resistance R3 is',R3,'ohm'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.2.3,Pg.no.7" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of resistance RA and RB is 150.5 ohm\n", + "The value of resistance RC is 37.35 ohm\n" + ] + } + ], + "source": [ + "import math\n", + "#given\n", + "Ro=50.0\n", + "ILdB=6.0\n", + "IL=10**-(ILdB/20) #Determination of RA and RB\n", + "RA=Ro*(1+IL)/(1-IL)\n", + "RA=round(RA,1)\n", + "print 'The value of resistance RA and RB is',RA,'ohm'\n", + "#Determination of RC\n", + "RC=Ro*(1-(IL)**2)/(2*IL)\n", + "RC=round(RC,2)\n", + "print 'The value of resistance RC is',RC,'ohm'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.2.4,Pg.no.9" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of resistance R1 is 1.0 ohm\n", + "The value of resistance R3 is 5624.0 ohm\n", + "The value of insertion loss is 0.12 decibels\n" + ] + } + ], + "source": [ + "import math\n", + "from math import log10\n", + "#given\n", + "Rs=75.0 #resistance\n", + "Rl=50.0 \n", + "#Determination of R1\n", + "R1=(Rs*(Rs-Rl))**(1/2)\n", + "R1=round(R1,2)\n", + "print 'The value of resistance R1 is',R1,'ohm'\n", + "#Determination of R3\n", + "R3=((Rs**2)-(R1**2))/R1\n", + "R3=round(R3,2)\n", + "print 'The value of resistance R3 is',R3,'ohm'\n", + "#Determination of insertion loss\n", + "IL=(R3*(Rs+R1))/((Rs+R1+R3)*(R3+R1)-(R3)**2)\n", + "ILdB=-20*log10(IL) #convertion of power in decibels\n", + "ILdB=round(ILdB,2)\n", + "print 'The value of insertion loss is',ILdB,'decibels'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.2.5,Pg.no.10" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of resistance R2 is 1.0 ohm\n", + "The value of resistance R3 is 2499.0 ohm\n", + "The value of insertion loss is 0.2 decibels\n" + ] + } + ], + "source": [ + "from math import log10\n", + "Rs=10.0\n", + "Rl=50.0 #Determination of R2\n", + "R2=(Rl*(Rl-Rs))**(1/2)\n", + "R2=round(R2,2)\n", + "print 'The value of resistance R2 is',R2,'ohm'\n", + "#Determination of R3\n", + "R3=((Rl**2)-(R2**2))/R2\n", + "R3=round(R3,2)\n", + "print 'The value of resistance R3 is',R3,'ohm'\n", + "#Determination of insertion loss\n", + "IL=(R3*(Rs+Rl))/((Rs+R3)*(R3+R2+Rl)-(R3)**2)\n", + "ILdB=-20*log10(IL) #convertion of power in decibels\n", + "ILdB=round(ILdB,1)\n", + "print 'The value of insertion loss is',ILdB,'decibels'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.5.1,Pg.no.21" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of self resonant freq is 60.2 MHz\n", + "The value of Q−factor is 31.4\n", + "The value of effective inductance is -5.79846400003e-12 uH\n", + "The value of effective Q−factor is -5.41522720497e+12\n" + ] + } + ], + "source": [ + "import math\n", + "C=7*10**-12\n", + "R=5.0\n", + "L=10**-6\n", + "f=25*10**6 \n", + "#Determination of self resonant freq of coil denoted as Fsr\n", + "Fsr=1/(2*3.14*(L*C)**0.5)\n", + "Fsr=Fsr/(10**6)\n", + "Fsr=round(Fsr,1)\n", + "print 'The value of self resonant freq is',Fsr,'MHz'\n", + "#Determination of Q−factor of coil , excluding self − capacitive effects\n", + "Q=(2*3.14*f*L)/R\n", + "print 'The value of Q−factor is',Q\n", + "#Determination of effective inductance\n", + "Leff=L/(1-(f/Fsr)**2)\n", + "Leff=Leff*(10**6)\n", + "#Leff=round(Leff,0)\n", + "print 'The value of effective inductance is',Leff,'uH'\n", + "#Determination of effective Q−factor\n", + "Qeff=Q*(1-(f/Fsr)**2)\n", + "Qeff=round(Qeff,0)\n", + "print 'The value of effective Q−factor is',Qeff" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.8.1,Pg.no.26" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of common resonant freq is 1e-06 Mrad/sec\n", + "The transfer impedance is -6.83732235918e-05 ohm\n" + ] + } + ], + "source": [ + "import cmath\n", + "#given\n", + "Lp=150*10**-6 #inductance\n", + "Ls=150*10**-6\n", + "Cp=470*10**-12 #capacitance\n", + "Cs=470*10**-12 #Lp=Ls=150 uH,Cp=Cs=470 pF\n", + "Q=85.0 #Q−factor for each ckt is 85\n", + "c=0.01 #Coeff of coupling is 0.01\n", + "Rl=5000.0 #Load resistance Rl=5000 ohm\n", + "r=75000.0 #Constant current source with internal resistance r=75 kohm\n", + "#calculations\n", + "#Determination of common resonant frequency\n", + "wo=1/((Lp*Cp)**(1/2))\n", + "wo=wo/(10**6)\n", + "print 'The value of common resonant freq is',wo,'Mrad/sec'\n", + "p=3.77*10**6\n", + "Z2=complex(62.9004,557.266) #Formula=Rl/(1+(p*j*Cs*Rl))\n", + "Z1=complex(4.2465,564.33) #Formula=r/(1+(p*j*Cp*r)) ;At resonance Zs=Zp=Z\n", + "z=complex(0,1)\n", + "Z=wo*Ls*(1/Q +z)\n", + "Zm=complex(0,p*c*Lp) #Determination of denominator\n", + "Dr=((Z+Z1)*(Z+Z2))-(Zm**2) \n", + "#Hence transfer impedance is given as\n", + "Zr= (Z1*Z2*Zm)/Dr\n", + "Z=Zr.real\n", + "#Z=round(Z,2)\n", + "#Zr.imag=round(Zr.imag,2)\n", + "print 'The transfer impedance is',Z,'ohm'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.10.1,Pg.no.34" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of common resonant freq is 169.56 Mrad/ sec\n", + "The value of Gl is 5.0 mSec\n", + "The value of alpha is 3.14\n", + "The value of effective load is 1.97 kohm\n", + "The value of tuning capacitance is 47.73 pF\n", + "The value of Rd is 1.85343097504e-05 kohm\n", + "The value of −3dB BW is 1.69 MHz\n" + ] + } + ], + "source": [ + "import math\n", + "C1=70*10**-12\n", + "C2=150*10**-12\n", + "Rl=200.0\n", + "Q=150.0\n", + "f=27*10**6\n", + "r=40000.0\n", + "#Determination of common resonant freq\n", + "wo=2*3.14*f\n", + "wo=wo/(10**6)\n", + "print 'The value of common resonant freq is',wo,'Mrad/ sec'\n", + "#Determination of Gl\n", + "Gl=1/Rl\n", + "G1=Gl*(10**3) \n", + "print'The value of Gl is',G1,'mSec'\n", + "#Checking the approxiamtion in denominator\n", + "ap=((wo*(C1+C2))/(Gl))**2\n", + "alpha=(C1+C2)/C1\n", + "alpha=round(alpha,2)\n", + "print 'The value of alpha is',alpha\n", + "#Determination of effective load\n", + "Reff=((alpha)**2)*Rl\n", + "Reff=Reff/(10**3)\n", + "Reff=round(Reff,2)\n", + "print 'The value of effective load is',Reff,'kohm' \n", + "#If effective load is much less than internal resistance hence tuning capacitance then\n", + "Cs=C1*C2/(C1+C2)\n", + "Cs=Cs*(10**12)\n", + "Cs=round(Cs,2)\n", + "print 'The value of tuning capacitance is',Cs,'pF'\n", + "#Determination of Rd\n", + "Rd=Q/(wo*Cs)\n", + "Rd=Rd/(10**3)\n", + "print 'The value of Rd is',Rd,'kohm'\n", + "#If Rd is much greater than Reff then −3dB bandwidth is given by\n", + "B=1/(2*3.14*C2*alpha*Rl)\n", + "B=B/(10**6)\n", + "B=round(B,2)\n", + "print 'The value of −3dB BW is',B,'MHz'" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/SumadhuriDamerla/Chapter_1_Passive.ipynb b/sample_notebooks/SumadhuriDamerla/Chapter_1_Passive.ipynb deleted file mode 100755 index 916e874c..00000000 --- a/sample_notebooks/SumadhuriDamerla/Chapter_1_Passive.ipynb +++ /dev/null @@ -1,370 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 1 Passive Circuits" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 1.2.2, Pg.no.5" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value of resistance R is 16.61 ohm\n", - "The value of resistance R3 is 66.82 ohm\n" - ] - } - ], - "source": [ - "import math\n", - "#given\n", - "Ro=50.0\n", - "ILdB=6.0 #T−type attenuator provide 6−dB insertion loss \n", - "#calculation\n", - "IL=10**-(ILdB/20) #Determination of R\n", - "R=Ro*(1-IL)/(1+IL)\n", - "R=round(R,2)\n", - "print 'The value of resistance R is',R,'ohm' \n", - "#Determination of R3\n", - "R3=(2*Ro*IL)/(1-(0.5)**2)\n", - "R3=round(R3,2)\n", - "print 'The value of resistance R3 is',R3,'ohm'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 1.2.3,Pg.no.7" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value of resistance RA and RB is 150.5 ohm\n", - "The value of resistance RC is 37.35 ohm\n" - ] - } - ], - "source": [ - "import math\n", - "#given\n", - "Ro=50.0\n", - "ILdB=6.0\n", - "IL=10**-(ILdB/20) #Determination of RA and RB\n", - "RA=Ro*(1+IL)/(1-IL)\n", - "RA=round(RA,1)\n", - "print 'The value of resistance RA and RB is',RA,'ohm'\n", - "#Determination of RC\n", - "RC=Ro*(1-(IL)**2)/(2*IL)\n", - "RC=round(RC,2)\n", - "print 'The value of resistance RC is',RC,'ohm'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 1.2.4,Pg.no.9" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value of resistance R1 is 1.0 ohm\n", - "The value of resistance R3 is 5624.0 ohm\n", - "The value of insertion loss is 0.12 decibels\n" - ] - } - ], - "source": [ - "import math\n", - "from math import log10\n", - "#given\n", - "Rs=75.0 #resistance\n", - "Rl=50.0 \n", - "#Determination of R1\n", - "R1=(Rs*(Rs-Rl))**(1/2)\n", - "R1=round(R1,2)\n", - "print 'The value of resistance R1 is',R1,'ohm'\n", - "#Determination of R3\n", - "R3=((Rs**2)-(R1**2))/R1\n", - "R3=round(R3,2)\n", - "print 'The value of resistance R3 is',R3,'ohm'\n", - "#Determination of insertion loss\n", - "IL=(R3*(Rs+R1))/((Rs+R1+R3)*(R3+R1)-(R3)**2)\n", - "ILdB=-20*log10(IL) #convertion of power in decibels\n", - "ILdB=round(ILdB,2)\n", - "print 'The value of insertion loss is',ILdB,'decibels'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 1.2.5,Pg.no.10" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value of resistance R2 is 1.0 ohm\n", - "The value of resistance R3 is 2499.0 ohm\n", - "The value of insertion loss is 0.2 decibels\n" - ] - } - ], - "source": [ - "from math import log10\n", - "Rs=10.0\n", - "Rl=50.0 #Determination of R2\n", - "R2=(Rl*(Rl-Rs))**(1/2)\n", - "R2=round(R2,2)\n", - "print 'The value of resistance R2 is',R2,'ohm'\n", - "#Determination of R3\n", - "R3=((Rl**2)-(R2**2))/R2\n", - "R3=round(R3,2)\n", - "print 'The value of resistance R3 is',R3,'ohm'\n", - "#Determination of insertion loss\n", - "IL=(R3*(Rs+Rl))/((Rs+R3)*(R3+R2+Rl)-(R3)**2)\n", - "ILdB=-20*log10(IL) #convertion of power in decibels\n", - "ILdB=round(ILdB,1)\n", - "print 'The value of insertion loss is',ILdB,'decibels'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 1.5.1,Pg.no.21" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value of self resonant freq is 60.2 MHz\n", - "The value of Q−factor is 31.4\n", - "The value of effective inductance is -5.79846400003e-12 uH\n", - "The value of effective Q−factor is -5.41522720497e+12\n" - ] - } - ], - "source": [ - "import math\n", - "C=7*10**-12\n", - "R=5.0\n", - "L=10**-6\n", - "f=25*10**6 \n", - "#Determination of self resonant freq of coil denoted as Fsr\n", - "Fsr=1/(2*3.14*(L*C)**0.5)\n", - "Fsr=Fsr/(10**6)\n", - "Fsr=round(Fsr,1)\n", - "print 'The value of self resonant freq is',Fsr,'MHz'\n", - "#Determination of Q−factor of coil , excluding self − capacitive effects\n", - "Q=(2*3.14*f*L)/R\n", - "print 'The value of Q−factor is',Q\n", - "#Determination of effective inductance\n", - "Leff=L/(1-(f/Fsr)**2)\n", - "Leff=Leff*(10**6)\n", - "#Leff=round(Leff,0)\n", - "print 'The value of effective inductance is',Leff,'uH'\n", - "#Determination of effective Q−factor\n", - "Qeff=Q*(1-(f/Fsr)**2)\n", - "Qeff=round(Qeff,0)\n", - "print 'The value of effective Q−factor is',Qeff" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 1.8.1,Pg.no.26" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value of common resonant freq is 1e-06 Mrad/sec\n", - "The transfer impedance is -6.83732235918e-05 ohm\n" - ] - } - ], - "source": [ - "import cmath\n", - "#given\n", - "Lp=150*10**-6 #inductance\n", - "Ls=150*10**-6\n", - "Cp=470*10**-12 #capacitance\n", - "Cs=470*10**-12 #Lp=Ls=150 uH,Cp=Cs=470 pF\n", - "Q=85.0 #Q−factor for each ckt is 85\n", - "c=0.01 #Coeff of coupling is 0.01\n", - "Rl=5000.0 #Load resistance Rl=5000 ohm\n", - "r=75000.0 #Constant current source with internal resistance r=75 kohm\n", - "#calculations\n", - "#Determination of common resonant frequency\n", - "wo=1/((Lp*Cp)**(1/2))\n", - "wo=wo/(10**6)\n", - "print 'The value of common resonant freq is',wo,'Mrad/sec'\n", - "p=3.77*10**6\n", - "Z2=complex(62.9004,557.266) #Formula=Rl/(1+(p*j*Cs*Rl))\n", - "Z1=complex(4.2465,564.33) #Formula=r/(1+(p*j*Cp*r)) ;At resonance Zs=Zp=Z\n", - "z=complex(0,1)\n", - "Z=wo*Ls*(1/Q +z)\n", - "Zm=complex(0,p*c*Lp) #Determination of denominator\n", - "Dr=((Z+Z1)*(Z+Z2))-(Zm**2) \n", - "#Hence transfer impedance is given as\n", - "Zr= (Z1*Z2*Zm)/Dr\n", - "Z=Zr.real\n", - "#Z=round(Z,2)\n", - "#Zr.imag=round(Zr.imag,2)\n", - "print 'The transfer impedance is',Z,'ohm'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 1.10.1,Pg.no.34" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The value of common resonant freq is 169.56 Mrad/ sec\n", - "The value of Gl is 5.0 mSec\n", - "The value of alpha is 3.14\n", - "The value of effective load is 1.97 kohm\n", - "The value of tuning capacitance is 47.73 pF\n", - "The value of Rd is 1.85343097504e-05 kohm\n", - "The value of −3dB BW is 1.69 MHz\n" - ] - } - ], - "source": [ - "import math\n", - "C1=70*10**-12\n", - "C2=150*10**-12\n", - "Rl=200.0\n", - "Q=150.0\n", - "f=27*10**6\n", - "r=40000.0\n", - "#Determination of common resonant freq\n", - "wo=2*3.14*f\n", - "wo=wo/(10**6)\n", - "print 'The value of common resonant freq is',wo,'Mrad/ sec'\n", - "#Determination of Gl\n", - "Gl=1/Rl\n", - "G1=Gl*(10**3) \n", - "print'The value of Gl is',G1,'mSec'\n", - "#Checking the approxiamtion in denominator\n", - "ap=((wo*(C1+C2))/(Gl))**2\n", - "alpha=(C1+C2)/C1\n", - "alpha=round(alpha,2)\n", - "print 'The value of alpha is',alpha\n", - "#Determination of effective load\n", - "Reff=((alpha)**2)*Rl\n", - "Reff=Reff/(10**3)\n", - "Reff=round(Reff,2)\n", - "print 'The value of effective load is',Reff,'kohm' \n", - "#If effective load is much less than internal resistance hence tuning capacitance then\n", - "Cs=C1*C2/(C1+C2)\n", - "Cs=Cs*(10**12)\n", - "Cs=round(Cs,2)\n", - "print 'The value of tuning capacitance is',Cs,'pF'\n", - "#Determination of Rd\n", - "Rd=Q/(wo*Cs)\n", - "Rd=Rd/(10**3)\n", - "print 'The value of Rd is',Rd,'kohm'\n", - "#If Rd is much greater than Reff then −3dB bandwidth is given by\n", - "B=1/(2*3.14*C2*alpha*Rl)\n", - "B=B/(10**6)\n", - "B=round(B,2)\n", - "print 'The value of −3dB BW is',B,'MHz'" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/SumedhKadam/Chapter_1.ipynb b/sample_notebooks/SumedhKadam/Chapter_1.ipynb new file mode 100644 index 00000000..62d27f1f --- /dev/null +++ b/sample_notebooks/SumedhKadam/Chapter_1.ipynb @@ -0,0 +1,117 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 1 General Principles" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex 1.1 Page No 10 " + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Part(a)\n", + "(10 mN)(5 GN) = 50 kilo Newton square\n", + "\n", + "Part(b)\n", + "(100 mm)(0.5 MN square) = 25 Gigameter Newton square\n", + "\n", + "Part(c)\n", + "(50 MN cube)(500 Gg) = 100 Kilo Newton cube per kg\n" + ] + } + ], + "source": [ + "# Example Number 1.1\n", + "\n", + "# Part(a)\n", + "# Variable Declaration\n", + "a = 10 # [micro Newton(mN)]\n", + "b = 5 # [Giga Newton(GN)]\n", + "\n", + "# Calculation\n", + "# We have to find c = a * b\n", + "c = 10*5 # [micro Newton(mN)*Giga Newton(GN)]\n", + "c = (10*10**(-3))*(5*10**(9)) # [N**(2)]\n", + "c = (10*10**(-3))*(5*10**(9))*10**(-6) #[kN**(2)]\n", + "\n", + "#Result\n", + "print\"Part(a)\"\n", + "print \"(10 mN)(5 GN) = \",int(c),\"kilo Newton square\\n\"\n", + "\n", + "# Part(b)\n", + "# Variable Declaration\n", + "a = 100 #[millimeter(mm)]\n", + "b = 0.5**(2) #[mega Newton square(MN**(2))]\n", + "\n", + "# Calculation\n", + "# We have to find c = a * b\n", + "c = (100*10**(-3))*(0.25*10**(12)) #[m.N**(2)]\n", + "c = (100*10**(-3))*(0.25*10**(12))*10**(-9) #[Gm.N**(2)]\n", + "\n", + "#Result\n", + "print\"Part(b)\"\n", + "print \"(100 mm)(0.5 MN square) = \",int(c),\"Gigameter Newton square\\n\"\n", + "\n", + "# Part(c) (Correction in the question (50 MN cube)(500 Gg))\n", + "# Variable Declaration\n", + "a = 50 #[mega newton cube((MN)**(3))]\n", + "b = 500 #[gigagram(Gg)]\n", + "\n", + "# Calculation\n", + "# We have to find c = a / b\n", + "c = 50*(10**(6))**3 / 500*10**(6) #[N**(3)/kg]\n", + "c = (50*((10**(6))**3) / (500*10**(6)))*10**(-9) #[kN**(3)/kg]\n", + "\n", + "#Result\n", + "print\"Part(c)\"\n", + "print \"(50 MN cube)(500 Gg) = \",int(c),\"Kilo Newton cube per kg\"\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.12" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/sample_notebooks/SumedhKadam/Chapter_1_General.ipynb b/sample_notebooks/SumedhKadam/Chapter_1_General.ipynb deleted file mode 100644 index 62d27f1f..00000000 --- a/sample_notebooks/SumedhKadam/Chapter_1_General.ipynb +++ /dev/null @@ -1,117 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 1 General Principles" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Ex 1.1 Page No 10 " - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Part(a)\n", - "(10 mN)(5 GN) = 50 kilo Newton square\n", - "\n", - "Part(b)\n", - "(100 mm)(0.5 MN square) = 25 Gigameter Newton square\n", - "\n", - "Part(c)\n", - "(50 MN cube)(500 Gg) = 100 Kilo Newton cube per kg\n" - ] - } - ], - "source": [ - "# Example Number 1.1\n", - "\n", - "# Part(a)\n", - "# Variable Declaration\n", - "a = 10 # [micro Newton(mN)]\n", - "b = 5 # [Giga Newton(GN)]\n", - "\n", - "# Calculation\n", - "# We have to find c = a * b\n", - "c = 10*5 # [micro Newton(mN)*Giga Newton(GN)]\n", - "c = (10*10**(-3))*(5*10**(9)) # [N**(2)]\n", - "c = (10*10**(-3))*(5*10**(9))*10**(-6) #[kN**(2)]\n", - "\n", - "#Result\n", - "print\"Part(a)\"\n", - "print \"(10 mN)(5 GN) = \",int(c),\"kilo Newton square\\n\"\n", - "\n", - "# Part(b)\n", - "# Variable Declaration\n", - "a = 100 #[millimeter(mm)]\n", - "b = 0.5**(2) #[mega Newton square(MN**(2))]\n", - "\n", - "# Calculation\n", - "# We have to find c = a * b\n", - "c = (100*10**(-3))*(0.25*10**(12)) #[m.N**(2)]\n", - "c = (100*10**(-3))*(0.25*10**(12))*10**(-9) #[Gm.N**(2)]\n", - "\n", - "#Result\n", - "print\"Part(b)\"\n", - "print \"(100 mm)(0.5 MN square) = \",int(c),\"Gigameter Newton square\\n\"\n", - "\n", - "# Part(c) (Correction in the question (50 MN cube)(500 Gg))\n", - "# Variable Declaration\n", - "a = 50 #[mega newton cube((MN)**(3))]\n", - "b = 500 #[gigagram(Gg)]\n", - "\n", - "# Calculation\n", - "# We have to find c = a / b\n", - "c = 50*(10**(6))**3 / 500*10**(6) #[N**(3)/kg]\n", - "c = (50*((10**(6))**3) / (500*10**(6)))*10**(-9) #[kN**(3)/kg]\n", - "\n", - "#Result\n", - "print\"Part(c)\"\n", - "print \"(50 MN cube)(500 Gg) = \",int(c),\"Kilo Newton cube per kg\"\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.12" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -} diff --git a/sample_notebooks/SwathiSyamala/SwathiSyamala_version_backup/Chapter_6_IMPEDENCE_MATCHING.ipynb b/sample_notebooks/SwathiSyamala/SwathiSyamala_version_backup/Chapter_6_IMPEDENCE_MATCHING.ipynb new file mode 100755 index 00000000..e50612ad --- /dev/null +++ b/sample_notebooks/SwathiSyamala/SwathiSyamala_version_backup/Chapter_6_IMPEDENCE_MATCHING.ipynb @@ -0,0 +1,277 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 6 IMPEDENCE MATCHING AND TUNNING" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 6.1 page no:284" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "inductor of first circuit in nH = 38.9848400617\n", + "capacitor of the first circuit in pF = 0.9227738301\n", + "inductor of second circuit in nH = 46.138691505\n", + "capacitor of the second circuit in pF = 2.59898933745\n", + "\"NOTE:−for above specific problem Rl>Zo, positive X implies inductor , negative X implies capacitor , positive B implies capacitor and negative B implies inductor .\"\n" + ] + } + ], + "source": [ + "#Exa 6.1 program to design an L section matching network\n", + "# example:−6.1,page no.−284.\n", + "from math import pi,sqrt\n", + "from sympy import I\n", + "# program to design an L section matching network to match a series RC load.\n", + "Zl=200-I*100; # load impedence .\n", + "Rl=200;Xl=-100;f=500*10**6;Zo=100;\n", + "B1=(Xl+sqrt(Rl/Zo)*sqrt(Rl**2+Xl**2-(Rl*Zo)))/(Rl**2+Xl**2);\n", + "B2=(Xl-sqrt(Rl/Zo)*sqrt(Rl**2+Xl**2-(Rl*Zo)))/(Rl**2+Xl**2);\n", + "C1=(B1/(2*pi*f))*10**12;\n", + "L2=(-1/(B2*2*pi*f))*10**9;\n", + "X1=(1/B1)+((Xl*Zo)/Rl)-(Zo/(B1*Rl));\n", + "X2=(1/B2)+((Xl*Zo)/Rl)-(Zo/(B2*Rl));\n", + "L1=(X1/(2*pi*f))*10**9;\n", + "C2=(-1/(X2*2*pi*f))*10**12;\n", + "print\"inductor of first circuit in nH = \",L1\n", + "print\"capacitor of the first circuit in pF = \",C1\n", + "print\"inductor of second circuit in nH = \",L2\n", + "print\"capacitor of the second circuit in pF = \",C2 \n", + "print\"\\\"NOTE:−for above specific problem Rl>Zo, positive X implies inductor , negative X implies capacitor , positive B implies capacitor and negative B implies inductor .\\\"\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 6.2 page no:304" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "charecteristic impedence of matching section = 22.360679775\n", + " fractional bandwidth = 0.293159219438\n" + ] + } + ], + "source": [ + "#Exa 6.5 design quarter wave matching transformer\n", + "#example:−6.5,page no.−304.\n", + "from math import sqrt,pi,acos\n", + "#program to design a single section quarter wave matching transformer .\n", + "Zl=10; # load impedence .\n", + "Zo=50; # characteristic impedence .\n", + "fo=3*10**9;swr=1.5; # maximum limit of swr.\n", + "Z1=sqrt(Zo*Zl); # characteristic impedence of the matching section .\n", + "taom=(swr-1)/(swr+1);\n", + "frac_bw=2-(4/pi)*acos((taom/sqrt(1-taom**2))*(2*sqrt(Zo*Zl)/abs(Zl-Zo))); # fractional bandwidth .\n", + "print \"charecteristic impedence of matching section =\",Z1\n", + "print \" fractional bandwidth = \",frac_bw" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 6.6 page no:307" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "approximate value of reflection coefficient is = 0.4\n", + "the error in percent is about = 4.0\n" + ] + } + ], + "source": [ + "#Exa 6.6 program to evaluate the worst case percent error\n", + "# example:−6.6,page no.−307.\n", + "#from math import abs\n", + "# program to evaluate the worst case percent error in computing magnitude of reflection coefficient .\n", + "Z1 =100.; \n", + "Z2 =150.; \n", + "Zl =225.;\n", + "tao_1=(Z2-Z1)/(Z2+Z1);\n", + "tao_2=(Zl-Z2)/(Zl+Z2);\n", + "tao_exact=(tao_1+tao_2)/(1+tao_1*tao_2); # this results as angle is taken zero .\n", + "tao_approx=tao_1+tao_2; # this results as angle is taken zero .\n", + "eror=abs(((tao_exact -tao_approx)/tao_exact)*100);\n", + "print \"approximate value of reflection coefficient is = \",tao_approx\n", + "print \"the error in percent is about = \",eror" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 6.7 page no:312" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Z1 = 91.7004043205\n", + "Z2 = 84.0896415254\n", + "Z3 = 77.1105412704\n" + ] + } + ], + "source": [ + "#Exa 6.7 design three section binomial transformer\n", + "# example:−6.7,page no.−312.\n", + "from math import pi,acos\n", + "# program to design three section binomial transformer .\n", + "Zl=50.;Zo=100.;N=3;taom=0.05;\n", + "A=(2**-N)*abs((Zl-Zo)/(Zl+Zo));\n", + "frac_bw=2-(4/pi)*acos(0.5*(taom/A)**2);\n", + "c=1\n", + "Z1=Zo*((Zl/Zo)**((2**-N)*(c**N)));\n", + "print \"Z1 = \",Z1\n", + "c=3**(1/3)\n", + "Z2=Z1*((Zl/Zo)**((2**-N)*(c**N)));\n", + "print \"Z2 = \",Z2\n", + "c=3**(1/3)\n", + "Z3=Z2*((Zl/Zo)**((2**-N)*(c**N)));\n", + "print \"Z3 = \",Z3" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 6.8 page no:316" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the characteristic impedences are = 52.5641025641 , 52.5641025641 , 95.1219512195\n" + ] + } + ], + "source": [ + "#Exa 6.8 design three section chebysev transfomer\n", + "# example:−6.8,page no.−316.\n", + "from math import pi,cosh\n", + "from sympy import asec,acosh\n", + "# program to design a three section chebysev transformer .\n", + "Zl=100.;Zo=50.;taom=0.05;N=3;A=0.05;\n", + "thetam=asec(cosh((1/N)*acosh((1/taom)*abs((Zl-Zo)/(Zl+Zo)))))*(180/pi);\n", + "x=(cosh((1/N)*acosh((1/taom)*abs((Zl-Zo)/(Zl+Zo)))))\n", + "tao_o=A*(x**3)/2;\n", + "tao_1=(3*A*(x**3-x))/2; # from symmetry tao 3=tao \n", + "Z1=Zo*((1+tao_o)/(1-tao_o));\n", + "Z2=Z1*((1+tao_1)/(1-tao_1));\n", + "Z3=Zl*((1-tao_o)/(1+tao_o));\n", + "print \"the characteristic impedences are = \",Z1,\",\",Z2,\",\",Z3" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 6.9 page no:323" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "tao o = -0.346573590279973\n", + "A= -3.54467649562\n" + ] + } + ], + "source": [ + "#Exa 6.9 design triangular taper and a klopfenstein taper\n", + "#example:−6.9,page no.−323.\n", + "from sympy import acosh,log\n", + "#program to designa triangular taper and a klopfenstein taper .\n", + "taom =0.02; Zl =50.; Zo =100.;\n", + "tao_o=0.5*log(Zl/Zo);\n", + "A=complex(acosh(tao_o/taom));\n", + "A=A.real;\n", + "print \"tao o = \",tao_o\n", + "print\"A= \",A" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/SwathiSyamala/SwathiSyamala_version_backup/Chapter_6_IMPEDENCE_MATCHING_AND.ipynb b/sample_notebooks/SwathiSyamala/SwathiSyamala_version_backup/Chapter_6_IMPEDENCE_MATCHING_AND.ipynb deleted file mode 100755 index e50612ad..00000000 --- a/sample_notebooks/SwathiSyamala/SwathiSyamala_version_backup/Chapter_6_IMPEDENCE_MATCHING_AND.ipynb +++ /dev/null @@ -1,277 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 6 IMPEDENCE MATCHING AND TUNNING" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 6.1 page no:284" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "inductor of first circuit in nH = 38.9848400617\n", - "capacitor of the first circuit in pF = 0.9227738301\n", - "inductor of second circuit in nH = 46.138691505\n", - "capacitor of the second circuit in pF = 2.59898933745\n", - "\"NOTE:−for above specific problem Rl>Zo, positive X implies inductor , negative X implies capacitor , positive B implies capacitor and negative B implies inductor .\"\n" - ] - } - ], - "source": [ - "#Exa 6.1 program to design an L section matching network\n", - "# example:−6.1,page no.−284.\n", - "from math import pi,sqrt\n", - "from sympy import I\n", - "# program to design an L section matching network to match a series RC load.\n", - "Zl=200-I*100; # load impedence .\n", - "Rl=200;Xl=-100;f=500*10**6;Zo=100;\n", - "B1=(Xl+sqrt(Rl/Zo)*sqrt(Rl**2+Xl**2-(Rl*Zo)))/(Rl**2+Xl**2);\n", - "B2=(Xl-sqrt(Rl/Zo)*sqrt(Rl**2+Xl**2-(Rl*Zo)))/(Rl**2+Xl**2);\n", - "C1=(B1/(2*pi*f))*10**12;\n", - "L2=(-1/(B2*2*pi*f))*10**9;\n", - "X1=(1/B1)+((Xl*Zo)/Rl)-(Zo/(B1*Rl));\n", - "X2=(1/B2)+((Xl*Zo)/Rl)-(Zo/(B2*Rl));\n", - "L1=(X1/(2*pi*f))*10**9;\n", - "C2=(-1/(X2*2*pi*f))*10**12;\n", - "print\"inductor of first circuit in nH = \",L1\n", - "print\"capacitor of the first circuit in pF = \",C1\n", - "print\"inductor of second circuit in nH = \",L2\n", - "print\"capacitor of the second circuit in pF = \",C2 \n", - "print\"\\\"NOTE:−for above specific problem Rl>Zo, positive X implies inductor , negative X implies capacitor , positive B implies capacitor and negative B implies inductor .\\\"\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 6.2 page no:304" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "charecteristic impedence of matching section = 22.360679775\n", - " fractional bandwidth = 0.293159219438\n" - ] - } - ], - "source": [ - "#Exa 6.5 design quarter wave matching transformer\n", - "#example:−6.5,page no.−304.\n", - "from math import sqrt,pi,acos\n", - "#program to design a single section quarter wave matching transformer .\n", - "Zl=10; # load impedence .\n", - "Zo=50; # characteristic impedence .\n", - "fo=3*10**9;swr=1.5; # maximum limit of swr.\n", - "Z1=sqrt(Zo*Zl); # characteristic impedence of the matching section .\n", - "taom=(swr-1)/(swr+1);\n", - "frac_bw=2-(4/pi)*acos((taom/sqrt(1-taom**2))*(2*sqrt(Zo*Zl)/abs(Zl-Zo))); # fractional bandwidth .\n", - "print \"charecteristic impedence of matching section =\",Z1\n", - "print \" fractional bandwidth = \",frac_bw" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 6.6 page no:307" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "approximate value of reflection coefficient is = 0.4\n", - "the error in percent is about = 4.0\n" - ] - } - ], - "source": [ - "#Exa 6.6 program to evaluate the worst case percent error\n", - "# example:−6.6,page no.−307.\n", - "#from math import abs\n", - "# program to evaluate the worst case percent error in computing magnitude of reflection coefficient .\n", - "Z1 =100.; \n", - "Z2 =150.; \n", - "Zl =225.;\n", - "tao_1=(Z2-Z1)/(Z2+Z1);\n", - "tao_2=(Zl-Z2)/(Zl+Z2);\n", - "tao_exact=(tao_1+tao_2)/(1+tao_1*tao_2); # this results as angle is taken zero .\n", - "tao_approx=tao_1+tao_2; # this results as angle is taken zero .\n", - "eror=abs(((tao_exact -tao_approx)/tao_exact)*100);\n", - "print \"approximate value of reflection coefficient is = \",tao_approx\n", - "print \"the error in percent is about = \",eror" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 6.7 page no:312" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Z1 = 91.7004043205\n", - "Z2 = 84.0896415254\n", - "Z3 = 77.1105412704\n" - ] - } - ], - "source": [ - "#Exa 6.7 design three section binomial transformer\n", - "# example:−6.7,page no.−312.\n", - "from math import pi,acos\n", - "# program to design three section binomial transformer .\n", - "Zl=50.;Zo=100.;N=3;taom=0.05;\n", - "A=(2**-N)*abs((Zl-Zo)/(Zl+Zo));\n", - "frac_bw=2-(4/pi)*acos(0.5*(taom/A)**2);\n", - "c=1\n", - "Z1=Zo*((Zl/Zo)**((2**-N)*(c**N)));\n", - "print \"Z1 = \",Z1\n", - "c=3**(1/3)\n", - "Z2=Z1*((Zl/Zo)**((2**-N)*(c**N)));\n", - "print \"Z2 = \",Z2\n", - "c=3**(1/3)\n", - "Z3=Z2*((Zl/Zo)**((2**-N)*(c**N)));\n", - "print \"Z3 = \",Z3" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 6.8 page no:316" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the characteristic impedences are = 52.5641025641 , 52.5641025641 , 95.1219512195\n" - ] - } - ], - "source": [ - "#Exa 6.8 design three section chebysev transfomer\n", - "# example:−6.8,page no.−316.\n", - "from math import pi,cosh\n", - "from sympy import asec,acosh\n", - "# program to design a three section chebysev transformer .\n", - "Zl=100.;Zo=50.;taom=0.05;N=3;A=0.05;\n", - "thetam=asec(cosh((1/N)*acosh((1/taom)*abs((Zl-Zo)/(Zl+Zo)))))*(180/pi);\n", - "x=(cosh((1/N)*acosh((1/taom)*abs((Zl-Zo)/(Zl+Zo)))))\n", - "tao_o=A*(x**3)/2;\n", - "tao_1=(3*A*(x**3-x))/2; # from symmetry tao 3=tao \n", - "Z1=Zo*((1+tao_o)/(1-tao_o));\n", - "Z2=Z1*((1+tao_1)/(1-tao_1));\n", - "Z3=Zl*((1-tao_o)/(1+tao_o));\n", - "print \"the characteristic impedences are = \",Z1,\",\",Z2,\",\",Z3" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 6.9 page no:323" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "tao o = -0.346573590279973\n", - "A= -3.54467649562\n" - ] - } - ], - "source": [ - "#Exa 6.9 design triangular taper and a klopfenstein taper\n", - "#example:−6.9,page no.−323.\n", - "from sympy import acosh,log\n", - "#program to designa triangular taper and a klopfenstein taper .\n", - "taom =0.02; Zl =50.; Zo =100.;\n", - "tao_o=0.5*log(Zl/Zo);\n", - "A=complex(acosh(tao_o/taom));\n", - "A=A.real;\n", - "print \"tao o = \",tao_o\n", - "print\"A= \",A" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/Vedantam Lakshmi Manasa/Chapter_2.ipynb b/sample_notebooks/Vedantam Lakshmi Manasa/Chapter_2.ipynb new file mode 100755 index 00000000..cdc8b25e --- /dev/null +++ b/sample_notebooks/Vedantam Lakshmi Manasa/Chapter_2.ipynb @@ -0,0 +1,296 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 2 Electric Fields" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_5 pgno:65" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Maximum field = V/m per volt 42064315640.1\n" + ] + } + ], + "source": [ + "#Chapter 2, Example 5, page 65\n", + "#Calculate the maximum field at the sphere surface\n", + "#Calulating Field at surface E based on figure 2.31 and table 2.3\n", + "from math import pi\n", + "Q1 = 0.25\n", + "e0 = 8.85418*10**-12 #Epselon nought\n", + "RV1= ((1/0.25**2)+(0.067/(0.25-0.067)**2)+(0.0048/(0.25-0.067)**2))\n", + "RV2= ((0.25+0.01795+0.00128)/(0.75-0.067)**2)\n", + "RV= RV1+RV2\n", + "E = (Q1*RV)/(4*pi*e0)\n", + "print\"Maximum field = V/m per volt\",E\n", + "\n", + "#Answers vary due to round off error\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_6 pgno:66" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "#Chapter 2, Exmaple 6, page 66\n", + "#calculation based on figure 2.32\n", + "\n", + "#(a)Charge on each bundle\n", + "print\"Part a\\t\"\n", + "req = (0.0175*0.45)**0.5\n", + "print\"Equivalent radius = m \", req\n", + "from math import log\n", + "from math import pi\n", + "V = 400*10**3 #Voltage\n", + "H = 12. #bundle height in m\n", + "d = 9. #pole to pole spacing in m\n", + "e0 = 8.85418*10**-12 #Epselon nought\n", + "Hd = ((2*H)**2+d**2)**0.5#2*H**2 + d**2\n", + "Q = V*2*pi*e0/(log((2*H/req))-log((Hd/d)))\n", + "q = Q/2\n", + "print\"Charge per bundle = uC/m \",Q #micro C/m\n", + "print\"Charge per sunconducter = uC/m \",q #micro C/m\n", + "\n", + "#(b part i)Maximim & average surface feild\n", + "print\"\\tPart b\"\n", + "print\"\\tSub part 1\\t\"\n", + "r = 0.0175 #subconductor radius\n", + "R = 0.45 #conductor to subconductor spacing\n", + "MF = (q/(2*pi*e0))*((1/r)+(1/R)) # maximum feild\n", + "print\"Maximum feild = kV/m \\t\",MF\n", + "MSF = (q/(2*pi*e0))*((1/r)-(1/R)) # maximum surface feild\n", + "print\"Maximum feild = kV/m \\t\",MSF\n", + "ASF = (q/(2*pi*e0))*(1/r) # Average surface feild\n", + "print\"Maximum feild = kV/m \\t\",ASF\n", + "\n", + "#(b part ii) Considering the two sunconductors on the left\n", + "print\"\\tSub part 2\\t\"\n", + "#field at the outer point of subconductor #1 \n", + "drO1 = 1/(d+r)\n", + "dRrO1 = 1/(d+R+r)\n", + "EO1 = MF -((q/(2*pi*e0))*(drO1+dRrO1))\n", + "print\"EO1 = kV/m \\t\",EO1\n", + "#field at the outer point of subconductor #2 \n", + "drO2 = 1/(d-r)\n", + "dRrO2 = 1/(d-R-r)\n", + "EO2 = MF -((q/(2*pi*e0))*(dRrO2+drO2))\n", + "print\"EO2 = kV/m \\t\",EO2\n", + "\n", + "#field at the inner point of subconductor #1 \n", + "drI1 = 1/(d-r)\n", + "dRrI1 = 1/(d+R-r)\n", + "EI1 = MSF -((q/(2*pi*e0))*(drI1+dRrI1))\n", + "print\"EI1 = kV/m \\t\",EI1\n", + "#field at the inner point of subconductor #2 \n", + "drI2 = 1/(d+r)\n", + "dRrI2 = 1/(d-R+r)\n", + "EI2 = MSF -((q/(2*pi*e0))*(dRrI2+drI2)) \n", + "print\"EI2 = kV/m \\t\",EI2\n", + "\n", + "#(part c)Average of the maximim gradient\n", + "print\"\\tPart c\\t\"\n", + "Eavg = (EO1+EO2)/2\n", + "print\"The average of the maximum gradient = kV/m \\t\",Eavg\n", + "\n", + "\n", + "#Answers might vary due to round off error\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_7 pgno:69" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Electric Feild = V/m \t30015596280.4\n" + ] + } + ], + "source": [ + "#Chapter 2, Exmaple 7, page 69\n", + "#Electric feild induced at x\n", + "from math import pi\n", + "e0 = 8.85418*10**-12 #Epselon nought\n", + "q = 1 # C/m\n", + "C = (q/(2*pi*e0))\n", + "#Based on figure 2.33\n", + "E = C-(C*(1./3.+1./7.))+(C*(1+1./5.+1./9.))+(C*(1./5.+1./9.))-(C*(1./3.+1./7.))\n", + "print\"Electric Feild = V/m \\t\",E\n", + "\n", + "#Answers might vary due to round off error\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_8 pgno:70" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Thickness of graded design= cm 4.24264068712\n", + "Curve = cm**2 62.4264068712\n", + "V1 = cm**3 47402.906725\n", + "Thickness of regular design = cm 14.684289433\n", + "V2 = cm**3 861.944682812\n" + ] + } + ], + "source": [ + "#Chapter 2, Exmaple 8, page 70\n", + "#Calculate the volume of the insulator\n", + "#Thinkness of graded design\n", + "from math import e\n", + "from math import pi\n", + "V = 150*(2)**0.5\n", + "Ebd = 50\n", + "T = V/Ebd\n", + "print\"\\nThickness of graded design= cm \",T\n", + "#Based on figure 2.24\n", + "r = 2 # radius of the conductor\n", + "l = 10 #length of graded cylinder; The textbook uses 10 instead of 20\n", + "zr = l*(T+r)\n", + "print\"Curve = cm**2 \",zr\n", + "#Volume of graded design V1\n", + "V1 = 4*pi*zr*(zr-r)\n", + "print\"V1 = cm**3 \",V1 #Unit is wrong in the textbook\n", + "#Thickness of regular design as obtained form Eq.2.77\n", + "pow = V/(2*Ebd)\n", + "t = 2*(e**pow-1)\n", + "print\"Thickness of regular design = cm \",t\n", + "#Volume of regular design V2\n", + "V2 = pi*((2+t)**2-4)\n", + "print\"V2 = cm**3 \",V2#unit not mentioned in textbook\n", + " \n", + "#Answers may vary due to round off error\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_11 pgno:75" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The values of Phi2 and Phi4 are: [[ -3.6568 326.5 ]\n", + " [ 261.92857143 -4.37537287]]\n" + ] + } + ], + "source": [ + "#Chapter 2, Exmaple 11, page 75\n", + "#Calculate the potential within the mesh\n", + "#Based on figure 2.38(b)\n", + "#equations are obtained using Eq.2.46\n", + "import numpy\n", + "from numpy import linalg\n", + "A1 = 1/2*(0.54+0.16)\n", + "A2 = 1/2*(0.91+0.14)\n", + "S = numpy.matrix([[0.5571, -0.4571, -0.1],[-0.4751, 0.828, 0.3667],[-0.1, 0.667, 0.4667]])\n", + "#By obtaining the elements of the global stiffness matrix(Sadiku,1994)\n", + "#and by emplying the Eq.2.49(a)\n", + "S1 = numpy.matrix([[1.25, -0.014],[-0.014, 0.8381]])\n", + "S2 = numpy.matrix([[-0.7786, -0.4571],[-0.4571, -0.3667]])\n", + "Phi13 = numpy.matrix([[0], [10]])\n", + "val1 = S2*Phi13\n", + "Phi24 = val1/S1\n", + "print\"The values of Phi2 and Phi4 are:\",Phi24\n", + "\n", + "#Answers may vary due to round of error \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/Vedantam Lakshmi Manasa/Chapter_2_Electric.ipynb b/sample_notebooks/Vedantam Lakshmi Manasa/Chapter_2_Electric.ipynb deleted file mode 100755 index cdc8b25e..00000000 --- a/sample_notebooks/Vedantam Lakshmi Manasa/Chapter_2_Electric.ipynb +++ /dev/null @@ -1,296 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 2 Electric Fields" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_5 pgno:65" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Maximum field = V/m per volt 42064315640.1\n" - ] - } - ], - "source": [ - "#Chapter 2, Example 5, page 65\n", - "#Calculate the maximum field at the sphere surface\n", - "#Calulating Field at surface E based on figure 2.31 and table 2.3\n", - "from math import pi\n", - "Q1 = 0.25\n", - "e0 = 8.85418*10**-12 #Epselon nought\n", - "RV1= ((1/0.25**2)+(0.067/(0.25-0.067)**2)+(0.0048/(0.25-0.067)**2))\n", - "RV2= ((0.25+0.01795+0.00128)/(0.75-0.067)**2)\n", - "RV= RV1+RV2\n", - "E = (Q1*RV)/(4*pi*e0)\n", - "print\"Maximum field = V/m per volt\",E\n", - "\n", - "#Answers vary due to round off error\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_6 pgno:66" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "#Chapter 2, Exmaple 6, page 66\n", - "#calculation based on figure 2.32\n", - "\n", - "#(a)Charge on each bundle\n", - "print\"Part a\\t\"\n", - "req = (0.0175*0.45)**0.5\n", - "print\"Equivalent radius = m \", req\n", - "from math import log\n", - "from math import pi\n", - "V = 400*10**3 #Voltage\n", - "H = 12. #bundle height in m\n", - "d = 9. #pole to pole spacing in m\n", - "e0 = 8.85418*10**-12 #Epselon nought\n", - "Hd = ((2*H)**2+d**2)**0.5#2*H**2 + d**2\n", - "Q = V*2*pi*e0/(log((2*H/req))-log((Hd/d)))\n", - "q = Q/2\n", - "print\"Charge per bundle = uC/m \",Q #micro C/m\n", - "print\"Charge per sunconducter = uC/m \",q #micro C/m\n", - "\n", - "#(b part i)Maximim & average surface feild\n", - "print\"\\tPart b\"\n", - "print\"\\tSub part 1\\t\"\n", - "r = 0.0175 #subconductor radius\n", - "R = 0.45 #conductor to subconductor spacing\n", - "MF = (q/(2*pi*e0))*((1/r)+(1/R)) # maximum feild\n", - "print\"Maximum feild = kV/m \\t\",MF\n", - "MSF = (q/(2*pi*e0))*((1/r)-(1/R)) # maximum surface feild\n", - "print\"Maximum feild = kV/m \\t\",MSF\n", - "ASF = (q/(2*pi*e0))*(1/r) # Average surface feild\n", - "print\"Maximum feild = kV/m \\t\",ASF\n", - "\n", - "#(b part ii) Considering the two sunconductors on the left\n", - "print\"\\tSub part 2\\t\"\n", - "#field at the outer point of subconductor #1 \n", - "drO1 = 1/(d+r)\n", - "dRrO1 = 1/(d+R+r)\n", - "EO1 = MF -((q/(2*pi*e0))*(drO1+dRrO1))\n", - "print\"EO1 = kV/m \\t\",EO1\n", - "#field at the outer point of subconductor #2 \n", - "drO2 = 1/(d-r)\n", - "dRrO2 = 1/(d-R-r)\n", - "EO2 = MF -((q/(2*pi*e0))*(dRrO2+drO2))\n", - "print\"EO2 = kV/m \\t\",EO2\n", - "\n", - "#field at the inner point of subconductor #1 \n", - "drI1 = 1/(d-r)\n", - "dRrI1 = 1/(d+R-r)\n", - "EI1 = MSF -((q/(2*pi*e0))*(drI1+dRrI1))\n", - "print\"EI1 = kV/m \\t\",EI1\n", - "#field at the inner point of subconductor #2 \n", - "drI2 = 1/(d+r)\n", - "dRrI2 = 1/(d-R+r)\n", - "EI2 = MSF -((q/(2*pi*e0))*(dRrI2+drI2)) \n", - "print\"EI2 = kV/m \\t\",EI2\n", - "\n", - "#(part c)Average of the maximim gradient\n", - "print\"\\tPart c\\t\"\n", - "Eavg = (EO1+EO2)/2\n", - "print\"The average of the maximum gradient = kV/m \\t\",Eavg\n", - "\n", - "\n", - "#Answers might vary due to round off error\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_7 pgno:69" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Electric Feild = V/m \t30015596280.4\n" - ] - } - ], - "source": [ - "#Chapter 2, Exmaple 7, page 69\n", - "#Electric feild induced at x\n", - "from math import pi\n", - "e0 = 8.85418*10**-12 #Epselon nought\n", - "q = 1 # C/m\n", - "C = (q/(2*pi*e0))\n", - "#Based on figure 2.33\n", - "E = C-(C*(1./3.+1./7.))+(C*(1+1./5.+1./9.))+(C*(1./5.+1./9.))-(C*(1./3.+1./7.))\n", - "print\"Electric Feild = V/m \\t\",E\n", - "\n", - "#Answers might vary due to round off error\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_8 pgno:70" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "Thickness of graded design= cm 4.24264068712\n", - "Curve = cm**2 62.4264068712\n", - "V1 = cm**3 47402.906725\n", - "Thickness of regular design = cm 14.684289433\n", - "V2 = cm**3 861.944682812\n" - ] - } - ], - "source": [ - "#Chapter 2, Exmaple 8, page 70\n", - "#Calculate the volume of the insulator\n", - "#Thinkness of graded design\n", - "from math import e\n", - "from math import pi\n", - "V = 150*(2)**0.5\n", - "Ebd = 50\n", - "T = V/Ebd\n", - "print\"\\nThickness of graded design= cm \",T\n", - "#Based on figure 2.24\n", - "r = 2 # radius of the conductor\n", - "l = 10 #length of graded cylinder; The textbook uses 10 instead of 20\n", - "zr = l*(T+r)\n", - "print\"Curve = cm**2 \",zr\n", - "#Volume of graded design V1\n", - "V1 = 4*pi*zr*(zr-r)\n", - "print\"V1 = cm**3 \",V1 #Unit is wrong in the textbook\n", - "#Thickness of regular design as obtained form Eq.2.77\n", - "pow = V/(2*Ebd)\n", - "t = 2*(e**pow-1)\n", - "print\"Thickness of regular design = cm \",t\n", - "#Volume of regular design V2\n", - "V2 = pi*((2+t)**2-4)\n", - "print\"V2 = cm**3 \",V2#unit not mentioned in textbook\n", - " \n", - "#Answers may vary due to round off error\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_11 pgno:75" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The values of Phi2 and Phi4 are: [[ -3.6568 326.5 ]\n", - " [ 261.92857143 -4.37537287]]\n" - ] - } - ], - "source": [ - "#Chapter 2, Exmaple 11, page 75\n", - "#Calculate the potential within the mesh\n", - "#Based on figure 2.38(b)\n", - "#equations are obtained using Eq.2.46\n", - "import numpy\n", - "from numpy import linalg\n", - "A1 = 1/2*(0.54+0.16)\n", - "A2 = 1/2*(0.91+0.14)\n", - "S = numpy.matrix([[0.5571, -0.4571, -0.1],[-0.4751, 0.828, 0.3667],[-0.1, 0.667, 0.4667]])\n", - "#By obtaining the elements of the global stiffness matrix(Sadiku,1994)\n", - "#and by emplying the Eq.2.49(a)\n", - "S1 = numpy.matrix([[1.25, -0.014],[-0.014, 0.8381]])\n", - "S2 = numpy.matrix([[-0.7786, -0.4571],[-0.4571, -0.3667]])\n", - "Phi13 = numpy.matrix([[0], [10]])\n", - "val1 = S2*Phi13\n", - "Phi24 = val1/S1\n", - "print\"The values of Phi2 and Phi4 are:\",Phi24\n", - "\n", - "#Answers may vary due to round of error \n", - "\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/asmitaasmita/asmitaasmita_version_backup/1_An_overview.ipynb b/sample_notebooks/asmitaasmita/asmitaasmita_version_backup/1_An_overview.ipynb new file mode 100755 index 00000000..ecf52ddd --- /dev/null +++ b/sample_notebooks/asmitaasmita/asmitaasmita_version_backup/1_An_overview.ipynb @@ -0,0 +1,254 @@ +{ + "metadata": { + "name": "1 An overview of C++" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "code", + "collapsed": false, + "input": "#Ex 1 , Page Number: 14#\\n#This program outputs a string, two integer values, and a double floating-point value. #\ni=10\nj=20\nd=99.101\nprint ('Here are some values : %d %d %2.3f'%(i,j,d))\n ", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Here are some values : 10 20 99.101\n" + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#Ex 3 , Page Number: 16#\n\n#Variable declaration\ni=100\n\n#Result\nprint('Enter a value: 100')\nprint 'Here\\'s your number: ',i\n\n", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Enter a value: 100\nHere's your number: 100\n" + } + ], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#Ex 4 , Page Number 16#\n\n#Variable declaration\ni=10\nf=100.12\ns='Hello World'\n\n#Result\nprint 'Enter an integer,float and string: ',i,f,s\nprint 'Here\\'s your data: ',i,f,s \n ", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": " Enter an integer,float and string: 10 100.12 Hello World\nHere's your data: 10 100.12 Hello World\n" + } + ], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#Ex 5 , Page Number 17#\n\n#Variable declaration\nch='X'\n\n#Result\nprint 'Enter keys,X to stop.'\n\n#while loop\nwhile ch!='X':\n if(ch!='X'): \n print ': ',ch\n else:\n break", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Enter keys,X to stop.\n" + } + ], + "prompt_number": 4 + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#Ex 1 , Page Number 19#\n\n#Variable declaration\na=199\n\nprint 'Enter number to be tested: ',a\n#if loop\nif a % 2 == 0:\n#Result\n print 'Number is even'\nelse:\n print 'Number is odd'\n", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Enter number to be tested: 199\nNumber is odd\n" + } + ], + "prompt_number": 5 + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#Ex 3 ,Page Number 25#\n\n#class declaration\nclass Myclass():\n def __init__(self,c,d):\n self.a = c\n self.b = d\nobj = Myclass(10,99)\nobj.a,obj.b\n\n#Result\nprint obj.a\nprint obj.b", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "10\n99\n" + } + ], + "prompt_number": 6 + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#Ex 2 , Page Number 30#\n\n#DefiningFunction\ndef sum(a,b):\n return a+b\na=10\nb=40\n\n#Result\nprint 'Enter two numbers: ',a,b\nprint 'Sum is: ',sum(a,b)", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Enter two numbers: 10 40\nSum is: 50\n" + } + ], + "prompt_number": 7 + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#Ex 3 , Page Number 31#\n\n#Variable declaration\ni=5\nprint 'Enter number: ',i\nfact=1\nfor j in range(i):\n fact = fact * (j+1)\n \n#Result\nprint 'Factorial is ',fact\n", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Enter number: 5\nFactorial is 120\n" + } + ], + "prompt_number": 8 + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#Ex 4 ,Page Number 32#\n\noutcome = 'false'\n\n#if loop\nif(outcome):\n print 'true'\nelse:\n print 'false'", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "true\n" + } + ], + "prompt_number": 9 + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#Ex 2 ,Page Number 36#\n\n#Defining function\ndef get_date(day=None, month=None, year=None, as_string=None):\n\tif as_string:\n\t\tprint 'Date:', as_string\n\telse:\n\t\tif not (day and month and year):\n\t\t\traise Exception(\"Invalid Date arguments\")\n\t\tprint \"Date : %d/%d/%d\" % (month, day, year)\n\n\nif __name__ == '__main__':\n\tget_date(as_string=\"3/12/2013\")\n\tget_date(day=12, month=3, year=2013)\n", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Date: 3/12/2013\nDate : 3/12/2013\n" + } + ], + "prompt_number": 10 + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#Exercise 1.3 Q3 , Page Number 18#\n\n#Variable declaration\na=4\nb=8\nd=2\nprint 'Enter two numbers: ',a,b\nif a>b:\n min=b\nelse:\n min=a\nfor d in range(d,min):\n if a % d == 0 and b % d == 0: \n break\nif d == min:\n print 'No common denominators ' \nelse:\n print 'The lowest common denominator is ',d\n", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Enter two numbers: 4 8\nThe lowest common denominator is 2\n" + } + ], + "prompt_number": 11 + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#Ex 1 , Page Number 34#\n\nprint 'Absolute value of -10: ',abs(-10)\nprint 'Absolute value of -10L: ',abs(-10L)\nprint 'Absolute value of -10.01: ',abs(-10.01)\n\n#Defining function\ndef abs(n):\n print 'In integer abs() '\n \n\ndef abs(n):\n print 'In longs abs() '\n\ndef abs(n):\n print 'In double abs() '\n", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Absolute value of -10: 10\nAbsolute value of -10L: 10\nAbsolute value of -10.01: 10.01\n" + } + ], + "prompt_number": 12 + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#Excercise 1 , Page Number 18#\n\n#Variable declaration\nhours=3\nwage=2000\n\n#Result\nprint 'Enter hours worked: ',hours\n\nprint 'Enter wage per hour: ',wage\nprint 'Pay is: $',wage*hours", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Enter hours worked: 3\nEnter wage per hour: 2000\nPay is: $ 6000\n" + } + ], + "prompt_number": 13 + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#Exercise 2 , Page Number 18#\n\n#Variable declaration\nfeet = 5.0\n\n#If loop\nif(feet == 0.0):\n print 'Wrong inpt.'\nelse:\n print 'Enter feet :',feet\n #Result\n print feet*12,'inches'\n ", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Enter feet : 5.0\n60.0 inches\n" + } + ], + "prompt_number": 14 + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#Exercise 1.7 Q1 , Page Number 38#\n\nimport math\n\n#Result\nprint 'Square root of 90.34 is : ',math.sqrt(90.34)\nprint 'Square root of 90L is: ',math.sqrt(90L)\nprint 'Square root of 90 is: ',math.sqrt(90)\n\n#Defining functions\ndef sqrt(n):\n print 'computing integer root '\n \n\ndef sqrt(n):\n print 'computing long root '\n\ndef sqrt(n):\n print 'computing double root '", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Square root of 90.34 is : 9.50473566176\nSquare root of 90L is: 9.48683298051\nSquare root of 90 is: 9.48683298051\n" + } + ], + "prompt_number": 15 + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#Example 3 , Page Number 36#\n\n#Defining functions\ndef f1(a=None,b=None,c=None):\n if a:\n print 'In f1',(a)\n else:\n if not (b and c):\n raise Exception(\"Invalid arguments\")\n print 'In f1',(b,c)\nif __name__ == '__main__':\n\tf1(a=10)\n\tf1(b=10, c=20)", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "In f1 10\nIn f1 (10, 20)\n" + } + ], + "prompt_number": 16 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/asmitaasmita/asmitaasmita_version_backup/1_An_overview_of.ipynb b/sample_notebooks/asmitaasmita/asmitaasmita_version_backup/1_An_overview_of.ipynb deleted file mode 100755 index ecf52ddd..00000000 --- a/sample_notebooks/asmitaasmita/asmitaasmita_version_backup/1_An_overview_of.ipynb +++ /dev/null @@ -1,254 +0,0 @@ -{ - "metadata": { - "name": "1 An overview of C++" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "code", - "collapsed": false, - "input": "#Ex 1 , Page Number: 14#\\n#This program outputs a string, two integer values, and a double floating-point value. #\ni=10\nj=20\nd=99.101\nprint ('Here are some values : %d %d %2.3f'%(i,j,d))\n ", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Here are some values : 10 20 99.101\n" - } - ], - "prompt_number": 1 - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#Ex 3 , Page Number: 16#\n\n#Variable declaration\ni=100\n\n#Result\nprint('Enter a value: 100')\nprint 'Here\\'s your number: ',i\n\n", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Enter a value: 100\nHere's your number: 100\n" - } - ], - "prompt_number": 2 - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#Ex 4 , Page Number 16#\n\n#Variable declaration\ni=10\nf=100.12\ns='Hello World'\n\n#Result\nprint 'Enter an integer,float and string: ',i,f,s\nprint 'Here\\'s your data: ',i,f,s \n ", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": " Enter an integer,float and string: 10 100.12 Hello World\nHere's your data: 10 100.12 Hello World\n" - } - ], - "prompt_number": 2 - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#Ex 5 , Page Number 17#\n\n#Variable declaration\nch='X'\n\n#Result\nprint 'Enter keys,X to stop.'\n\n#while loop\nwhile ch!='X':\n if(ch!='X'): \n print ': ',ch\n else:\n break", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Enter keys,X to stop.\n" - } - ], - "prompt_number": 4 - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#Ex 1 , Page Number 19#\n\n#Variable declaration\na=199\n\nprint 'Enter number to be tested: ',a\n#if loop\nif a % 2 == 0:\n#Result\n print 'Number is even'\nelse:\n print 'Number is odd'\n", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Enter number to be tested: 199\nNumber is odd\n" - } - ], - "prompt_number": 5 - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#Ex 3 ,Page Number 25#\n\n#class declaration\nclass Myclass():\n def __init__(self,c,d):\n self.a = c\n self.b = d\nobj = Myclass(10,99)\nobj.a,obj.b\n\n#Result\nprint obj.a\nprint obj.b", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "10\n99\n" - } - ], - "prompt_number": 6 - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#Ex 2 , Page Number 30#\n\n#DefiningFunction\ndef sum(a,b):\n return a+b\na=10\nb=40\n\n#Result\nprint 'Enter two numbers: ',a,b\nprint 'Sum is: ',sum(a,b)", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Enter two numbers: 10 40\nSum is: 50\n" - } - ], - "prompt_number": 7 - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#Ex 3 , Page Number 31#\n\n#Variable declaration\ni=5\nprint 'Enter number: ',i\nfact=1\nfor j in range(i):\n fact = fact * (j+1)\n \n#Result\nprint 'Factorial is ',fact\n", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Enter number: 5\nFactorial is 120\n" - } - ], - "prompt_number": 8 - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#Ex 4 ,Page Number 32#\n\noutcome = 'false'\n\n#if loop\nif(outcome):\n print 'true'\nelse:\n print 'false'", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "true\n" - } - ], - "prompt_number": 9 - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#Ex 2 ,Page Number 36#\n\n#Defining function\ndef get_date(day=None, month=None, year=None, as_string=None):\n\tif as_string:\n\t\tprint 'Date:', as_string\n\telse:\n\t\tif not (day and month and year):\n\t\t\traise Exception(\"Invalid Date arguments\")\n\t\tprint \"Date : %d/%d/%d\" % (month, day, year)\n\n\nif __name__ == '__main__':\n\tget_date(as_string=\"3/12/2013\")\n\tget_date(day=12, month=3, year=2013)\n", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Date: 3/12/2013\nDate : 3/12/2013\n" - } - ], - "prompt_number": 10 - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#Exercise 1.3 Q3 , Page Number 18#\n\n#Variable declaration\na=4\nb=8\nd=2\nprint 'Enter two numbers: ',a,b\nif a>b:\n min=b\nelse:\n min=a\nfor d in range(d,min):\n if a % d == 0 and b % d == 0: \n break\nif d == min:\n print 'No common denominators ' \nelse:\n print 'The lowest common denominator is ',d\n", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Enter two numbers: 4 8\nThe lowest common denominator is 2\n" - } - ], - "prompt_number": 11 - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#Ex 1 , Page Number 34#\n\nprint 'Absolute value of -10: ',abs(-10)\nprint 'Absolute value of -10L: ',abs(-10L)\nprint 'Absolute value of -10.01: ',abs(-10.01)\n\n#Defining function\ndef abs(n):\n print 'In integer abs() '\n \n\ndef abs(n):\n print 'In longs abs() '\n\ndef abs(n):\n print 'In double abs() '\n", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Absolute value of -10: 10\nAbsolute value of -10L: 10\nAbsolute value of -10.01: 10.01\n" - } - ], - "prompt_number": 12 - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#Excercise 1 , Page Number 18#\n\n#Variable declaration\nhours=3\nwage=2000\n\n#Result\nprint 'Enter hours worked: ',hours\n\nprint 'Enter wage per hour: ',wage\nprint 'Pay is: $',wage*hours", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Enter hours worked: 3\nEnter wage per hour: 2000\nPay is: $ 6000\n" - } - ], - "prompt_number": 13 - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#Exercise 2 , Page Number 18#\n\n#Variable declaration\nfeet = 5.0\n\n#If loop\nif(feet == 0.0):\n print 'Wrong inpt.'\nelse:\n print 'Enter feet :',feet\n #Result\n print feet*12,'inches'\n ", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Enter feet : 5.0\n60.0 inches\n" - } - ], - "prompt_number": 14 - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#Exercise 1.7 Q1 , Page Number 38#\n\nimport math\n\n#Result\nprint 'Square root of 90.34 is : ',math.sqrt(90.34)\nprint 'Square root of 90L is: ',math.sqrt(90L)\nprint 'Square root of 90 is: ',math.sqrt(90)\n\n#Defining functions\ndef sqrt(n):\n print 'computing integer root '\n \n\ndef sqrt(n):\n print 'computing long root '\n\ndef sqrt(n):\n print 'computing double root '", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Square root of 90.34 is : 9.50473566176\nSquare root of 90L is: 9.48683298051\nSquare root of 90 is: 9.48683298051\n" - } - ], - "prompt_number": 15 - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#Example 3 , Page Number 36#\n\n#Defining functions\ndef f1(a=None,b=None,c=None):\n if a:\n print 'In f1',(a)\n else:\n if not (b and c):\n raise Exception(\"Invalid arguments\")\n print 'In f1',(b,c)\nif __name__ == '__main__':\n\tf1(a=10)\n\tf1(b=10, c=20)", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "In f1 10\nIn f1 (10, 20)\n" - } - ], - "prompt_number": 16 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/harikagunturu/harikagunturu_version_backup/Chapter_4.ipynb b/sample_notebooks/harikagunturu/harikagunturu_version_backup/Chapter_4.ipynb new file mode 100755 index 00000000..de7d514c --- /dev/null +++ b/sample_notebooks/harikagunturu/harikagunturu_version_backup/Chapter_4.ipynb @@ -0,0 +1,666 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4 Angle Modulation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.1.A page.no: 286" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "12000 the new deviation( in Hz)\n" + ] + } + ], + "source": [ + "Freq_dev=6; #Frequency Deviation in kHz\n", + "Vm=3; #Modulating Voltage in V\n", + "Dev=Freq_dev*10**3/Vm; \n", + "# for Vm=6V\n", + "Vm=6;\n", + "Freq_dev_new=Dev*Vm;\n", + "print Freq_dev_new,\"the new deviation( in Hz)\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.1 page.no: 287" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Instantaneous Frequency(in Hz) at (t=0.4 ms)N = 100290.574948\n", + "Maximum Phase Deviation (in rad) = 3\n", + "MAximum Frequency Deiation (in Hz)= 300.0\n" + ] + } + ], + "source": [ + "from math import pi,cos\n", + "\n", + "t1=0.4;# time in ms\n", + "Ang_Freq =2*pi*10**5 +3*2*pi*100*cos(2*pi*100*(t1*10**(-3)));\n", + "Freq=Ang_Freq/(2*pi);\n", + "#change in answer due to calculation error in book\n", + "print \"Instantaneous Frequency(in Hz) at (t=0.4 ms)N = \",Freq\n", + "Max_pha_Dev=3; #max(3sin(2∗pi∗100t))\n", + "print \"Maximum Phase Deviation (in rad) = \",Max_pha_Dev\n", + "Max_fre_Dev=6*pi*100; #max(6∗pi∗100∗cos(2∗pi∗100t))\n", + "print \"MAximum Frequency Deiation (in Hz)= \",Max_fre_Dev/(2*pi)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.2.A page.no: 287" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Power Dissipated (in W) is 9.375\n" + ] + } + ], + "source": [ + "from math import pi,sqrt\n", + "\n", + "Wc=8*10**(8);# Angular Frequency of Carrier Signal\n", + "fc=Wc/(2*pi);\n", + "Wm=1300;#Angular Frequency of Message Signal\n", + "fm=Wm/(2*pi);\n", + "B=3;#Modulation Index\n", + "R=12;\n", + "Vc_rms=15/sqrt(2);\n", + "Max_dev=B*fm;\n", + "Power=Vc_rms**(2)/R;\n", + "print \"Power Dissipated (in W) is \",Power" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.2 page.no: 287" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Peak Frequency Deviation(in Hz) is 12000\n", + "modulation index 8.0\n" + ] + } + ], + "source": [ + "a=3;#amplitude in volts\n", + "Dev_sen=4;# deviation sensitivity in KHz/volts\n", + "fm=1.5;# frequency modulating signal in KHz\n", + "f=Dev_sen*10**(3)*3;#peak frequency deviation\n", + "B=f/(fm*10**3);\n", + "print \"Peak Frequency Deviation(in Hz) is \",f\n", + "print \"modulation index \",B" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.3.A page.no: 289" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The Bandwidth (in Hz) is 72000\n" + ] + } + ], + "source": [ + "fm=3; #Modulating Frequency in kHZ\n", + "Max_Dev=18; #MAximum Deviation in kHz\n", + "B=Max_Dev/fm; # modulation index 7\n", + "J=12;#from Bessel Table , for B=6\n", + "Bw=fm*J*2*10**(3);\n", + "print \"The Bandwidth (in Hz) is \",Bw" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.3 page.no: 289" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Peak Phase Deviation( in rad) 8.75\n" + ] + } + ], + "source": [ + "Dev_sen=3.5 # Deviation Sensitivity in rad/volt\n", + "a=2.5; #amplitude in volts\n", + "B=a*Dev_sen; # Peak Phase Deviation\n", + "print \"Peak Phase Deviation( in rad) \",B" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.4.A page.no: 290" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Maximum Frequency Deviation (in Hz) is 18000\n", + "Modulation Index is 5.99985864877\n" + ] + } + ], + "source": [ + "from math import pi\n", + "\n", + "Wm=18850;#Angular Frequency of message signal\n", + "fm=Wm/(2*pi);\n", + "a=3;# amplitude of message signal\n", + "Dev_sen=6;#Deviation Sensitivity in kHz/V\n", + "Max_Freq_Dev=a*Dev_sen*10**(3);\n", + "B=Max_Freq_Dev/(fm);\n", + "print \"Maximum Frequency Deviation (in Hz) is \",Max_Freq_Dev\n", + "print \"Modulation Index is \",B" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.4 page.no: 291" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Deviation Sensitivity(in kHz/V) 1333\n", + "Modulation Index is 4\n", + "Deviation Sensitivity for 5V (in Hz) 6665\n", + "Modulation index 6\n", + "Deviation Sensitivity for 10V (in Hz) 13330\n", + "Modulation index is 33\n" + ] + } + ], + "source": [ + "a=3; #amplitude in Volts\n", + "Dev=4;# Deviation in kHz\n", + "fm=1;# modulating frequency in kHz\n", + "Dev_sen=Dev*10**(3)/a; #Deviation Sensitivity\n", + "B=Dev/fm; # Modulation Index\n", + "print \"Deviation Sensitivity(in kHz/V) \",Dev_sen\n", + "print \"Modulation Index is \",B\n", + "#a)\n", + "a=5;\n", + "Dev_sen_1=a*Dev_sen;\n", + "B=Dev_sen_1/(fm*10**(3));\n", + "print \"Deviation Sensitivity for 5V (in Hz) \",Dev_sen_1\n", + "print \"Modulation index\",B\n", + "#b)\n", + "a=10;\n", + "fm=400;\n", + "Dev_sen_2=a*Dev_sen;\n", + "B=Dev_sen_2/fm;\n", + "print \"Deviation Sensitivity for 10V (in Hz) \",Dev_sen_2\n", + "print \"Modulation index is \",B" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.5.A page.no: 291" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "for B=2, The number of significant frequencies are 6\n", + "They are J1,J2,J3,J4,J5 and J6\n", + "Their amplitudes with carriers are \n", + "they are (in V) 1.792 4.616 2.824 1.032 0.272 0.056 0.008\n" + ] + } + ], + "source": [ + "print \"for B=2, The number of significant frequencies are 6\"\n", + "print \"They are J1,J2,J3,J4,J5 and J6\"\n", + "print \"Their amplitudes with carriers are \"\n", + "J0= 0.224*8;\n", + "J1= 0.577*8;\n", + "J2= 0.353*8;\n", + "J3= 0.129*8;\n", + "J4= 0.034*8;\n", + "J5= 0.007*8;\n", + "J6= 0.001*8;\n", + "print\"they are (in V)\",J0,J1,J2,J3,J4,J5,J6" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.5 page.no: 292" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Bandwidth required (in Hz) 24000\n", + "According to Carsons rule , Bandwidth (in Hz) 36000\n" + ] + } + ], + "source": [ + "fm=3; #Modulating Frequency in kHZ\n", + "Max_dev=15;# Maximum Deviatin in kHZ\n", + "B=Max_dev/fm; \n", + "J=8; # Bessel table , the highest J coefficient\n", + "BW=J*fm*10**(3);#Bandwidth in kHz\n", + "BW1=2*(fm+Max_dev)*10**(3);# According to carson rule , BAndwidth\n", + "print \"Bandwidth required (in Hz) \",BW\n", + "print \"According to Carsons rule , Bandwidth (in Hz) \",BW1" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.6.A page.no: 292" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Minimum Bandwidth (in Hz) is 72000\n", + "Approximate Minimum Bandwidth is 36000\n" + ] + } + ], + "source": [ + "Max_Freq_Dev=12; #Maximum Frequency Deviation in kHZ\n", + "fm=6; #Modulating frquency in kHz\n", + "B=Max_Freq_Dev/fm;# Modulation index 7\n", + "J=6;#From Bessel Table , for B=2\n", + "Bw=2*J*6*10**(3);\n", + "BW_carson=2*(fm + Max_Freq_Dev)*10**(3);\n", + "print \"Minimum Bandwidth (in Hz) is \",Bw\n", + "print \"Approximate Minimum Bandwidth is \",BW_carson" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.6.A page.no: 283" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "For B=5 from the Bessel table ,The Bessel Function is taken upto J9\n", + "Hence the average power of the modulated signal (in W) is 9.936\n", + "Hence, the average power of the modulated signal is equal to \n", + "unmodulated carrier power\n" + ] + } + ], + "source": [ + "a=10; #Amplitude in V\n", + "Pt=a*(0.18**2 +2*(0.33**2+0.05**2+0.36**2+0.39**2+0.26**2+0.13**2+0.05**2+0.02**2+0.01**2))\n", + "print \"For B=5 from the Bessel table ,The Bessel Function is taken upto J9\"\n", + "print \"Hence the average power of the modulated signal (in W) is \",Pt\n", + "print \"Hence, the average power of the modulated signal is equal to \"\n", + "print \"unmodulated carrier power\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.7.A page.no: 294" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Unmodulated Power Carrier ( in W) = 1\n", + "Total Power in modulated wave(in W)= 1.06767573333\n", + "Power in the modulated wave is equal to \n", + "power in the unmodulated wave \n" + ] + } + ], + "source": [ + "a=8;# amplitude in V\n", + "r=30; # resistance in ohms\n", + "Pc_unmodulated=a**2/(2*r);\n", + "Pt=1.792**2/(2*30)+2*(4.616)**2/(2*30)+2*(2.824**2)/(2*30) +2*(1.032) **2/(2*30) +2*(0.272) **2/(2*30) +2*(0.056)**2/(2*30)+2*(0.008)**2/(2*30);\n", + "# change in answer due to approximations in the book\n", + "print \"Unmodulated Power Carrier ( in W) = \",Pc_unmodulated\n", + "print \"Total Power in modulated wave(in W)= \",Pt\n", + "print \"Power in the modulated wave is equal to \"\n", + "print \"power in the unmodulated wave \" \n", + "#\"Small error due to rounded off values in Bessel functions\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.7 page.no: 295" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the Phase Modulation Function = 12.0*sin(3000.0*pi*t)\n", + "The Modulated Wave Function = 12.0*sin(3000.0*pi*t) + 8*cos(20000*pi*t)\n" + ] + } + ], + "source": [ + "from sympy import symbols,sin,cos\n", + "\n", + "t,pi=symbols('t,pi') \n", + "Pha_dev=3.; #Phase Deviation constant in rad/V 6\n", + "# Phase Modulation Function\n", + "Pha_function=Pha_dev*4*sin(2.*pi*1.5*10**3*t);\n", + "Mod_wave=8*cos(2*pi*10**4*t)+Pha_function\n", + "print \"the Phase Modulation Function = \",Pha_function\n", + "print \"The Modulated Wave Function = \",Mod_wave" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.8 page.no: 295" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The outputs of the balanced modulator for these parameters\n", + "are same as the inputs \n", + "They remain unaltered \n", + "At the output of the Multiplier , \n", + "Fc(in kHz)= 9600 , Fm(in kHz)= 10 , B= 6.0\n", + "Frequency Deviation ( in kHz)= 60\n" + ] + } + ], + "source": [ + "initial_Freq_Dev=5; # frequency in kHz\n", + "B_initial=0.5; #modulation index\n", + "fm_initial=10;# message signal frequency in kHz\n", + "fc_initial=800; # carrier frequency in kHz\n", + "print \"The outputs of the balanced modulator for these parameters\"\n", + "print \"are same as the inputs \"\n", + "print \"They remain unaltered \"\n", + "#at the output of the multiplier 14\n", + "m=12;# multiplication factor\n", + "final_Freq_Dev=initial_Freq_Dev*m;\n", + "B_final=0.5*m;\n", + "fm_final=10; #modulating signal remains unaltered\n", + "fc_final=800*m;\n", + "print \"At the output of the Multiplier , \"\n", + "print \"Fc(in kHz)= \",fc_final,\", Fm(in kHz)= \",fm_final,\", B= \",B_final\n", + "print \"Frequency Deviation ( in kHz)= \",final_Freq_Dev" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.9.A page.no: 296" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a) MAster Oscillator Centre Frequency(in MHz) = 4.008\n", + "b) Frequency Deviation at the output of modulator(in KHz)= 2.4\n", + "c)Devaition ratio at the output of modulator 0.24\n", + "d)deviation ratio at power amplifier 6.0\n" + ] + } + ], + "source": [ + "ft=100.2; #final carrier frequency in MHz\n", + "Freq_Dev_ft=60.;# Frequency Deviation in KHz at power amplifier\n", + "fm=10.;#modulating frequency in KHz\n", + "m=25.;#multiplication factor\n", + "#a)\n", + "fc=ft/25.;\n", + "#b)\n", + "Freq_Dev=Freq_Dev_ft/25;\n", + "#c)\n", + "B=Freq_Dev/fm;\n", + "#d)\n", + "Bt=B*m;\n", + "print \"a) MAster Oscillator Centre Frequency(in MHz) = \",fc\n", + "print \"b) Frequency Deviation at the output of modulator(in KHz)= \",Freq_Dev\n", + "print \"c)Devaition ratio at the output of modulator \",B\n", + "print \"d)deviation ratio at power amplifier\",Bt" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exa 4.10.A page.no: 297" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a) Frequency Deviation(in Hz)= 5954.92965855\n", + "b) Devaition Ratio= 5.95492965855\n", + "c) Phase Deviation( in rad)= 8\n", + "d) Bandwidth( in Hz)= 13909.8593171\n" + ] + } + ], + "source": [ + "from math import pi\n", + "\n", + "#f(t)=5cos(Wc∗t+3sin(2000∗t)+5sin(2000∗pi∗t)) 5\n", + "fm=2000*pi/(2*pi); #bandwidth is the highest frequency component\n", + "#a) \n", + "Freq_dev=(6000+10000*pi)/(2*pi); 11\n", + "#b)\n", + "B=Freq_dev/fm; \n", + "#c)\n", + "Phase_dev=8;#Highest value of[3sin(2000t)+5sin(2000∗ pi∗t)]\n", + "#d)\n", + "Bw= 2*(fm+Freq_dev);\n", + "print \"a) Frequency Deviation(in Hz)= \",Freq_dev\n", + "print \"b) Devaition Ratio= \",B\n", + "print \"c) Phase Deviation( in rad)= \",Phase_dev\n", + "print \"d) Bandwidth( in Hz)= \",Bw" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/harikagunturu/harikagunturu_version_backup/Chapter_4_Angle.ipynb b/sample_notebooks/harikagunturu/harikagunturu_version_backup/Chapter_4_Angle.ipynb deleted file mode 100755 index de7d514c..00000000 --- a/sample_notebooks/harikagunturu/harikagunturu_version_backup/Chapter_4_Angle.ipynb +++ /dev/null @@ -1,666 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 4 Angle Modulation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.1.A page.no: 286" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "12000 the new deviation( in Hz)\n" - ] - } - ], - "source": [ - "Freq_dev=6; #Frequency Deviation in kHz\n", - "Vm=3; #Modulating Voltage in V\n", - "Dev=Freq_dev*10**3/Vm; \n", - "# for Vm=6V\n", - "Vm=6;\n", - "Freq_dev_new=Dev*Vm;\n", - "print Freq_dev_new,\"the new deviation( in Hz)\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.1 page.no: 287" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Instantaneous Frequency(in Hz) at (t=0.4 ms)N = 100290.574948\n", - "Maximum Phase Deviation (in rad) = 3\n", - "MAximum Frequency Deiation (in Hz)= 300.0\n" - ] - } - ], - "source": [ - "from math import pi,cos\n", - "\n", - "t1=0.4;# time in ms\n", - "Ang_Freq =2*pi*10**5 +3*2*pi*100*cos(2*pi*100*(t1*10**(-3)));\n", - "Freq=Ang_Freq/(2*pi);\n", - "#change in answer due to calculation error in book\n", - "print \"Instantaneous Frequency(in Hz) at (t=0.4 ms)N = \",Freq\n", - "Max_pha_Dev=3; #max(3sin(2∗pi∗100t))\n", - "print \"Maximum Phase Deviation (in rad) = \",Max_pha_Dev\n", - "Max_fre_Dev=6*pi*100; #max(6∗pi∗100∗cos(2∗pi∗100t))\n", - "print \"MAximum Frequency Deiation (in Hz)= \",Max_fre_Dev/(2*pi)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.2.A page.no: 287" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Power Dissipated (in W) is 9.375\n" - ] - } - ], - "source": [ - "from math import pi,sqrt\n", - "\n", - "Wc=8*10**(8);# Angular Frequency of Carrier Signal\n", - "fc=Wc/(2*pi);\n", - "Wm=1300;#Angular Frequency of Message Signal\n", - "fm=Wm/(2*pi);\n", - "B=3;#Modulation Index\n", - "R=12;\n", - "Vc_rms=15/sqrt(2);\n", - "Max_dev=B*fm;\n", - "Power=Vc_rms**(2)/R;\n", - "print \"Power Dissipated (in W) is \",Power" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.2 page.no: 287" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Peak Frequency Deviation(in Hz) is 12000\n", - "modulation index 8.0\n" - ] - } - ], - "source": [ - "a=3;#amplitude in volts\n", - "Dev_sen=4;# deviation sensitivity in KHz/volts\n", - "fm=1.5;# frequency modulating signal in KHz\n", - "f=Dev_sen*10**(3)*3;#peak frequency deviation\n", - "B=f/(fm*10**3);\n", - "print \"Peak Frequency Deviation(in Hz) is \",f\n", - "print \"modulation index \",B" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.3.A page.no: 289" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The Bandwidth (in Hz) is 72000\n" - ] - } - ], - "source": [ - "fm=3; #Modulating Frequency in kHZ\n", - "Max_Dev=18; #MAximum Deviation in kHz\n", - "B=Max_Dev/fm; # modulation index 7\n", - "J=12;#from Bessel Table , for B=6\n", - "Bw=fm*J*2*10**(3);\n", - "print \"The Bandwidth (in Hz) is \",Bw" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.3 page.no: 289" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Peak Phase Deviation( in rad) 8.75\n" - ] - } - ], - "source": [ - "Dev_sen=3.5 # Deviation Sensitivity in rad/volt\n", - "a=2.5; #amplitude in volts\n", - "B=a*Dev_sen; # Peak Phase Deviation\n", - "print \"Peak Phase Deviation( in rad) \",B" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.4.A page.no: 290" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Maximum Frequency Deviation (in Hz) is 18000\n", - "Modulation Index is 5.99985864877\n" - ] - } - ], - "source": [ - "from math import pi\n", - "\n", - "Wm=18850;#Angular Frequency of message signal\n", - "fm=Wm/(2*pi);\n", - "a=3;# amplitude of message signal\n", - "Dev_sen=6;#Deviation Sensitivity in kHz/V\n", - "Max_Freq_Dev=a*Dev_sen*10**(3);\n", - "B=Max_Freq_Dev/(fm);\n", - "print \"Maximum Frequency Deviation (in Hz) is \",Max_Freq_Dev\n", - "print \"Modulation Index is \",B" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.4 page.no: 291" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Deviation Sensitivity(in kHz/V) 1333\n", - "Modulation Index is 4\n", - "Deviation Sensitivity for 5V (in Hz) 6665\n", - "Modulation index 6\n", - "Deviation Sensitivity for 10V (in Hz) 13330\n", - "Modulation index is 33\n" - ] - } - ], - "source": [ - "a=3; #amplitude in Volts\n", - "Dev=4;# Deviation in kHz\n", - "fm=1;# modulating frequency in kHz\n", - "Dev_sen=Dev*10**(3)/a; #Deviation Sensitivity\n", - "B=Dev/fm; # Modulation Index\n", - "print \"Deviation Sensitivity(in kHz/V) \",Dev_sen\n", - "print \"Modulation Index is \",B\n", - "#a)\n", - "a=5;\n", - "Dev_sen_1=a*Dev_sen;\n", - "B=Dev_sen_1/(fm*10**(3));\n", - "print \"Deviation Sensitivity for 5V (in Hz) \",Dev_sen_1\n", - "print \"Modulation index\",B\n", - "#b)\n", - "a=10;\n", - "fm=400;\n", - "Dev_sen_2=a*Dev_sen;\n", - "B=Dev_sen_2/fm;\n", - "print \"Deviation Sensitivity for 10V (in Hz) \",Dev_sen_2\n", - "print \"Modulation index is \",B" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.5.A page.no: 291" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "for B=2, The number of significant frequencies are 6\n", - "They are J1,J2,J3,J4,J5 and J6\n", - "Their amplitudes with carriers are \n", - "they are (in V) 1.792 4.616 2.824 1.032 0.272 0.056 0.008\n" - ] - } - ], - "source": [ - "print \"for B=2, The number of significant frequencies are 6\"\n", - "print \"They are J1,J2,J3,J4,J5 and J6\"\n", - "print \"Their amplitudes with carriers are \"\n", - "J0= 0.224*8;\n", - "J1= 0.577*8;\n", - "J2= 0.353*8;\n", - "J3= 0.129*8;\n", - "J4= 0.034*8;\n", - "J5= 0.007*8;\n", - "J6= 0.001*8;\n", - "print\"they are (in V)\",J0,J1,J2,J3,J4,J5,J6" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.5 page.no: 292" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Bandwidth required (in Hz) 24000\n", - "According to Carsons rule , Bandwidth (in Hz) 36000\n" - ] - } - ], - "source": [ - "fm=3; #Modulating Frequency in kHZ\n", - "Max_dev=15;# Maximum Deviatin in kHZ\n", - "B=Max_dev/fm; \n", - "J=8; # Bessel table , the highest J coefficient\n", - "BW=J*fm*10**(3);#Bandwidth in kHz\n", - "BW1=2*(fm+Max_dev)*10**(3);# According to carson rule , BAndwidth\n", - "print \"Bandwidth required (in Hz) \",BW\n", - "print \"According to Carsons rule , Bandwidth (in Hz) \",BW1" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.6.A page.no: 292" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Minimum Bandwidth (in Hz) is 72000\n", - "Approximate Minimum Bandwidth is 36000\n" - ] - } - ], - "source": [ - "Max_Freq_Dev=12; #Maximum Frequency Deviation in kHZ\n", - "fm=6; #Modulating frquency in kHz\n", - "B=Max_Freq_Dev/fm;# Modulation index 7\n", - "J=6;#From Bessel Table , for B=2\n", - "Bw=2*J*6*10**(3);\n", - "BW_carson=2*(fm + Max_Freq_Dev)*10**(3);\n", - "print \"Minimum Bandwidth (in Hz) is \",Bw\n", - "print \"Approximate Minimum Bandwidth is \",BW_carson" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.6.A page.no: 283" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "For B=5 from the Bessel table ,The Bessel Function is taken upto J9\n", - "Hence the average power of the modulated signal (in W) is 9.936\n", - "Hence, the average power of the modulated signal is equal to \n", - "unmodulated carrier power\n" - ] - } - ], - "source": [ - "a=10; #Amplitude in V\n", - "Pt=a*(0.18**2 +2*(0.33**2+0.05**2+0.36**2+0.39**2+0.26**2+0.13**2+0.05**2+0.02**2+0.01**2))\n", - "print \"For B=5 from the Bessel table ,The Bessel Function is taken upto J9\"\n", - "print \"Hence the average power of the modulated signal (in W) is \",Pt\n", - "print \"Hence, the average power of the modulated signal is equal to \"\n", - "print \"unmodulated carrier power\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.7.A page.no: 294" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Unmodulated Power Carrier ( in W) = 1\n", - "Total Power in modulated wave(in W)= 1.06767573333\n", - "Power in the modulated wave is equal to \n", - "power in the unmodulated wave \n" - ] - } - ], - "source": [ - "a=8;# amplitude in V\n", - "r=30; # resistance in ohms\n", - "Pc_unmodulated=a**2/(2*r);\n", - "Pt=1.792**2/(2*30)+2*(4.616)**2/(2*30)+2*(2.824**2)/(2*30) +2*(1.032) **2/(2*30) +2*(0.272) **2/(2*30) +2*(0.056)**2/(2*30)+2*(0.008)**2/(2*30);\n", - "# change in answer due to approximations in the book\n", - "print \"Unmodulated Power Carrier ( in W) = \",Pc_unmodulated\n", - "print \"Total Power in modulated wave(in W)= \",Pt\n", - "print \"Power in the modulated wave is equal to \"\n", - "print \"power in the unmodulated wave \" \n", - "#\"Small error due to rounded off values in Bessel functions\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.7 page.no: 295" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the Phase Modulation Function = 12.0*sin(3000.0*pi*t)\n", - "The Modulated Wave Function = 12.0*sin(3000.0*pi*t) + 8*cos(20000*pi*t)\n" - ] - } - ], - "source": [ - "from sympy import symbols,sin,cos\n", - "\n", - "t,pi=symbols('t,pi') \n", - "Pha_dev=3.; #Phase Deviation constant in rad/V 6\n", - "# Phase Modulation Function\n", - "Pha_function=Pha_dev*4*sin(2.*pi*1.5*10**3*t);\n", - "Mod_wave=8*cos(2*pi*10**4*t)+Pha_function\n", - "print \"the Phase Modulation Function = \",Pha_function\n", - "print \"The Modulated Wave Function = \",Mod_wave" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.8 page.no: 295" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The outputs of the balanced modulator for these parameters\n", - "are same as the inputs \n", - "They remain unaltered \n", - "At the output of the Multiplier , \n", - "Fc(in kHz)= 9600 , Fm(in kHz)= 10 , B= 6.0\n", - "Frequency Deviation ( in kHz)= 60\n" - ] - } - ], - "source": [ - "initial_Freq_Dev=5; # frequency in kHz\n", - "B_initial=0.5; #modulation index\n", - "fm_initial=10;# message signal frequency in kHz\n", - "fc_initial=800; # carrier frequency in kHz\n", - "print \"The outputs of the balanced modulator for these parameters\"\n", - "print \"are same as the inputs \"\n", - "print \"They remain unaltered \"\n", - "#at the output of the multiplier 14\n", - "m=12;# multiplication factor\n", - "final_Freq_Dev=initial_Freq_Dev*m;\n", - "B_final=0.5*m;\n", - "fm_final=10; #modulating signal remains unaltered\n", - "fc_final=800*m;\n", - "print \"At the output of the Multiplier , \"\n", - "print \"Fc(in kHz)= \",fc_final,\", Fm(in kHz)= \",fm_final,\", B= \",B_final\n", - "print \"Frequency Deviation ( in kHz)= \",final_Freq_Dev" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.9.A page.no: 296" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a) MAster Oscillator Centre Frequency(in MHz) = 4.008\n", - "b) Frequency Deviation at the output of modulator(in KHz)= 2.4\n", - "c)Devaition ratio at the output of modulator 0.24\n", - "d)deviation ratio at power amplifier 6.0\n" - ] - } - ], - "source": [ - "ft=100.2; #final carrier frequency in MHz\n", - "Freq_Dev_ft=60.;# Frequency Deviation in KHz at power amplifier\n", - "fm=10.;#modulating frequency in KHz\n", - "m=25.;#multiplication factor\n", - "#a)\n", - "fc=ft/25.;\n", - "#b)\n", - "Freq_Dev=Freq_Dev_ft/25;\n", - "#c)\n", - "B=Freq_Dev/fm;\n", - "#d)\n", - "Bt=B*m;\n", - "print \"a) MAster Oscillator Centre Frequency(in MHz) = \",fc\n", - "print \"b) Frequency Deviation at the output of modulator(in KHz)= \",Freq_Dev\n", - "print \"c)Devaition ratio at the output of modulator \",B\n", - "print \"d)deviation ratio at power amplifier\",Bt" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exa 4.10.A page.no: 297" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "a) Frequency Deviation(in Hz)= 5954.92965855\n", - "b) Devaition Ratio= 5.95492965855\n", - "c) Phase Deviation( in rad)= 8\n", - "d) Bandwidth( in Hz)= 13909.8593171\n" - ] - } - ], - "source": [ - "from math import pi\n", - "\n", - "#f(t)=5cos(Wc∗t+3sin(2000∗t)+5sin(2000∗pi∗t)) 5\n", - "fm=2000*pi/(2*pi); #bandwidth is the highest frequency component\n", - "#a) \n", - "Freq_dev=(6000+10000*pi)/(2*pi); 11\n", - "#b)\n", - "B=Freq_dev/fm; \n", - "#c)\n", - "Phase_dev=8;#Highest value of[3sin(2000t)+5sin(2000∗ pi∗t)]\n", - "#d)\n", - "Bw= 2*(fm+Freq_dev);\n", - "print \"a) Frequency Deviation(in Hz)= \",Freq_dev\n", - "print \"b) Devaition Ratio= \",B\n", - "print \"c) Phase Deviation( in rad)= \",Phase_dev\n", - "print \"d) Bandwidth( in Hz)= \",Bw" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/karansingh/Thyristors_Principles.ipynb b/sample_notebooks/karansingh/Thyristors_Principles.ipynb new file mode 100755 index 00000000..4e252985 --- /dev/null +++ b/sample_notebooks/karansingh/Thyristors_Principles.ipynb @@ -0,0 +1,209 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:4abf44c9c11389b267bffebabb50666e37ae7ef97c6e1f36ae4dc72c5936a6d7" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Thyristors Principles & Characeristics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1_1 - page : 5" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given data\n", + "alfa1=0.35 \n", + "alfa2=0.4 \n", + "IG=40*10**-3 #A\n", + "#Solution :\n", + "IA=alfa2*IG/(1-(alfa1+alfa2)) #A\n", + "print \"Anode current is %0.3f A\" %IA" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Anode current is 0.064 A\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1_2 - page : 7" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given data\n", + "dv_dt=190 #V/\u00b5s\n", + "IC=8*10**-3 #A\n", + "#Solution :\n", + "C=IC/(dv_dt/10**-6) #F\n", + "print \"Capacitance of depletion layer is %0.1E F : \" %C" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Capacitance of depletion layer is 4.2E-11 F : \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1_3 - page : 8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given data\n", + "RG=2000 #ohm\n", + "VCC=20 #V\n", + "VT=0.75 #V\n", + "Vthy=0.7 #V(Voltage across thyristor)\n", + "R=200 #ohm\n", + "IT=7*10**-3 #A\n", + "Ih=5*10**-3 #A\n", + "#Solution :\n", + "#part (a)\n", + "Vo=VCC #V##thyristor not conducting\n", + "print \"(a) When thyristor is in off state, Output voltage is %0.2f V\" %Vo\n", + "#part (b)\n", + "Vs=VT+IT*RG #V\n", + "print \"(b) Voltage necessary to turn on the thyristor is %0.2f V\" %Vs\n", + "#part (c)\n", + "VR1=Ih*R #V\n", + "print \"(c) Current through thyristor should be less than holding current. Voltage should be reduced to less than %0.2f V\" %VR1\n", + "#part (d)\n", + "VR2=VR1+Vthy #V\n", + "print \"(d) VCC should be reduced to less than %0.2f V\" %VR2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) When thyristor is in off state, Output voltage is 20.00 V\n", + "(b) Voltage necessary to turn on the thyristor is 14.75 V\n", + "(c) Current through thyristor should be less than holding current. Voltage should be reduced to less than 1.00 V\n", + "(d) VCC should be reduced to less than 1.70 V\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1_5 - page : 8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given data\n", + "Vdc=100 #V\n", + "L=10 #H\n", + "i=80*10**-3 #A\n", + "#Solution :\n", + "t=i*L/Vdc #s\n", + "t*=1000 # ms\n", + "print \"Width of pulse should be more than %0.1f milli-seconds.\" %t" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Width of pulse should be more than 8.0 milli-seconds.\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1_6 - page : 9" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "#Given data\n", + "Vdc=100 #V\n", + "R=10 #ohm\n", + "L=5 #H\n", + "i=50*10**-3 #A\n", + "#Solution :\n", + "#i=Vdc/R*(1-exp(-R*t/L))\n", + "t=-math.log(1-i/Vdc*R)/R*L #s\n", + "t*=1000 #ms\n", + "print \"Minimum width of gate pulse is %0.1f milli-seconds.\" %t\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Minimum width of gate pulse is 2.5 milli-seconds.\n" + ] + } + ], + "prompt_number": 14 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/karansingh/Thyristors_Principles_&.ipynb b/sample_notebooks/karansingh/Thyristors_Principles_&.ipynb deleted file mode 100755 index 4e252985..00000000 --- a/sample_notebooks/karansingh/Thyristors_Principles_&.ipynb +++ /dev/null @@ -1,209 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:4abf44c9c11389b267bffebabb50666e37ae7ef97c6e1f36ae4dc72c5936a6d7" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Thyristors Principles & Characeristics" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1_1 - page : 5" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given data\n", - "alfa1=0.35 \n", - "alfa2=0.4 \n", - "IG=40*10**-3 #A\n", - "#Solution :\n", - "IA=alfa2*IG/(1-(alfa1+alfa2)) #A\n", - "print \"Anode current is %0.3f A\" %IA" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Anode current is 0.064 A\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1_2 - page : 7" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given data\n", - "dv_dt=190 #V/\u00b5s\n", - "IC=8*10**-3 #A\n", - "#Solution :\n", - "C=IC/(dv_dt/10**-6) #F\n", - "print \"Capacitance of depletion layer is %0.1E F : \" %C" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Capacitance of depletion layer is 4.2E-11 F : \n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1_3 - page : 8" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given data\n", - "RG=2000 #ohm\n", - "VCC=20 #V\n", - "VT=0.75 #V\n", - "Vthy=0.7 #V(Voltage across thyristor)\n", - "R=200 #ohm\n", - "IT=7*10**-3 #A\n", - "Ih=5*10**-3 #A\n", - "#Solution :\n", - "#part (a)\n", - "Vo=VCC #V##thyristor not conducting\n", - "print \"(a) When thyristor is in off state, Output voltage is %0.2f V\" %Vo\n", - "#part (b)\n", - "Vs=VT+IT*RG #V\n", - "print \"(b) Voltage necessary to turn on the thyristor is %0.2f V\" %Vs\n", - "#part (c)\n", - "VR1=Ih*R #V\n", - "print \"(c) Current through thyristor should be less than holding current. Voltage should be reduced to less than %0.2f V\" %VR1\n", - "#part (d)\n", - "VR2=VR1+Vthy #V\n", - "print \"(d) VCC should be reduced to less than %0.2f V\" %VR2" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(a) When thyristor is in off state, Output voltage is 20.00 V\n", - "(b) Voltage necessary to turn on the thyristor is 14.75 V\n", - "(c) Current through thyristor should be less than holding current. Voltage should be reduced to less than 1.00 V\n", - "(d) VCC should be reduced to less than 1.70 V\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1_5 - page : 8" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Given data\n", - "Vdc=100 #V\n", - "L=10 #H\n", - "i=80*10**-3 #A\n", - "#Solution :\n", - "t=i*L/Vdc #s\n", - "t*=1000 # ms\n", - "print \"Width of pulse should be more than %0.1f milli-seconds.\" %t" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Width of pulse should be more than 8.0 milli-seconds.\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1_6 - page : 9" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "#Given data\n", - "Vdc=100 #V\n", - "R=10 #ohm\n", - "L=5 #H\n", - "i=50*10**-3 #A\n", - "#Solution :\n", - "#i=Vdc/R*(1-exp(-R*t/L))\n", - "t=-math.log(1-i/Vdc*R)/R*L #s\n", - "t*=1000 #ms\n", - "print \"Minimum width of gate pulse is %0.1f milli-seconds.\" %t\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Minimum width of gate pulse is 2.5 milli-seconds.\n" - ] - } - ], - "prompt_number": 14 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/kotaDinesh Babu/kotaDinesh Babu_version_backup/samplebook(process.ipynb b/sample_notebooks/kotaDinesh Babu/kotaDinesh Babu_version_backup/samplebook(process.ipynb new file mode 100755 index 00000000..b114e915 --- /dev/null +++ b/sample_notebooks/kotaDinesh Babu/kotaDinesh Babu_version_backup/samplebook(process.ipynb @@ -0,0 +1,278 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#Chapter:2 CONDUCTION" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##Example2.1" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " heat is Btu/hr 69120.0\n", + "\t approximate values are mentioned in the book \n", + "\n" + ] + } + ], + "source": [ + "#given\n", + "Tavg=900; # average temperature of the wall,F\n", + "k=0.15; # Thermal conductivity at 932 F,Btu/(hr)(ft^2)(F/ft)\n", + "T1=1500; # hot side temperature,F\n", + "T2=300; # cold side temperature,F\n", + "A=192; # surface area,ft^2\n", + "L=0.5; # thickness,ft\n", + "#solution\n", + "Q=(k)*(A)*(T1-T2)/L; # formula for heat,Btu/hr\n", + "print \" heat is Btu/hr \",Q\n", + "print\"\\t approximate values are mentioned in the book \\n\"\n", + "#end\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example2.2" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\t resistance offered by firebrick : (hr)*(F)/Btu 0.97\n", + "\t resistance offered by insulating brick : (hr)*(F)/Btu 2.2\n", + "\t resistance offered by buildingbrick : (hr)*(F)/Btu 1.25\n", + "\t total resistance offered by three walls : (hr)*(F)/Btu 4.42\n", + "\t heat loss/ft^2 : Btu/hr 331.0\n", + "\t delta is : F 322.0\n", + "\t temperature at interface of firebrick and insulating brick F 1278.0\n", + "\t deltb is : F 729.0\n", + "\t temperature at interface of insulating brick and building brick F 549.0\n", + "\t approximate values are mentioned in the book \n", + "\n" + ] + } + ], + "source": [ + "#given\n", + "La=0.66; # Thickness of firebrick wall,ft\n", + "Lb=0.33; # Thickness of insulating brick wall,ft\n", + "Lc=0.5; # Thickness of building brick wall,ft\n", + "Ka=0.68; # themal conductivity of firebrick,Btu/(hr)*(ft^2)*(F/ft)\n", + "Kb=0.15; # themal conductivity of insulating brick,Btu/(hr)*(ft^2)*(F/ft)\n", + "Kc=0.40; # themal conductivity of building brick,Btu/(hr)*(ft^2)*(F/ft)\n", + "A=1.; # surface area,ft^2\n", + "Ta=1600.; # temperature of inner wall,F\n", + "Tb=125.; # temperature of outer wall.F\n", + "#solution\n", + "Ra=La/(Ka)*(A); # formula for resistance,(hr)*(F)/Btu\n", + "print\"\\t resistance offered by firebrick : (hr)*(F)/Btu \",round(Ra,2)\n", + "Rb=Lb/(Kb)*(A); # formula for resistance,(hr)*(F)/Btu\n", + "print\"\\t resistance offered by insulating brick : (hr)*(F)/Btu \",round(Rb,2)\n", + "Rc=Lc/(Kc)*(A); # formula for resistance,(hr)*(F)/Btu\n", + "print\"\\t resistance offered by buildingbrick : (hr)*(F)/Btu \",round(Rc,2)\n", + "R=Ra+Rb+Rc; # total resistance offered by three walls,(hr)*(F)/Btu\n", + "print\"\\t total resistance offered by three walls : (hr)*(F)/Btu \",round(R,2)\n", + "Q=(1600-125)/4.45; # using formula for heat loss/ft^2,Btu/hr\n", + "print\"\\t heat loss/ft^2 : Btu/hr \",round(Q,0)\n", + "# T1,T2 are temperatures at interface of firebrick and insulating brick, and insulating brick and building brick respectively,F\n", + "delta=(Q)*(Ra); # formula for temperature difference,F\n", + "print\"\\t delta is : F \",round(delta,0)\n", + "T1=Ta-((Q)*(Ra)); # temperature at interface of firebrick and insulating brick,F\n", + "print\"\\t temperature at interface of firebrick and insulating brick F \",round(T1,0)\n", + "deltb=Q*(Rb);\n", + "print\"\\t deltb is : F \",round(deltb,0)\n", + "T2=T1-((Q)*(Rb)); #temperature at interface of insulating brick and building brick,F\n", + "print\"\\t temperature at interface of insulating brick and building brick F \",round(T2,0)\n", + "print\"\\t approximate values are mentioned in the book \\n\"\n", + "#end\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##Example2.3" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\t approximate values are mentioned in the book \n", + "\n", + "\t resistance offered by air film (hr)(F)/Btu 0.79\n", + "\t total resistance (hr)(F)/Btu 5.24\n", + "\t heat loss Btu/hr 282.0\n" + ] + } + ], + "source": [ + "\n", + "print\"\\t approximate values are mentioned in the book \\n\"\n", + "#given\n", + "Lair=0.25/12; # thickness of air film,ft\n", + "Kair=0.0265; # thermal conductivity of air at 572F,Btu/(hr)*(ft^2)(F/ft)\n", + "A=1; # surface area,ft^2\n", + "#solution\n", + "Rair=Lair/(Kair*(A)); # resistance offered by air film, (hr)(F)/Btu\n", + "print\"\\t resistance offered by air film (hr)(F)/Btu \",round(Rair,2)\n", + "R=4.45; # resistance from previous example 2.2,(hr)(F)/Btu\n", + "Rt=(R)+Rair; # total resistance,(hr)(F)/Btu\n", + "print\"\\t total resistance (hr)(F)/Btu \",round(Rt,2)\n", + "Ta=1600; # temperature of inner wall,F\n", + "Tb=125; # temperature of outer wall,F\n", + "Q=(1600-125)/Rt; # heat loss, Btu/hr\n", + "print\"\\t heat loss Btu/hr \",round(Q,0)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##Example2.4" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "#given\n", + "k=0.63; # thermal conductivity of pipe, Btu/(hr)*(ft^2)*(F/ft)\n", + "Do=6. # in\n", + "Di=5. # in\n", + "Ti=200.;# inner side temperature,F\n", + "To=175.; # outer side temperature,F\n", + "#solution\n", + "import math\n", + "from math import log\n", + "q=(2*(3.14)*(k)*(Ti-To))/(log (Do/Di)); # formula for heat flow,Btu/(hr)*(ft)\n", + "print\"\\t heat flow is : Btu/(hr)*(ft) \",round(q,0)\n", + "print\"\\t approximate values are mentioned in the book \\n\"\n", + "# caculation mistake in book\n", + "# end\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##Example2.5" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\t approximate values are mentioned in the book \n", + "\n", + "\t heat loss for linear foot is : Btu/(hr)*(lin ft) 104.4\n", + "\t Check between ts and t1, since delt/R = deltc/Rc \n", + "\t t1 is : F 122.300238658\n", + "\t heat loss for linear foot is : Btu/(hr)*(lin ft) 102.9\n", + "\t Check between ts and t1, since delt/R = deltc/Rc \n", + "\t t1 is : F \n", + "125.4\n" + ] + } + ], + "source": [ + "print\"\\t approximate values are mentioned in the book \\n\"\n", + "#given\n", + "t1=150; # assume temperature of outer surface of rockwool,F\n", + "ta=70; # temperature of surrounding air,F\n", + "ha=2.23; # surface coefficient,Btu/(hr)*(ft^2)*(F)\n", + "#solution\n", + "import math\n", + "from math import log\n", + "q=(3.14)*(300-70)/(((1/(2*0.033))*log(3.375/2.375))+(1/((2.23)*(3.375/12)))); # using formula for heat loss,Btu/(hr)*(lin ft), calculation mistake\n", + "print\"\\t heat loss for linear foot is : Btu/(hr)*(lin ft) \",round(q,1)\n", + "print\"\\t Check between ts and t1, since delt/R = deltc/Rc \"\n", + "t1=300-(((104.8)*((1)*(log(3.375/2.375))))/((2)*(3.14)*(.033))); # using eq 2.31,F\n", + "print\"\\t t1 is : F \",t1\n", + "t1=125; # assume temperature of outer surface of rockwool,F\n", + "ha=2.10; # surface coefficient,Btu/(hr)*(ft^2)*(F)\n", + "q=((3.14)*(300-70))/(((1/(2*0.033))*log(3.375/2.375))+(1/((2.10)*(3.375/12)))); # using formula for heat loss,Btu/(hr)*(lin ft)\n", + "print\"\\t heat loss for linear foot is : Btu/(hr)*(lin ft)\",round(q,1)\n", + "print\"\\t Check between ts and t1, since delt/R = deltc/Rc \"\n", + "t1=300-(((103)*((1)*(log(3.375/2.375))))/((2)*(3.14)*(.033))); # using eq 2.31,F\n", + "print\"\\t t1 is : F \\n\",round(t1,1)\n", + "# end \n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/kotaDinesh Babu/kotaDinesh Babu_version_backup/samplebook(process_heat.ipynb b/sample_notebooks/kotaDinesh Babu/kotaDinesh Babu_version_backup/samplebook(process_heat.ipynb deleted file mode 100755 index b114e915..00000000 --- a/sample_notebooks/kotaDinesh Babu/kotaDinesh Babu_version_backup/samplebook(process_heat.ipynb +++ /dev/null @@ -1,278 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "#Chapter:2 CONDUCTION" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##Example2.1" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " heat is Btu/hr 69120.0\n", - "\t approximate values are mentioned in the book \n", - "\n" - ] - } - ], - "source": [ - "#given\n", - "Tavg=900; # average temperature of the wall,F\n", - "k=0.15; # Thermal conductivity at 932 F,Btu/(hr)(ft^2)(F/ft)\n", - "T1=1500; # hot side temperature,F\n", - "T2=300; # cold side temperature,F\n", - "A=192; # surface area,ft^2\n", - "L=0.5; # thickness,ft\n", - "#solution\n", - "Q=(k)*(A)*(T1-T2)/L; # formula for heat,Btu/hr\n", - "print \" heat is Btu/hr \",Q\n", - "print\"\\t approximate values are mentioned in the book \\n\"\n", - "#end\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example2.2" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\t resistance offered by firebrick : (hr)*(F)/Btu 0.97\n", - "\t resistance offered by insulating brick : (hr)*(F)/Btu 2.2\n", - "\t resistance offered by buildingbrick : (hr)*(F)/Btu 1.25\n", - "\t total resistance offered by three walls : (hr)*(F)/Btu 4.42\n", - "\t heat loss/ft^2 : Btu/hr 331.0\n", - "\t delta is : F 322.0\n", - "\t temperature at interface of firebrick and insulating brick F 1278.0\n", - "\t deltb is : F 729.0\n", - "\t temperature at interface of insulating brick and building brick F 549.0\n", - "\t approximate values are mentioned in the book \n", - "\n" - ] - } - ], - "source": [ - "#given\n", - "La=0.66; # Thickness of firebrick wall,ft\n", - "Lb=0.33; # Thickness of insulating brick wall,ft\n", - "Lc=0.5; # Thickness of building brick wall,ft\n", - "Ka=0.68; # themal conductivity of firebrick,Btu/(hr)*(ft^2)*(F/ft)\n", - "Kb=0.15; # themal conductivity of insulating brick,Btu/(hr)*(ft^2)*(F/ft)\n", - "Kc=0.40; # themal conductivity of building brick,Btu/(hr)*(ft^2)*(F/ft)\n", - "A=1.; # surface area,ft^2\n", - "Ta=1600.; # temperature of inner wall,F\n", - "Tb=125.; # temperature of outer wall.F\n", - "#solution\n", - "Ra=La/(Ka)*(A); # formula for resistance,(hr)*(F)/Btu\n", - "print\"\\t resistance offered by firebrick : (hr)*(F)/Btu \",round(Ra,2)\n", - "Rb=Lb/(Kb)*(A); # formula for resistance,(hr)*(F)/Btu\n", - "print\"\\t resistance offered by insulating brick : (hr)*(F)/Btu \",round(Rb,2)\n", - "Rc=Lc/(Kc)*(A); # formula for resistance,(hr)*(F)/Btu\n", - "print\"\\t resistance offered by buildingbrick : (hr)*(F)/Btu \",round(Rc,2)\n", - "R=Ra+Rb+Rc; # total resistance offered by three walls,(hr)*(F)/Btu\n", - "print\"\\t total resistance offered by three walls : (hr)*(F)/Btu \",round(R,2)\n", - "Q=(1600-125)/4.45; # using formula for heat loss/ft^2,Btu/hr\n", - "print\"\\t heat loss/ft^2 : Btu/hr \",round(Q,0)\n", - "# T1,T2 are temperatures at interface of firebrick and insulating brick, and insulating brick and building brick respectively,F\n", - "delta=(Q)*(Ra); # formula for temperature difference,F\n", - "print\"\\t delta is : F \",round(delta,0)\n", - "T1=Ta-((Q)*(Ra)); # temperature at interface of firebrick and insulating brick,F\n", - "print\"\\t temperature at interface of firebrick and insulating brick F \",round(T1,0)\n", - "deltb=Q*(Rb);\n", - "print\"\\t deltb is : F \",round(deltb,0)\n", - "T2=T1-((Q)*(Rb)); #temperature at interface of insulating brick and building brick,F\n", - "print\"\\t temperature at interface of insulating brick and building brick F \",round(T2,0)\n", - "print\"\\t approximate values are mentioned in the book \\n\"\n", - "#end\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##Example2.3" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\t approximate values are mentioned in the book \n", - "\n", - "\t resistance offered by air film (hr)(F)/Btu 0.79\n", - "\t total resistance (hr)(F)/Btu 5.24\n", - "\t heat loss Btu/hr 282.0\n" - ] - } - ], - "source": [ - "\n", - "print\"\\t approximate values are mentioned in the book \\n\"\n", - "#given\n", - "Lair=0.25/12; # thickness of air film,ft\n", - "Kair=0.0265; # thermal conductivity of air at 572F,Btu/(hr)*(ft^2)(F/ft)\n", - "A=1; # surface area,ft^2\n", - "#solution\n", - "Rair=Lair/(Kair*(A)); # resistance offered by air film, (hr)(F)/Btu\n", - "print\"\\t resistance offered by air film (hr)(F)/Btu \",round(Rair,2)\n", - "R=4.45; # resistance from previous example 2.2,(hr)(F)/Btu\n", - "Rt=(R)+Rair; # total resistance,(hr)(F)/Btu\n", - "print\"\\t total resistance (hr)(F)/Btu \",round(Rt,2)\n", - "Ta=1600; # temperature of inner wall,F\n", - "Tb=125; # temperature of outer wall,F\n", - "Q=(1600-125)/Rt; # heat loss, Btu/hr\n", - "print\"\\t heat loss Btu/hr \",round(Q,0)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##Example2.4" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "#given\n", - "k=0.63; # thermal conductivity of pipe, Btu/(hr)*(ft^2)*(F/ft)\n", - "Do=6. # in\n", - "Di=5. # in\n", - "Ti=200.;# inner side temperature,F\n", - "To=175.; # outer side temperature,F\n", - "#solution\n", - "import math\n", - "from math import log\n", - "q=(2*(3.14)*(k)*(Ti-To))/(log (Do/Di)); # formula for heat flow,Btu/(hr)*(ft)\n", - "print\"\\t heat flow is : Btu/(hr)*(ft) \",round(q,0)\n", - "print\"\\t approximate values are mentioned in the book \\n\"\n", - "# caculation mistake in book\n", - "# end\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "##Example2.5" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\t approximate values are mentioned in the book \n", - "\n", - "\t heat loss for linear foot is : Btu/(hr)*(lin ft) 104.4\n", - "\t Check between ts and t1, since delt/R = deltc/Rc \n", - "\t t1 is : F 122.300238658\n", - "\t heat loss for linear foot is : Btu/(hr)*(lin ft) 102.9\n", - "\t Check between ts and t1, since delt/R = deltc/Rc \n", - "\t t1 is : F \n", - "125.4\n" - ] - } - ], - "source": [ - "print\"\\t approximate values are mentioned in the book \\n\"\n", - "#given\n", - "t1=150; # assume temperature of outer surface of rockwool,F\n", - "ta=70; # temperature of surrounding air,F\n", - "ha=2.23; # surface coefficient,Btu/(hr)*(ft^2)*(F)\n", - "#solution\n", - "import math\n", - "from math import log\n", - "q=(3.14)*(300-70)/(((1/(2*0.033))*log(3.375/2.375))+(1/((2.23)*(3.375/12)))); # using formula for heat loss,Btu/(hr)*(lin ft), calculation mistake\n", - "print\"\\t heat loss for linear foot is : Btu/(hr)*(lin ft) \",round(q,1)\n", - "print\"\\t Check between ts and t1, since delt/R = deltc/Rc \"\n", - "t1=300-(((104.8)*((1)*(log(3.375/2.375))))/((2)*(3.14)*(.033))); # using eq 2.31,F\n", - "print\"\\t t1 is : F \",t1\n", - "t1=125; # assume temperature of outer surface of rockwool,F\n", - "ha=2.10; # surface coefficient,Btu/(hr)*(ft^2)*(F)\n", - "q=((3.14)*(300-70))/(((1/(2*0.033))*log(3.375/2.375))+(1/((2.10)*(3.375/12)))); # using formula for heat loss,Btu/(hr)*(lin ft)\n", - "print\"\\t heat loss for linear foot is : Btu/(hr)*(lin ft)\",round(q,1)\n", - "print\"\\t Check between ts and t1, since delt/R = deltc/Rc \"\n", - "t1=300-(((103)*((1)*(log(3.375/2.375))))/((2)*(3.14)*(.033))); # using eq 2.31,F\n", - "print\"\\t t1 is : F \\n\",round(t1,1)\n", - "# end \n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/kowshikChilamkurthy/Chapter_1_Stress,Axial_load_and.ipynb b/sample_notebooks/kowshikChilamkurthy/Chapter_1_Stress,Axial_load_and.ipynb new file mode 100755 index 00000000..ff9f91c7 --- /dev/null +++ b/sample_notebooks/kowshikChilamkurthy/Chapter_1_Stress,Axial_load_and.ipynb @@ -0,0 +1,395 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example 1.1 page number 24\n" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The bearing stress at C is 0.875 MPA\n", + "The maximum normal stress in BD bolt is: 62.0 MPA\n", + "The tensile strss at shank of the bolt is: 40.0 MPA\n" + ] + } + ], + "source": [ + "#Given\n", + "import math\n", + "d_bolt = 20.0 #mm,diameter,This is not the minimum area\n", + "d_bolt_min = 16.0 #mm This is at the roots of the thread \n", + "#This yealds maximum stress \n", + "A_crossection = (math.pi)*(d_bolt**2)/4 #mm*2\n", + "A_crossection_min = (math.pi)*(d_bolt_min**2)/4 #mm*2 ,This is minimum area which yeilds maximum stress\n", + "load = 10.0 #KN\n", + "BC = 1.0 #m\n", + "CF = 2.5 #m\n", + "contact_area = 200*200 # mm*2 , The contact area at c\n", + "\n", + "#caliculations \n", + "#Balancing forces in the x direction:\n", + "# Balncing the moments about C and B:\n", + "Fx = 0 \n", + "R_cy = load*(BC+CF) #KN , Reaction at C in y-direction\n", + "R_by = load*(CF) #KN , Reaction at B in y-direction\n", + "#Because of 2 bolts\n", + "stress_max = (R_by/(2*A_crossection_min))*(10**3) # MPA,maximum stess records at minimum area\n", + "stress_shank = (R_by/(2*A_crossection))*(10**3) # MPA\n", + "Bearing_stress_c = (R_cy/contact_area)*(10**3) #MPA, Bearing stress at C\n", + "\n", + "print\"The bearing stress at C is \",(Bearing_stress_c) ,\"MPA\"\n", + "print\"The maximum normal stress in BD bolt is: \",round(stress_max),\"MPA\"\n", + "print\"The tensile strss at shank of the bolt is: \",round(stress_shank),\"MPA\"\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example 1.2 page number 26" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The total weightof pier: 25.0 KN\n", + "The stress at 1 m above is 28.75 MPA\n" + ] + } + ], + "source": [ + "#Given \n", + "load_distributed = 20 #KN/m*2, This is the load distributed over the pier\n", + "H = 2 # m, Total height \n", + "h = 1 #m , point of investigation \n", + "base = 1.5 #m The length of crossection in side veiw \n", + "top = 0.5 #m ,The length where load is distributed on top\n", + "base_inv = 1 #m , the length at the point of investigation \n", + "area = 0.5*1 #m ,The length at a-a crossection \n", + "density_conc = 25 #KN/m*2\n", + "#caliculation of total weight \n", + "\n", + "v_total = ((top+base)/2)*top*H #m*2 ,The total volume \n", + "w_total = v_total* density_conc #KN , The total weight\n", + "R_top = (top**2)*load_distributed #KN , THe reaction force due to load distribution \n", + "reaction_net = w_total + R_top\n", + "\n", + "#caliculation of State of stress at 1m \n", + "v_inv = ((top+base_inv)/2)*top*h #m*2 ,The total volume from 1m to top\n", + "w_inv = v_inv*density_conc #KN , The total weight from 1m to top\n", + "reaction_net = w_inv + R_top #KN\n", + "Stress = reaction_net/area #KN/m*2\n", + "print\"The total weight of pier is\",w_total,\"KN\"\n", + "print\"The stress at 1 m above is\",Stress,\"MPA\"\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example 1.3 page number 27" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Tensile stress in main bar AB: 17.89 Ksi\n", + "Tensile stress in clevis of main bar AB: 11.18 Ksi\n", + "Comprensive stress in main bar BC: 12.93 Ksi\n", + "Bearing stress in pin at C: 18.86 Ksi\n", + "torsion stress in pin at C: -25.62 Ksi\n" + ] + } + ], + "source": [ + "#Given\n", + "from math import pow\n", + "d_pins = 0.375 #inch\n", + "load = 3 #Kips\n", + "AB_x = 6 #inch,X-component\n", + "AB_y = 3 #inch,Y-component \n", + "BC_y = 6 #inch,Y-component\n", + "BC_x = 6 #inch,X-component\n", + "area_AB = 0.25*0.5 #inch*2 \n", + "area_net = 0.20*2*(0.875-0.375) #inch*2 \n", + "area_BC = 0.875*0.25 #inch*2 \n", + "area_pin = d_pins*2*0.20 #inch*2 \n", + "area_pin_crossection = 3.14*((d_pins/2)**2)\n", + "#caliculations\n", + "\n", + "slope = AB_y/ AB_x #For AB\n", + "slope = BC_y/ BC_x #For BC\n", + "\n", + "#momentum at point C:\n", + "F_A_x = (load*AB_x )/(BC_y + AB_y ) #Kips, F_A_x X-component of F_A\n", + "\n", + "#momentum at point A:\n", + "F_C_x = -(load*BC_x)/(BC_y + AB_y ) #Kips, F_C_x X-component of F_c\n", + "\n", + "#X,Y components of F_A\n", + "F_A= (pow(5,0.5)/2)*F_A_x #Kips\n", + "F_A_y = 0.5*F_A_x #Kips\n", + "\n", + "#X,Y components of F_C \n", + "F_C= pow(2,0.5)*F_C_x #Kips\n", + "F_C_y = F_C_x #Kips\n", + "\n", + "T_stress_AB = F_A/area_AB #Ksi , Tensile stress in main bar AB\n", + "stress_clevis = F_A/area_net #Ksi ,Tensile stress in clevis of main bar AB\n", + "c_strees_BC = F_C/area_BC #Ksi , Comprensive stress in main bar BC\n", + "B_stress_pin = F_C/area_pin #Ksi , Bearing stress in pin at C\n", + "To_stress_pin = F_C/area_pin_crossection #Ksi , torsion stress in pin at C\n", + "\n", + "print\"Tensile stress in main bar AB:\",round(T_stress_AB,2),\"Ksi\"\n", + "print\"Tensile stress in clevis of main bar AB:\",round(stress_clevis,2),\"Ksi\"\n", + "print\"Comprensive stress in main bar BC:\",round(-c_strees_BC,2),\"Ksi\"\n", + "print\"Bearing stress in pin at C:\",round(-B_stress_pin,2),\"Ksi\"\n", + "print\"torsion stress in pin at C:\",round(To_stress_pin,2),\"Ksi\"\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example 1.4 page number 38" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The factor 2.5 is less than assumed factor 2.7 so this can be considered\n" + ] + } + ], + "source": [ + "#Given\n", + "strength_steel = 120 #Ksi\n", + "factor = 2.5\n", + "F_C = 2.23 #Ksi\n", + "\n", + "#caliculations\n", + "\n", + "stress_allow = strength_steel/factor #Ksi\n", + "A_net = F_C/strength_steel #in*2 , \n", + "#lets adopt 0.20x0.25 in*2 and check wether we are correct or not? \n", + "\n", + "A_net_assumption = 0.25*0.20 #in*2 , this is assumed area which is near to A_net\n", + "stress = 2.23/A_net_assumption #Ksi\n", + "factor_assumed = strength_steel/stress \n", + "\n", + "if factor_assumed > factor :\n", + " print \"The factor\",factor,\"is less than assumed factor\",round(factor_assumed,1),\"so this can be considered\"\n", + "else:\n", + " print \"The assumed factor\",factor, \"is more than assumed factor\",factor_assumed,\"factor_assumed\"\n", + " \n", + " \n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example 1.6 page number 35" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The required size of rod is: 49.35 m*2\n" + ] + } + ], + "source": [ + "#Given\n", + "mass = 5 #Kg\n", + "frequency = 10 #Hz\n", + "stress_allow = 200 #MPa\n", + "R = 0.5 #m\n", + "\n", + "#caliculations \n", + "from math import pi\n", + "w = 2*pi*frequency #rad/sec\n", + "a = (w**2)*R #m*2/sec\n", + "F = mass*a #N\n", + "A_req = F/stress_allow #m*2 , The required area for aloowing stress\n", + "print\"The required size of rod is:\",round(A_req,2),\"m*2\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example 1.7 page number 45" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the allowable area for live load 1.0 is 0.273 in*2\n", + "the allowable area for live load 15 is 0.909 in*2\n", + "the crossection area for live load 1.0 is 0.235 in*2\n", + "the crossection area for live load 15 is 0.926 in*2\n" + ] + } + ], + "source": [ + "#Given\n", + "D_n = 5.0 #kips, dead load\n", + "L_n_1 = 1.0 #kips ,live load 1\n", + "L_n_2 = 15 #kips ,live load 2\n", + "stress_allow = 22 #ksi\n", + "phi = 0.9 #probalistic coefficients\n", + "y_stress = 36 #ksi,Yeild strength\n", + "#According to AISR \n", + "\n", + "#a\n", + "p_1 = D_n + L_n_1 #kips since the total load is sum of dead load and live load\n", + "p_2 = D_n + L_n_2 #kips, For second live load\n", + "\n", + "Area_1 = p_1/stress_allow #in*2 ,the allowable area for the allowed stress\n", + "Area_2 = p_2/stress_allow #in*2\n", + "print \"the allowable area for live load\",L_n_1,\"is\",round(Area_1,3),\"in*2\"\n", + "print \"the allowable area for live load\",L_n_2,\"is\",round(Area_2,3),\"in*2\"\n", + "\n", + "#b\n", + "#area_crossection= (1.2*D_n +1.6L_n)/(phi*y_stress)\n", + "\n", + "area_crossection_1= (1.2*D_n +1.6*L_n_1)/(phi*y_stress) #in*2,crossection area for first live load\n", + "area_crossection_2= (1.2*D_n +1.6*L_n_2)/(phi*y_stress) #in*2,crossection area for second live load\n", + "print \"the crossection area for live load\",L_n_1,\"is\",round(area_crossection_1,3),\"in*2\"\n", + "print \"the crossection area for live load\",L_n_2,\"is\",round(area_crossection_2,3),\"in*2\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example 1.8 page number 51" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Length of the Weld 1: 2.54 in\n", + "Length of the Weld 2: 4.65 in\n" + ] + } + ], + "source": [ + "#Given\n", + "A_angle = 2 #in*2 \n", + "stress_allow = 20 #ksi, The maximum alowable stress\n", + "F = stress_allow*A_angle #K, The maximum force\n", + "AD = 3 #in, from the figure\n", + "DC = 1.06 #in, from the figure\n", + "strength_AWS = 5.56 # kips/in,Allowable strength according to AWS\n", + "\n", + "#caliculations \n", + "#momentum at point \"d\" is equal to 0\n", + "R_1 = (F*DC)/AD #k,Resultant force developed by the weld\n", + "R_2 = (F*(AD-DC))/AD #k,Resultant force developed by the weld\n", + "\n", + "l_1 = R_1/strength_AWS #in,Length of the Weld 1\n", + "l_2 = R_2/strength_AWS #in,Length of the Weld 2\n", + " \n", + "print \"Length of the Weld 1:\",round(l_1,2),\"in\"\n", + "print \"Length of the Weld 2:\",round(l_2,2),\"in\" \n", + " \n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/kowshikChilamkurthy/Chapter_1_Stress,Axial_load_and_Safety.ipynb b/sample_notebooks/kowshikChilamkurthy/Chapter_1_Stress,Axial_load_and_Safety.ipynb deleted file mode 100755 index ff9f91c7..00000000 --- a/sample_notebooks/kowshikChilamkurthy/Chapter_1_Stress,Axial_load_and_Safety.ipynb +++ /dev/null @@ -1,395 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Example 1.1 page number 24\n" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The bearing stress at C is 0.875 MPA\n", - "The maximum normal stress in BD bolt is: 62.0 MPA\n", - "The tensile strss at shank of the bolt is: 40.0 MPA\n" - ] - } - ], - "source": [ - "#Given\n", - "import math\n", - "d_bolt = 20.0 #mm,diameter,This is not the minimum area\n", - "d_bolt_min = 16.0 #mm This is at the roots of the thread \n", - "#This yealds maximum stress \n", - "A_crossection = (math.pi)*(d_bolt**2)/4 #mm*2\n", - "A_crossection_min = (math.pi)*(d_bolt_min**2)/4 #mm*2 ,This is minimum area which yeilds maximum stress\n", - "load = 10.0 #KN\n", - "BC = 1.0 #m\n", - "CF = 2.5 #m\n", - "contact_area = 200*200 # mm*2 , The contact area at c\n", - "\n", - "#caliculations \n", - "#Balancing forces in the x direction:\n", - "# Balncing the moments about C and B:\n", - "Fx = 0 \n", - "R_cy = load*(BC+CF) #KN , Reaction at C in y-direction\n", - "R_by = load*(CF) #KN , Reaction at B in y-direction\n", - "#Because of 2 bolts\n", - "stress_max = (R_by/(2*A_crossection_min))*(10**3) # MPA,maximum stess records at minimum area\n", - "stress_shank = (R_by/(2*A_crossection))*(10**3) # MPA\n", - "Bearing_stress_c = (R_cy/contact_area)*(10**3) #MPA, Bearing stress at C\n", - "\n", - "print\"The bearing stress at C is \",(Bearing_stress_c) ,\"MPA\"\n", - "print\"The maximum normal stress in BD bolt is: \",round(stress_max),\"MPA\"\n", - "print\"The tensile strss at shank of the bolt is: \",round(stress_shank),\"MPA\"\n", - "\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Example 1.2 page number 26" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The total weightof pier: 25.0 KN\n", - "The stress at 1 m above is 28.75 MPA\n" - ] - } - ], - "source": [ - "#Given \n", - "load_distributed = 20 #KN/m*2, This is the load distributed over the pier\n", - "H = 2 # m, Total height \n", - "h = 1 #m , point of investigation \n", - "base = 1.5 #m The length of crossection in side veiw \n", - "top = 0.5 #m ,The length where load is distributed on top\n", - "base_inv = 1 #m , the length at the point of investigation \n", - "area = 0.5*1 #m ,The length at a-a crossection \n", - "density_conc = 25 #KN/m*2\n", - "#caliculation of total weight \n", - "\n", - "v_total = ((top+base)/2)*top*H #m*2 ,The total volume \n", - "w_total = v_total* density_conc #KN , The total weight\n", - "R_top = (top**2)*load_distributed #KN , THe reaction force due to load distribution \n", - "reaction_net = w_total + R_top\n", - "\n", - "#caliculation of State of stress at 1m \n", - "v_inv = ((top+base_inv)/2)*top*h #m*2 ,The total volume from 1m to top\n", - "w_inv = v_inv*density_conc #KN , The total weight from 1m to top\n", - "reaction_net = w_inv + R_top #KN\n", - "Stress = reaction_net/area #KN/m*2\n", - "print\"The total weight of pier is\",w_total,\"KN\"\n", - "print\"The stress at 1 m above is\",Stress,\"MPA\"\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Example 1.3 page number 27" - ] - }, - { - "cell_type": "code", - "execution_count": 35, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Tensile stress in main bar AB: 17.89 Ksi\n", - "Tensile stress in clevis of main bar AB: 11.18 Ksi\n", - "Comprensive stress in main bar BC: 12.93 Ksi\n", - "Bearing stress in pin at C: 18.86 Ksi\n", - "torsion stress in pin at C: -25.62 Ksi\n" - ] - } - ], - "source": [ - "#Given\n", - "from math import pow\n", - "d_pins = 0.375 #inch\n", - "load = 3 #Kips\n", - "AB_x = 6 #inch,X-component\n", - "AB_y = 3 #inch,Y-component \n", - "BC_y = 6 #inch,Y-component\n", - "BC_x = 6 #inch,X-component\n", - "area_AB = 0.25*0.5 #inch*2 \n", - "area_net = 0.20*2*(0.875-0.375) #inch*2 \n", - "area_BC = 0.875*0.25 #inch*2 \n", - "area_pin = d_pins*2*0.20 #inch*2 \n", - "area_pin_crossection = 3.14*((d_pins/2)**2)\n", - "#caliculations\n", - "\n", - "slope = AB_y/ AB_x #For AB\n", - "slope = BC_y/ BC_x #For BC\n", - "\n", - "#momentum at point C:\n", - "F_A_x = (load*AB_x )/(BC_y + AB_y ) #Kips, F_A_x X-component of F_A\n", - "\n", - "#momentum at point A:\n", - "F_C_x = -(load*BC_x)/(BC_y + AB_y ) #Kips, F_C_x X-component of F_c\n", - "\n", - "#X,Y components of F_A\n", - "F_A= (pow(5,0.5)/2)*F_A_x #Kips\n", - "F_A_y = 0.5*F_A_x #Kips\n", - "\n", - "#X,Y components of F_C \n", - "F_C= pow(2,0.5)*F_C_x #Kips\n", - "F_C_y = F_C_x #Kips\n", - "\n", - "T_stress_AB = F_A/area_AB #Ksi , Tensile stress in main bar AB\n", - "stress_clevis = F_A/area_net #Ksi ,Tensile stress in clevis of main bar AB\n", - "c_strees_BC = F_C/area_BC #Ksi , Comprensive stress in main bar BC\n", - "B_stress_pin = F_C/area_pin #Ksi , Bearing stress in pin at C\n", - "To_stress_pin = F_C/area_pin_crossection #Ksi , torsion stress in pin at C\n", - "\n", - "print\"Tensile stress in main bar AB:\",round(T_stress_AB,2),\"Ksi\"\n", - "print\"Tensile stress in clevis of main bar AB:\",round(stress_clevis,2),\"Ksi\"\n", - "print\"Comprensive stress in main bar BC:\",round(-c_strees_BC,2),\"Ksi\"\n", - "print\"Bearing stress in pin at C:\",round(-B_stress_pin,2),\"Ksi\"\n", - "print\"torsion stress in pin at C:\",round(To_stress_pin,2),\"Ksi\"\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Example 1.4 page number 38" - ] - }, - { - "cell_type": "code", - "execution_count": 36, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The factor 2.5 is less than assumed factor 2.7 so this can be considered\n" - ] - } - ], - "source": [ - "#Given\n", - "strength_steel = 120 #Ksi\n", - "factor = 2.5\n", - "F_C = 2.23 #Ksi\n", - "\n", - "#caliculations\n", - "\n", - "stress_allow = strength_steel/factor #Ksi\n", - "A_net = F_C/strength_steel #in*2 , \n", - "#lets adopt 0.20x0.25 in*2 and check wether we are correct or not? \n", - "\n", - "A_net_assumption = 0.25*0.20 #in*2 , this is assumed area which is near to A_net\n", - "stress = 2.23/A_net_assumption #Ksi\n", - "factor_assumed = strength_steel/stress \n", - "\n", - "if factor_assumed > factor :\n", - " print \"The factor\",factor,\"is less than assumed factor\",round(factor_assumed,1),\"so this can be considered\"\n", - "else:\n", - " print \"The assumed factor\",factor, \"is more than assumed factor\",factor_assumed,\"factor_assumed\"\n", - " \n", - " \n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Example 1.6 page number 35" - ] - }, - { - "cell_type": "code", - "execution_count": 40, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The required size of rod is: 49.35 m*2\n" - ] - } - ], - "source": [ - "#Given\n", - "mass = 5 #Kg\n", - "frequency = 10 #Hz\n", - "stress_allow = 200 #MPa\n", - "R = 0.5 #m\n", - "\n", - "#caliculations \n", - "from math import pi\n", - "w = 2*pi*frequency #rad/sec\n", - "a = (w**2)*R #m*2/sec\n", - "F = mass*a #N\n", - "A_req = F/stress_allow #m*2 , The required area for aloowing stress\n", - "print\"The required size of rod is:\",round(A_req,2),\"m*2\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Example 1.7 page number 45" - ] - }, - { - "cell_type": "code", - "execution_count": 46, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the allowable area for live load 1.0 is 0.273 in*2\n", - "the allowable area for live load 15 is 0.909 in*2\n", - "the crossection area for live load 1.0 is 0.235 in*2\n", - "the crossection area for live load 15 is 0.926 in*2\n" - ] - } - ], - "source": [ - "#Given\n", - "D_n = 5.0 #kips, dead load\n", - "L_n_1 = 1.0 #kips ,live load 1\n", - "L_n_2 = 15 #kips ,live load 2\n", - "stress_allow = 22 #ksi\n", - "phi = 0.9 #probalistic coefficients\n", - "y_stress = 36 #ksi,Yeild strength\n", - "#According to AISR \n", - "\n", - "#a\n", - "p_1 = D_n + L_n_1 #kips since the total load is sum of dead load and live load\n", - "p_2 = D_n + L_n_2 #kips, For second live load\n", - "\n", - "Area_1 = p_1/stress_allow #in*2 ,the allowable area for the allowed stress\n", - "Area_2 = p_2/stress_allow #in*2\n", - "print \"the allowable area for live load\",L_n_1,\"is\",round(Area_1,3),\"in*2\"\n", - "print \"the allowable area for live load\",L_n_2,\"is\",round(Area_2,3),\"in*2\"\n", - "\n", - "#b\n", - "#area_crossection= (1.2*D_n +1.6L_n)/(phi*y_stress)\n", - "\n", - "area_crossection_1= (1.2*D_n +1.6*L_n_1)/(phi*y_stress) #in*2,crossection area for first live load\n", - "area_crossection_2= (1.2*D_n +1.6*L_n_2)/(phi*y_stress) #in*2,crossection area for second live load\n", - "print \"the crossection area for live load\",L_n_1,\"is\",round(area_crossection_1,3),\"in*2\"\n", - "print \"the crossection area for live load\",L_n_2,\"is\",round(area_crossection_2,3),\"in*2\"\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Example 1.8 page number 51" - ] - }, - { - "cell_type": "code", - "execution_count": 52, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Length of the Weld 1: 2.54 in\n", - "Length of the Weld 2: 4.65 in\n" - ] - } - ], - "source": [ - "#Given\n", - "A_angle = 2 #in*2 \n", - "stress_allow = 20 #ksi, The maximum alowable stress\n", - "F = stress_allow*A_angle #K, The maximum force\n", - "AD = 3 #in, from the figure\n", - "DC = 1.06 #in, from the figure\n", - "strength_AWS = 5.56 # kips/in,Allowable strength according to AWS\n", - "\n", - "#caliculations \n", - "#momentum at point \"d\" is equal to 0\n", - "R_1 = (F*DC)/AD #k,Resultant force developed by the weld\n", - "R_2 = (F*(AD-DC))/AD #k,Resultant force developed by the weld\n", - "\n", - "l_1 = R_1/strength_AWS #in,Length of the Weld 1\n", - "l_2 = R_2/strength_AWS #in,Length of the Weld 2\n", - " \n", - "print \"Length of the Weld 1:\",round(l_1,2),\"in\"\n", - "print \"Length of the Weld 2:\",round(l_2,2),\"in\" \n", - " \n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/kushrami/Chapter_1_-_Overview_of_optical.ipynb b/sample_notebooks/kushrami/Chapter_1_-_Overview_of_optical.ipynb new file mode 100755 index 00000000..7649fb45 --- /dev/null +++ b/sample_notebooks/kushrami/Chapter_1_-_Overview_of_optical.ipynb @@ -0,0 +1,251 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:256c8b99e0e56930e177cf311c8d82ebc12805b19dc6acba2736a9016b128039" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 1: Overview of optical fiber communication" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.1, Page Number: 8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#variable declaration\n", + "f1 = 100*1e3 #frequency1 = 100KHz\n", + "f2 = 1e9 #frequency2 = 1GHz\n", + "T1 = 1.0/f1 #Time period1 = 0.01ms\n", + "T2 = 1.0/f2 #Time period2 = 1 ns\n", + "\n", + "#calculation\n", + "phi = (0.25)*360.0 # Phase shift(degree)\n", + "\n", + "#result\n", + "print \"Phase shift = \",round(phi),\"Degree\",\"= \",round((round(phi)*math.pi)/180,4), \"radian\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Phase shift = 90.0 Degree = 1.5708 radian\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.2, Page Number: 10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#variable Declaration\n", + "flow=10*1e3 #Lowest frequency\n", + "fhigh=100*1e3 #Highest frequency\n", + "\n", + "#calculation\n", + "bandwidth=fhigh-flow\n", + "\n", + "#result\n", + "print \"Bandwidth=\",bandwidth/1000 ,\"KHz\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Bandwidth= 90.0 KHz\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.4, Page Number: 12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#variable Declaration\n", + "B = 10*1e6 # Bandwidth of noisy channel 1MHZ\n", + "S_N = 1 # signal to noise ratio is 1\n", + "\n", + "#calculation\n", + "C=B*(math.log(1+S_N)/math.log(2)) #capacity of channel(Mb/s)\n", + "\n", + "#result\n", + "print \"Capacity of channel =\",C/(10*1e6),\"Mb/s\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Capacity of channel = 1.0 Mb/s\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.5, Page Number: 12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#variable Declaration\n", + "fLow = 3*1e6 #low frequency = 3MHz\n", + "fHigh = 4*1e6 #high frequency = 4MHz\n", + "SNR_dB = 20 #signal to noise ratio 20 dB\n", + "\n", + "#calculation\n", + "B = fHigh-fLow #Bandwidth(MHz)\n", + "S_N = 10**(SNR_dB/10)\n", + "C = B*(math.log(1+S_N)/math.log(2)) #capacity of channel(Mb/s)\n", + "\n", + "#result\n", + "print \"Capacity of channel=\",round(C/(1e6),1),\"Mb/s\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Capacity of channel= 6.7 Mb/s\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.6, Page Number: 14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#variable Declaration\n", + "P1 = 1 # Let p1 be 1 watt\n", + "P2 = P1*0.5 # P2 is half of p1 so 1/2\n", + "\n", + "#calculation\n", + "Atten_dB = 10*(math.log(P2/P1)/math.log(10)) #attenuation or loss of power(dB)\n", + "\n", + "#result\n", + "print \"Attenuation loss =\",round(Atten_dB,0), \"dB\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Attenuation loss = -3.0 dB\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.7, Page Number: 14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#variable Declaration\n", + "Loss_line1 = -9 #attenuation of signal between point 1 to 2 = 9 dB\n", + "Amp_gain2 = 14 #Amplification of signal between point 2 to 3 = 14 dB\n", + "Loss_line3 = -3 #attenuation of signal between point 3 to 4 = 3 dB\n", + "\n", + "#calculation\n", + "dB_at_line4 = Loss_line1+Amp_gain2+Loss_line3 #power gain\n", + "\n", + "#result\n", + "print \"Power gain for a signal travelling from point1 to another point4 = \",dB_at_line4, \"dB\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power gain for a signal travelling from point1 to another point4 = 2 dB\n" + ] + } + ], + "prompt_number": 29 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/kushrami/Chapter_1_-_Overview_of_optical_fiber.ipynb b/sample_notebooks/kushrami/Chapter_1_-_Overview_of_optical_fiber.ipynb deleted file mode 100755 index 7649fb45..00000000 --- a/sample_notebooks/kushrami/Chapter_1_-_Overview_of_optical_fiber.ipynb +++ /dev/null @@ -1,251 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:256c8b99e0e56930e177cf311c8d82ebc12805b19dc6acba2736a9016b128039" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter 1: Overview of optical fiber communication" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.1, Page Number: 8" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#variable declaration\n", - "f1 = 100*1e3 #frequency1 = 100KHz\n", - "f2 = 1e9 #frequency2 = 1GHz\n", - "T1 = 1.0/f1 #Time period1 = 0.01ms\n", - "T2 = 1.0/f2 #Time period2 = 1 ns\n", - "\n", - "#calculation\n", - "phi = (0.25)*360.0 # Phase shift(degree)\n", - "\n", - "#result\n", - "print \"Phase shift = \",round(phi),\"Degree\",\"= \",round((round(phi)*math.pi)/180,4), \"radian\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Phase shift = 90.0 Degree = 1.5708 radian\n" - ] - } - ], - "prompt_number": 24 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.2, Page Number: 10" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#variable Declaration\n", - "flow=10*1e3 #Lowest frequency\n", - "fhigh=100*1e3 #Highest frequency\n", - "\n", - "#calculation\n", - "bandwidth=fhigh-flow\n", - "\n", - "#result\n", - "print \"Bandwidth=\",bandwidth/1000 ,\"KHz\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Bandwidth= 90.0 KHz\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.4, Page Number: 12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#variable Declaration\n", - "B = 10*1e6 # Bandwidth of noisy channel 1MHZ\n", - "S_N = 1 # signal to noise ratio is 1\n", - "\n", - "#calculation\n", - "C=B*(math.log(1+S_N)/math.log(2)) #capacity of channel(Mb/s)\n", - "\n", - "#result\n", - "print \"Capacity of channel =\",C/(10*1e6),\"Mb/s\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Capacity of channel = 1.0 Mb/s\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.5, Page Number: 12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#variable Declaration\n", - "fLow = 3*1e6 #low frequency = 3MHz\n", - "fHigh = 4*1e6 #high frequency = 4MHz\n", - "SNR_dB = 20 #signal to noise ratio 20 dB\n", - "\n", - "#calculation\n", - "B = fHigh-fLow #Bandwidth(MHz)\n", - "S_N = 10**(SNR_dB/10)\n", - "C = B*(math.log(1+S_N)/math.log(2)) #capacity of channel(Mb/s)\n", - "\n", - "#result\n", - "print \"Capacity of channel=\",round(C/(1e6),1),\"Mb/s\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Capacity of channel= 6.7 Mb/s\n" - ] - } - ], - "prompt_number": 27 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.6, Page Number: 14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#variable Declaration\n", - "P1 = 1 # Let p1 be 1 watt\n", - "P2 = P1*0.5 # P2 is half of p1 so 1/2\n", - "\n", - "#calculation\n", - "Atten_dB = 10*(math.log(P2/P1)/math.log(10)) #attenuation or loss of power(dB)\n", - "\n", - "#result\n", - "print \"Attenuation loss =\",round(Atten_dB,0), \"dB\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Attenuation loss = -3.0 dB\n" - ] - } - ], - "prompt_number": 28 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 1.7, Page Number: 14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import math\n", - "\n", - "#variable Declaration\n", - "Loss_line1 = -9 #attenuation of signal between point 1 to 2 = 9 dB\n", - "Amp_gain2 = 14 #Amplification of signal between point 2 to 3 = 14 dB\n", - "Loss_line3 = -3 #attenuation of signal between point 3 to 4 = 3 dB\n", - "\n", - "#calculation\n", - "dB_at_line4 = Loss_line1+Amp_gain2+Loss_line3 #power gain\n", - "\n", - "#result\n", - "print \"Power gain for a signal travelling from point1 to another point4 = \",dB_at_line4, \"dB\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Power gain for a signal travelling from point1 to another point4 = 2 dB\n" - ] - } - ], - "prompt_number": 29 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/makarala shamukha venkatasahithi/Chapter_2_Nuclear_Sturcture.ipynb b/sample_notebooks/makarala shamukha venkatasahithi/Chapter_2_Nuclear_Sturcture.ipynb new file mode 100755 index 00000000..505cf999 --- /dev/null +++ b/sample_notebooks/makarala shamukha venkatasahithi/Chapter_2_Nuclear_Sturcture.ipynb @@ -0,0 +1,234 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 2 Nuclear Sturcture and Radioactivity" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_1 pgno:25" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Half life of radioactive nuclide=t1/2=minutes 14.7674928978\n", + "\n", + "Time required for the activity to decrease to 25percent of the initial activity=t1=minutes 68.0335182976\n", + "\n", + "Time required for the activity to decrease to 10percent of the initial activity=t2=minutes 113.001227913\n" + ] + } + ], + "source": [ + "from math import log\n", + "N0=3396.;#no. of counts per minute given by radioactive nuclide at a given time#\n", + "N=1000.;#no. of counts per minute given by radioactive nuclide one hour later#\n", + "thalf=0.693*60/(2.303*log(N0/N));#half life of nuclide in minutes#\n", + "print'Half life of radioactive nuclide=t1/2=minutes',thalf\n", + "t1=2.303*log(100/25)*thalf/0.693;#time required for the activity to decrease to 25% of the initial activity in minutes#\n", + "print'\\nTime required for the activity to decrease to 25percent of the initial activity=t1=minutes',t1\n", + "t2=2.303*log(100/10)*thalf/0.693;#time required for the activity to decrease to 10% of the initial activity in minutes#\n", + "print'\\nTime required for the activity to decrease to 10percent of the initial activity=t2=minutes',t2\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_2 pgno:27" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Half life of 226Ra molecule=t1/2=years 1584.62090409\n" + ] + } + ], + "source": [ + "R=3.7*10**10;#no. of alpha particles per second emitted by 1g of 226Ra#\n", + "N=(6.023*10**23)/226;#no. of atoms of 226Ra#\n", + "yr=3.15*10**7;#no of seconds in a year#\n", + "thalf=0.693*N/(R*yr);#half life of 226Ra in years#\n", + "print'Half life of 226Ra molecule=t1/2=years',thalf#here the answer written in textbook is wrongly printed actual answer will be the one we are getting here#\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_3 pgno:29" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Weight of 1 Ci of 24Na=w=micrograms=1.13*10**-7grams 0.113352495089\n" + ] + } + ], + "source": [ + "thalf=14.8*60*60;#half life of 24Na atom in seconds#\n", + "L=6.023*10**23;#Avagadro number#\n", + "v=3.7*10**10;#1 Ci of radioactivity in disintegrations per second#\n", + "w=(24*10**6*v*thalf)/(0.693*L);#weight of 1 Ci of 24Na in grams#\n", + "print'Weight of 1 Ci of 24Na=w=micrograms=1.13*10**-7grams',w\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_4 pgno:30" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "dM value of H atom=dM=amu 0.00239\n", + "\n", + "Binding energy of H atom=BE=MeV 2.22509\n" + ] + } + ], + "source": [ + "Mp=1.00728;#mass of proton in amu#\n", + "Mn=1.00866;#mass of neutronin amu#\n", + "MH=2.01355;#isotopic mass of H atom in amu#\n", + "dM=((1*Mp)+(1*Mn)-MH);#dM value of H atom in amu#\n", + "print'dM value of H atom=dM=amu',dM\n", + "BE=dM*931;#binding energy of H atom in MeV#\n", + "print'\\nBinding energy of H atom=BE=MeV',BE\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_5 pgno:32" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Age of the specimen=t=%fyears 36120.0499843\n" + ] + } + ], + "source": [ + "from math import log\n", + "N0=15.3;#decay rate of Contemporary Carbon in disintegrations/min/gram#\n", + "N=2.25;#decay rate of 14C specimen in disintegrtions/min/gram#\n", + "thalf=5670.;#half life of nuclide in years#\n", + "t=2.303*log(N0/N)*thalf/0.693;#Age of the specimen in years#\n", + "print'Age of the specimen=t=years',t#here the answer given in textbook is actually wrong we get twice that of the answer which is shown through execution#\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_6 pgno:33" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Here N0 and N must be in terms of Uranium.N is proportional to 1gram og Uranium\n", + "\n", + "N0 can be calculated from the given data.0.0453grams of 206Pb corresponds to 238*0.0453/206=0.0523grams of 238U,i.e 0.0453 grams of 206Pb must have been formed by the decaying of 0.523grams of 238U.\n", + "Since N is proportional to 1,N0 is proportional to 1.0523.\n", + "\n", + "Age of the mineral=t=years=7.62*10**8years 762356478.526\n" + ] + } + ], + "source": [ + "from math import log\n", + "thalf=4.5*10**9;#half life of Uranium in years#\n", + "print'Here N0 and N must be in terms of Uranium.N is proportional to 1gram og Uranium'\n", + "print'\\nN0 can be calculated from the given data.0.0453grams of 206Pb corresponds to 238*0.0453/206=0.0523grams of 238U,i.e 0.0453 grams of 206Pb must have been formed by the decaying of 0.523grams of 238U.\\nSince N is proportional to 1,N0 is proportional to 1.0523.'\n", + "N0=1.0523;\n", + "N=1;\n", + "t=2.303*log(N0/N)*thalf/0.693;#Age of the mineral in years#\n", + "print'\\nAge of the mineral=t=years=7.62*10**8years',t#here also the answer given in textbook is wrong the one resulted through execution is the right one#\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/makarala shamukha venkatasahithi/Chapter_2_Nuclear_Sturcture_and.ipynb b/sample_notebooks/makarala shamukha venkatasahithi/Chapter_2_Nuclear_Sturcture_and.ipynb deleted file mode 100755 index 505cf999..00000000 --- a/sample_notebooks/makarala shamukha venkatasahithi/Chapter_2_Nuclear_Sturcture_and.ipynb +++ /dev/null @@ -1,234 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 2 Nuclear Sturcture and Radioactivity" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_1 pgno:25" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Half life of radioactive nuclide=t1/2=minutes 14.7674928978\n", - "\n", - "Time required for the activity to decrease to 25percent of the initial activity=t1=minutes 68.0335182976\n", - "\n", - "Time required for the activity to decrease to 10percent of the initial activity=t2=minutes 113.001227913\n" - ] - } - ], - "source": [ - "from math import log\n", - "N0=3396.;#no. of counts per minute given by radioactive nuclide at a given time#\n", - "N=1000.;#no. of counts per minute given by radioactive nuclide one hour later#\n", - "thalf=0.693*60/(2.303*log(N0/N));#half life of nuclide in minutes#\n", - "print'Half life of radioactive nuclide=t1/2=minutes',thalf\n", - "t1=2.303*log(100/25)*thalf/0.693;#time required for the activity to decrease to 25% of the initial activity in minutes#\n", - "print'\\nTime required for the activity to decrease to 25percent of the initial activity=t1=minutes',t1\n", - "t2=2.303*log(100/10)*thalf/0.693;#time required for the activity to decrease to 10% of the initial activity in minutes#\n", - "print'\\nTime required for the activity to decrease to 10percent of the initial activity=t2=minutes',t2\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_2 pgno:27" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Half life of 226Ra molecule=t1/2=years 1584.62090409\n" - ] - } - ], - "source": [ - "R=3.7*10**10;#no. of alpha particles per second emitted by 1g of 226Ra#\n", - "N=(6.023*10**23)/226;#no. of atoms of 226Ra#\n", - "yr=3.15*10**7;#no of seconds in a year#\n", - "thalf=0.693*N/(R*yr);#half life of 226Ra in years#\n", - "print'Half life of 226Ra molecule=t1/2=years',thalf#here the answer written in textbook is wrongly printed actual answer will be the one we are getting here#\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_3 pgno:29" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Weight of 1 Ci of 24Na=w=micrograms=1.13*10**-7grams 0.113352495089\n" - ] - } - ], - "source": [ - "thalf=14.8*60*60;#half life of 24Na atom in seconds#\n", - "L=6.023*10**23;#Avagadro number#\n", - "v=3.7*10**10;#1 Ci of radioactivity in disintegrations per second#\n", - "w=(24*10**6*v*thalf)/(0.693*L);#weight of 1 Ci of 24Na in grams#\n", - "print'Weight of 1 Ci of 24Na=w=micrograms=1.13*10**-7grams',w\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_4 pgno:30" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "dM value of H atom=dM=amu 0.00239\n", - "\n", - "Binding energy of H atom=BE=MeV 2.22509\n" - ] - } - ], - "source": [ - "Mp=1.00728;#mass of proton in amu#\n", - "Mn=1.00866;#mass of neutronin amu#\n", - "MH=2.01355;#isotopic mass of H atom in amu#\n", - "dM=((1*Mp)+(1*Mn)-MH);#dM value of H atom in amu#\n", - "print'dM value of H atom=dM=amu',dM\n", - "BE=dM*931;#binding energy of H atom in MeV#\n", - "print'\\nBinding energy of H atom=BE=MeV',BE\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_5 pgno:32" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Age of the specimen=t=%fyears 36120.0499843\n" - ] - } - ], - "source": [ - "from math import log\n", - "N0=15.3;#decay rate of Contemporary Carbon in disintegrations/min/gram#\n", - "N=2.25;#decay rate of 14C specimen in disintegrtions/min/gram#\n", - "thalf=5670.;#half life of nuclide in years#\n", - "t=2.303*log(N0/N)*thalf/0.693;#Age of the specimen in years#\n", - "print'Age of the specimen=t=years',t#here the answer given in textbook is actually wrong we get twice that of the answer which is shown through execution#\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_6 pgno:33" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Here N0 and N must be in terms of Uranium.N is proportional to 1gram og Uranium\n", - "\n", - "N0 can be calculated from the given data.0.0453grams of 206Pb corresponds to 238*0.0453/206=0.0523grams of 238U,i.e 0.0453 grams of 206Pb must have been formed by the decaying of 0.523grams of 238U.\n", - "Since N is proportional to 1,N0 is proportional to 1.0523.\n", - "\n", - "Age of the mineral=t=years=7.62*10**8years 762356478.526\n" - ] - } - ], - "source": [ - "from math import log\n", - "thalf=4.5*10**9;#half life of Uranium in years#\n", - "print'Here N0 and N must be in terms of Uranium.N is proportional to 1gram og Uranium'\n", - "print'\\nN0 can be calculated from the given data.0.0453grams of 206Pb corresponds to 238*0.0453/206=0.0523grams of 238U,i.e 0.0453 grams of 206Pb must have been formed by the decaying of 0.523grams of 238U.\\nSince N is proportional to 1,N0 is proportional to 1.0523.'\n", - "N0=1.0523;\n", - "N=1;\n", - "t=2.303*log(N0/N)*thalf/0.693;#Age of the mineral in years#\n", - "print'\\nAge of the mineral=t=years=7.62*10**8years',t#here also the answer given in textbook is wrong the one resulted through execution is the right one#\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/makarala shamukha venkatasahithi/Chapter_5_Imperfection.ipynb b/sample_notebooks/makarala shamukha venkatasahithi/Chapter_5_Imperfection.ipynb new file mode 100755 index 00000000..0e2a1db4 --- /dev/null +++ b/sample_notebooks/makarala shamukha venkatasahithi/Chapter_5_Imperfection.ipynb @@ -0,0 +1,227 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5 Imperfection in Solids" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_1 pgno:56" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.1\n", + "\n", + "\n", + " Equilibrium number of vacancies/m**3 is for 1273K 2.18444488963e+25\n" + ] + } + ], + "source": [ + "# given that\n", + "Na=6.023*10**23 #Avogadro No.\n", + "rho=8.4e6 #Density of Copper in g/m**3\n", + "A=63.5 #Atomic weight of Copper\n", + "Qv=0.9 #Activation energy in eV\n", + "k=8.62*10**-5 #Boltzmann Constant in eV/K\n", + "T=1000+273#Temperature in K\n", + "from math import exp\n", + "print\"Example 5.1\\n\"\n", + "N=Na*rho/A #No. of atomic site per cubic meter\n", + "Nv=N*exp(-Qv/(k*T))\n", + "print\"\\n Equilibrium number of vacancies/m**3 is for 1273K\",Nv\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_3 pgno:57" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Example 5.3\n", + "\n", + "\n", + " Atomic of Al is 98.7039833218\n", + "\n", + " Atomic of Cu is 1.29601667817\n" + ] + } + ], + "source": [ + "# given that\n", + "C_Al=97. #Aluminium wt%\n", + "C_Cu=3. #Copper wt%\n", + "A_Al=26.98 #Atomic wt of Aluminium\n", + "A_Cu=63.55 #Atomic wt of Copper\n", + "\n", + "print\" Example 5.3\\n\"\n", + "CAl=C_Al*A_Cu*100/((C_Al*A_Cu)+(C_Cu*A_Al))\n", + "CCu=C_Cu*A_Al*100/((C_Cu*A_Al)+(C_Al*A_Cu))\n", + "print\"\\n Atomic of Al is\",CAl\n", + "print\"\\n Atomic of Cu is\",CCu\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_4 pgno:58" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.4\n", + "\n", + "\n", + " Number of Schottky defects are defects/m**3. 5.31422380078e+19\n" + ] + } + ], + "source": [ + "# given that\n", + "Na=6.023*10**23 #Avogadro No.\n", + "rho=1.955 #Density of KCl in g/cm**3\n", + "A_k= 39.10 #Atomic weight of potassium in g/mol\n", + "A_cl= 35.45 #Atomic weight of Chlorine in g/mol\n", + "Qs=2.6 #Activation energy in eV\n", + "k=8.62*10**-5 #Boltzmann Constant in eV/K\n", + "T=500+273 #Temperature in K\n", + "from math import exp\n", + "\n", + "print\"Example 5.4\\n\"\n", + "A = A_k+A_cl # Molar mass of KCl in gram\n", + "N=Na*rho*1e6/A #No. of atomic site per cubic meter\n", + "Ns=N*exp(-Qs/(2*k*T))\n", + "print\"\\n Number of Schottky defects are defects/m**3.\",Ns\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_6 pgno:58" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Example 5.6\n", + "\n", + "\n", + " Part A\n", + "\n", + " Grain size number is \n", + "6.49185309633\n", + "\n", + " Part B\n", + "\n", + " At magnification of 85x\n", + "\n", + " Number of grains per inch square are\n", + "62.2837370242\n" + ] + } + ], + "source": [ + "# given that \n", + "N=45. #Number of grains per square inch\n", + "M=85. # magnification\n", + "from math import log\n", + "print\"Example 5.6\\n\"\n", + "print\"\\n Part A\"\n", + "n=(log(N)/log(2))+1 #calculation for grain size no. N=2**(n-1)\n", + "print\"\\n Grain size number is \\n\",n\n", + "print\"\\n Part B\"\n", + "Nm=(100/M)**2*2**(n-1)\n", + "print\"\\n At magnification of 85x\\n\"\n", + "print\" Number of grains per inch square are\\n\",Nm\n", + "# answer in book is 62.6. It is because of rounding off at intermediate stages\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/makarala shamukha venkatasahithi/Chapter_5_Imperfection_in.ipynb b/sample_notebooks/makarala shamukha venkatasahithi/Chapter_5_Imperfection_in.ipynb deleted file mode 100755 index 0e2a1db4..00000000 --- a/sample_notebooks/makarala shamukha venkatasahithi/Chapter_5_Imperfection_in.ipynb +++ /dev/null @@ -1,227 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 5 Imperfection in Solids" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_1 pgno:56" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.1\n", - "\n", - "\n", - " Equilibrium number of vacancies/m**3 is for 1273K 2.18444488963e+25\n" - ] - } - ], - "source": [ - "# given that\n", - "Na=6.023*10**23 #Avogadro No.\n", - "rho=8.4e6 #Density of Copper in g/m**3\n", - "A=63.5 #Atomic weight of Copper\n", - "Qv=0.9 #Activation energy in eV\n", - "k=8.62*10**-5 #Boltzmann Constant in eV/K\n", - "T=1000+273#Temperature in K\n", - "from math import exp\n", - "print\"Example 5.1\\n\"\n", - "N=Na*rho/A #No. of atomic site per cubic meter\n", - "Nv=N*exp(-Qv/(k*T))\n", - "print\"\\n Equilibrium number of vacancies/m**3 is for 1273K\",Nv\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_3 pgno:57" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " Example 5.3\n", - "\n", - "\n", - " Atomic of Al is 98.7039833218\n", - "\n", - " Atomic of Cu is 1.29601667817\n" - ] - } - ], - "source": [ - "# given that\n", - "C_Al=97. #Aluminium wt%\n", - "C_Cu=3. #Copper wt%\n", - "A_Al=26.98 #Atomic wt of Aluminium\n", - "A_Cu=63.55 #Atomic wt of Copper\n", - "\n", - "print\" Example 5.3\\n\"\n", - "CAl=C_Al*A_Cu*100/((C_Al*A_Cu)+(C_Cu*A_Al))\n", - "CCu=C_Cu*A_Al*100/((C_Cu*A_Al)+(C_Al*A_Cu))\n", - "print\"\\n Atomic of Al is\",CAl\n", - "print\"\\n Atomic of Cu is\",CCu\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_4 pgno:58" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.4\n", - "\n", - "\n", - " Number of Schottky defects are defects/m**3. 5.31422380078e+19\n" - ] - } - ], - "source": [ - "# given that\n", - "Na=6.023*10**23 #Avogadro No.\n", - "rho=1.955 #Density of KCl in g/cm**3\n", - "A_k= 39.10 #Atomic weight of potassium in g/mol\n", - "A_cl= 35.45 #Atomic weight of Chlorine in g/mol\n", - "Qs=2.6 #Activation energy in eV\n", - "k=8.62*10**-5 #Boltzmann Constant in eV/K\n", - "T=500+273 #Temperature in K\n", - "from math import exp\n", - "\n", - "print\"Example 5.4\\n\"\n", - "A = A_k+A_cl # Molar mass of KCl in gram\n", - "N=Na*rho*1e6/A #No. of atomic site per cubic meter\n", - "Ns=N*exp(-Qs/(2*k*T))\n", - "print\"\\n Number of Schottky defects are defects/m**3.\",Ns\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_6 pgno:58" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example 5.6\n", - "\n", - "\n", - " Part A\n", - "\n", - " Grain size number is \n", - "6.49185309633\n", - "\n", - " Part B\n", - "\n", - " At magnification of 85x\n", - "\n", - " Number of grains per inch square are\n", - "62.2837370242\n" - ] - } - ], - "source": [ - "# given that \n", - "N=45. #Number of grains per square inch\n", - "M=85. # magnification\n", - "from math import log\n", - "print\"Example 5.6\\n\"\n", - "print\"\\n Part A\"\n", - "n=(log(N)/log(2))+1 #calculation for grain size no. N=2**(n-1)\n", - "print\"\\n Grain size number is \\n\",n\n", - "print\"\\n Part B\"\n", - "Nm=(100/M)**2*2**(n-1)\n", - "print\"\\n At magnification of 85x\\n\"\n", - "print\" Number of grains per inch square are\\n\",Nm\n", - "# answer in book is 62.6. It is because of rounding off at intermediate stages\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/manchukondasrinivasa rao/Chapter_7.ipynb b/sample_notebooks/manchukondasrinivasa rao/Chapter_7.ipynb new file mode 100755 index 00000000..38d38099 --- /dev/null +++ b/sample_notebooks/manchukondasrinivasa rao/Chapter_7.ipynb @@ -0,0 +1,299 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 7 Wave Guides" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_1 pgno:75" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-Critical wavelength = cm\n", + "15.24\n", + "-Guide wavelength = cm 13.3\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "c=3.*(10**8);\n", + "f=3000.*(10**8);\n", + "lo=c/f;\n", + "l=lo*(10**4);\n", + "m=1.;n=0;a=7.62;\n", + "lc=2*a;\n", + "print\"-Critical wavelength = cm\\n\",lc\n", + "lg=sqrt((l*l*lc*lc)/((lc*lc)-(l*l)));\n", + "print\"-Guide wavelength = cm\",round(lg*10)/10\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_2 pgno:76" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Frequency of dominant mode = GHz 5.0\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "a=3;\n", + "lc=2*a;\n", + "Zs=500;n=377;c=3*(10**8);\n", + "lo=sqrt(1-((n/Zs)**2))*lc;\n", + "f=c/lo;\n", + "f1=f/(10**7);\n", + "print\"Frequency of dominant mode = GHz\",round(f1*100)/100\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_3 pgno:78" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(i)Cutoff wavelegth = cm\n", + "9.0\n", + "(ii)Guide wavelength = cm\n", + "3.59\n", + "(iii)Phase velocity = * 10**8 m/sec\n", + "3.23\n", + " Group velocity = * 10**8 m/sec\n", + "2.79\n", + "(iv)Characteristic impedance = ohm 406.0\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "a=4.5;b=3.;f=9.*(10**9);c=3.0*(10**8);n=377.\n", + "lo=c/f;\n", + "l=lo*(10**2);\n", + "lc=2*a;\n", + "print\"(i)Cutoff wavelegth = cm\\n\",lc\n", + "lg=l /(sqrt(1-((l/lc)**2)));\n", + "print\"(ii)Guide wavelength = cm\\n\",round(lg*100)/100\n", + "Vp=(lg/l)*c*10**-8;\n", + "print\"(iii)Phase velocity = * 10**8 m/sec\\n\",round(Vp*100)/100\n", + "Vg=(l/lg)*c*10**-8;\n", + "print\" Group velocity = * 10**8 m/sec\\n\",round(Vg*100)/100\n", + "Z=n/(sqrt(1-((l/lc)**2)));\n", + "print\"(iv)Characteristic impedance = ohm\",round(Z)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_4 pgno:79" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total attenuation = db 681.88\n", + "The difference in result is due to erroneous value in textbook\n" + ] + } + ], + "source": [ + "a=1.;c=3.*(10**8);f=(10**9);d=25.;\n", + "lc=2*a;\n", + "lo=c/f;\n", + "l=lo/(10**2);\n", + "att=(54.55/lc)*d;\n", + "print\"Total attenuation = db\",round(att*100)/100\n", + "#the difference in result is due to erroneous value in textbook.\n", + "print (\"The difference in result is due to erroneous value in textbook\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_5 pgno:80" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-Phase velocity Vp = * 10**8 m/sec\n", + "4.2\n", + "-Group velocity Vg = * 10**8 m/sec\n", + "2.2\n", + "-Phase constant = radians/m 45.0\n" + ] + } + ], + "source": [ + "from math import sqrt,pi\n", + "c=3.*(10**8);f=3000.*(10**6);a=.0722;\n", + "lo=c/f;\n", + "lc=2*a;\n", + "lg=lo/(sqrt(1-((lo/lc)**2)));\n", + "Vp=(lg/lo)*c*10**-8;\n", + "print\"-Phase velocity Vp = * 10**8 m/sec\\n\",round(Vp*10)/10\n", + "Vg=(lo/lg)*c*10**-8;\n", + "print\"-Group velocity Vg = * 10**8 m/sec\\n\",round(Vg*10)/10\n", + "b=(2*pi)/lg;\n", + "print\"-Phase constant = radians/m\",round(b)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_6 pgno:81" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(i)Cutoff frequency for TE11 = GHz\n", + "3.52\n", + "(ii)Cutoff frequency for TE01 = GHz 4.6\n" + ] + } + ], + "source": [ + "\n", + "d=5.;c=3.*(10**8);\n", + "lo=1.706*d;\n", + "f=c/lo;\n", + "ff=f/(10**7);\n", + "print\"(i)Cutoff frequency for TE11 = GHz\\n\",round(ff*100)/100\n", + "l=1.306*d;\n", + "fc=c/l;\n", + "ffc=fc/(10**7);\n", + "print\"(ii)Cutoff frequency for TE01 = GHz\",round(ffc*10)/10\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7_7 pgno:82" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-Cutoff wavelength = cm\n", + "8.54\n", + "-Guide wavelength = cm\n", + "4.17\n", + "-Characteristic wave impedance = ohm 419.7\n" + ] + } + ], + "source": [ + "from math import pi,sqrt\n", + "c=3.*(10**8);f=8.*(10**9);r=2.5;h=1.84;n=377.;\n", + "l=c/f;\n", + "lo=l*(10**2);\n", + "lc=2*pi*r/h;\n", + "print\"-Cutoff wavelength = cm\\n\",round(lc*100)/100\n", + "lp=lo/(sqrt(1-((lo/lc)**2)));\n", + "print\"-Guide wavelength = cm\\n\",round(lp*100)/100\n", + "Zo=n/(sqrt(1-((lo/lc)**2)));\n", + "print\"-Characteristic wave impedance = ohm\",round(Zo*10)/10\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/manchukondasrinivasa rao/Chapter_7_Wave.ipynb b/sample_notebooks/manchukondasrinivasa rao/Chapter_7_Wave.ipynb deleted file mode 100755 index 38d38099..00000000 --- a/sample_notebooks/manchukondasrinivasa rao/Chapter_7_Wave.ipynb +++ /dev/null @@ -1,299 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 7 Wave Guides" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_1 pgno:75" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "-Critical wavelength = cm\n", - "15.24\n", - "-Guide wavelength = cm 13.3\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "c=3.*(10**8);\n", - "f=3000.*(10**8);\n", - "lo=c/f;\n", - "l=lo*(10**4);\n", - "m=1.;n=0;a=7.62;\n", - "lc=2*a;\n", - "print\"-Critical wavelength = cm\\n\",lc\n", - "lg=sqrt((l*l*lc*lc)/((lc*lc)-(l*l)));\n", - "print\"-Guide wavelength = cm\",round(lg*10)/10\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_2 pgno:76" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Frequency of dominant mode = GHz 5.0\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "a=3;\n", - "lc=2*a;\n", - "Zs=500;n=377;c=3*(10**8);\n", - "lo=sqrt(1-((n/Zs)**2))*lc;\n", - "f=c/lo;\n", - "f1=f/(10**7);\n", - "print\"Frequency of dominant mode = GHz\",round(f1*100)/100\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_3 pgno:78" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(i)Cutoff wavelegth = cm\n", - "9.0\n", - "(ii)Guide wavelength = cm\n", - "3.59\n", - "(iii)Phase velocity = * 10**8 m/sec\n", - "3.23\n", - " Group velocity = * 10**8 m/sec\n", - "2.79\n", - "(iv)Characteristic impedance = ohm 406.0\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "a=4.5;b=3.;f=9.*(10**9);c=3.0*(10**8);n=377.\n", - "lo=c/f;\n", - "l=lo*(10**2);\n", - "lc=2*a;\n", - "print\"(i)Cutoff wavelegth = cm\\n\",lc\n", - "lg=l /(sqrt(1-((l/lc)**2)));\n", - "print\"(ii)Guide wavelength = cm\\n\",round(lg*100)/100\n", - "Vp=(lg/l)*c*10**-8;\n", - "print\"(iii)Phase velocity = * 10**8 m/sec\\n\",round(Vp*100)/100\n", - "Vg=(l/lg)*c*10**-8;\n", - "print\" Group velocity = * 10**8 m/sec\\n\",round(Vg*100)/100\n", - "Z=n/(sqrt(1-((l/lc)**2)));\n", - "print\"(iv)Characteristic impedance = ohm\",round(Z)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_4 pgno:79" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Total attenuation = db 681.88\n", - "The difference in result is due to erroneous value in textbook\n" - ] - } - ], - "source": [ - "a=1.;c=3.*(10**8);f=(10**9);d=25.;\n", - "lc=2*a;\n", - "lo=c/f;\n", - "l=lo/(10**2);\n", - "att=(54.55/lc)*d;\n", - "print\"Total attenuation = db\",round(att*100)/100\n", - "#the difference in result is due to erroneous value in textbook.\n", - "print (\"The difference in result is due to erroneous value in textbook\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_5 pgno:80" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "-Phase velocity Vp = * 10**8 m/sec\n", - "4.2\n", - "-Group velocity Vg = * 10**8 m/sec\n", - "2.2\n", - "-Phase constant = radians/m 45.0\n" - ] - } - ], - "source": [ - "from math import sqrt,pi\n", - "c=3.*(10**8);f=3000.*(10**6);a=.0722;\n", - "lo=c/f;\n", - "lc=2*a;\n", - "lg=lo/(sqrt(1-((lo/lc)**2)));\n", - "Vp=(lg/lo)*c*10**-8;\n", - "print\"-Phase velocity Vp = * 10**8 m/sec\\n\",round(Vp*10)/10\n", - "Vg=(lo/lg)*c*10**-8;\n", - "print\"-Group velocity Vg = * 10**8 m/sec\\n\",round(Vg*10)/10\n", - "b=(2*pi)/lg;\n", - "print\"-Phase constant = radians/m\",round(b)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_6 pgno:81" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(i)Cutoff frequency for TE11 = GHz\n", - "3.52\n", - "(ii)Cutoff frequency for TE01 = GHz 4.6\n" - ] - } - ], - "source": [ - "\n", - "d=5.;c=3.*(10**8);\n", - "lo=1.706*d;\n", - "f=c/lo;\n", - "ff=f/(10**7);\n", - "print\"(i)Cutoff frequency for TE11 = GHz\\n\",round(ff*100)/100\n", - "l=1.306*d;\n", - "fc=c/l;\n", - "ffc=fc/(10**7);\n", - "print\"(ii)Cutoff frequency for TE01 = GHz\",round(ffc*10)/10\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 7_7 pgno:82" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "-Cutoff wavelength = cm\n", - "8.54\n", - "-Guide wavelength = cm\n", - "4.17\n", - "-Characteristic wave impedance = ohm 419.7\n" - ] - } - ], - "source": [ - "from math import pi,sqrt\n", - "c=3.*(10**8);f=8.*(10**9);r=2.5;h=1.84;n=377.;\n", - "l=c/f;\n", - "lo=l*(10**2);\n", - "lc=2*pi*r/h;\n", - "print\"-Cutoff wavelength = cm\\n\",round(lc*100)/100\n", - "lp=lo/(sqrt(1-((lo/lc)**2)));\n", - "print\"-Guide wavelength = cm\\n\",round(lp*100)/100\n", - "Zo=n/(sqrt(1-((lo/lc)**2)));\n", - "print\"-Characteristic wave impedance = ohm\",round(Zo*10)/10\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/marupeddisameer chaitanya/Sample.ipynb b/sample_notebooks/marupeddisameer chaitanya/Sample.ipynb new file mode 100755 index 00000000..bff5435f --- /dev/null +++ b/sample_notebooks/marupeddisameer chaitanya/Sample.ipynb @@ -0,0 +1,247 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 9 : Theories of Mass Transfer" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.1.1 pgno31" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The film thickness is cm 0.00765\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "p1 = 10. # pressure in atm\n", + "H = 600. # henrys constant in atm\n", + "c1 = 0 # gmol/cc\n", + "N1 = 2.3*10**-6 # mass flux in mol/cm**2-sec\n", + "c = 1./18. #total Concentration in g-mol/cc\n", + "D = 1.9*10**-5 # Diffusion co efficient in cm**2/sec\n", + "#Calculations\n", + "c1i = (p1/H)*c # Component concentration in gmol/cc\n", + "k = N1/(c1i-c1)#Mass transfer co efficient in cm/sec\n", + "l = D/k # Film thickness in cm\n", + "#Results\n", + "print\"The film thickness is cm\",round(l,5)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.2.1 pgno:34" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The contact time sec 3.9\n", + "\n", + "The surface resident time sec 3.0\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "D = 1.9*10**-5 #Diffusion co efficient in cm**2/sec\n", + "k = 2.5*10**-3 # M.T.C in cm/sec\n", + "from math import pi\n", + "#Calculations\n", + "Lbyvmax = 4*D/((k**2)*pi)#sec\n", + "tou = D/k**2 # sec\n", + "#Results\n", + "print\"The contact time sec\",round(Lbyvmax,1)\n", + "print\"\\nThe surface resident time sec\",round(tou,1)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.3.1 pgno:35" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The apparent m.t.c for the first case is cm/sec 0.000379885493042\n", + "\n", + "The apparent m.t.c for the second case is cm/sec 0.000742723884992\n", + "\n", + "The apparent is proportional to the power of of the velocity 0.61\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "const = 0.5 # The part of flow in the system which bypasses the region where the mass transfer occurs\n", + "v1 = 1. # cm/sec\n", + "al = 10**3\n", + "k = 10**-3 # cm/sec\n", + "v2 = 3. # cm/sec\n", + "from math import log\n", + "from math import exp\n", + "#Calculations\n", + "C1byC10first = const + (1-const)*(exp(-k*al/v1))# c1/c10\n", + "appk1 = (v1/al)*(log(1/C1byC10first))# Apparent m.t.c for first case in cm/sec\n", + "C1byC10second = const + (1-const)*(exp(-((3)**0.5)*k*al/v2))#c1/c10 in second case\n", + "appk2 = (v2/al)*log(1/C1byC10second)# apparent m.t.c for second case in cm/sec\n", + "power = log(appk2/appk1)/log(v2/v1)\n", + "#Results\n", + "print\"The apparent m.t.c for the first case is cm/sec\",appk1\n", + "print\"\\nThe apparent m.t.c for the second case is cm/sec\",appk2\n", + "print\"\\nThe apparent is proportional to the power of of the velocity\",round(power,2)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.4.1 pgno:37" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The average mass transfer coefficient is cm/sec 0.000431530124388\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "D = 1*10**-5 #cm**2/sec\n", + "d = 2.3 # cm\n", + "L = 14 # cm\n", + "v0 = 6.1 # cm/sec\n", + "#gamma(4./3.)=0.8909512761;\n", + "#calculations\n", + "k = ((3**(1./3.))/(0.8909512761))*((D/d))*(((d**2)*v0/(D*L))**(1./3.))# cm/sec\n", + "#Results\n", + "print\"The average mass transfer coefficient is cm/sec\",k\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.4.2 pgno:40" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The distance at which turbulent flow starts is cm 300.0\n", + "\n", + "The boundary layer for flow at this point is cm 300.0\n", + "\n", + "The boundary layer for concentration at this point is cm 300.0\n", + "\n", + "The local m.t.c at the leading edge and at the position of transistion is x10**-5 cm/sec 0.589714620247\n" + ] + } + ], + "source": [ + "#initialization of variables\n", + "tn = 300000 # turbulence number\n", + "v0 = 10 # cm/sec\n", + "p = 1 # g/cc\n", + "mu = 0.01 # g/cm-sec\n", + "delta = 2.5 #cm\n", + "D = 1*10**-5 # cm**2/sec\n", + "#Calculations\n", + "x = tn*mu/(v0*p)# cm\n", + "delta = ((280/13)**(1/2))*x*((mu/(x*v0*p))**(1/2))#cm\n", + "deltac = ((D*p/mu)**(1/3))*delta#cm\n", + "k = (0.323*(D/x)*((x*v0*p/mu)**0.5)*((mu/(p*D))**(1/3)))*10**5# x*10**-5 cm/sec\n", + "#Results\n", + "print\"The distance at which turbulent flow starts is cm\",x\n", + "print\"\\nThe boundary layer for flow at this point is cm\",delta\n", + "print\"\\nThe boundary layer for concentration at this point is cm\",deltac\n", + "print\"\\nThe local m.t.c at the leading edge and at the position of transistion is x10**-5 cm/sec\",k\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/marupeddisameer chaitanya/Sample_(chapter.ipynb b/sample_notebooks/marupeddisameer chaitanya/Sample_(chapter.ipynb deleted file mode 100755 index bff5435f..00000000 --- a/sample_notebooks/marupeddisameer chaitanya/Sample_(chapter.ipynb +++ /dev/null @@ -1,247 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 9 : Theories of Mass Transfer" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9.1.1 pgno31" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The film thickness is cm 0.00765\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "p1 = 10. # pressure in atm\n", - "H = 600. # henrys constant in atm\n", - "c1 = 0 # gmol/cc\n", - "N1 = 2.3*10**-6 # mass flux in mol/cm**2-sec\n", - "c = 1./18. #total Concentration in g-mol/cc\n", - "D = 1.9*10**-5 # Diffusion co efficient in cm**2/sec\n", - "#Calculations\n", - "c1i = (p1/H)*c # Component concentration in gmol/cc\n", - "k = N1/(c1i-c1)#Mass transfer co efficient in cm/sec\n", - "l = D/k # Film thickness in cm\n", - "#Results\n", - "print\"The film thickness is cm\",round(l,5)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9.2.1 pgno:34" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The contact time sec 3.9\n", - "\n", - "The surface resident time sec 3.0\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "D = 1.9*10**-5 #Diffusion co efficient in cm**2/sec\n", - "k = 2.5*10**-3 # M.T.C in cm/sec\n", - "from math import pi\n", - "#Calculations\n", - "Lbyvmax = 4*D/((k**2)*pi)#sec\n", - "tou = D/k**2 # sec\n", - "#Results\n", - "print\"The contact time sec\",round(Lbyvmax,1)\n", - "print\"\\nThe surface resident time sec\",round(tou,1)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9.3.1 pgno:35" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The apparent m.t.c for the first case is cm/sec 0.000379885493042\n", - "\n", - "The apparent m.t.c for the second case is cm/sec 0.000742723884992\n", - "\n", - "The apparent is proportional to the power of of the velocity 0.61\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "const = 0.5 # The part of flow in the system which bypasses the region where the mass transfer occurs\n", - "v1 = 1. # cm/sec\n", - "al = 10**3\n", - "k = 10**-3 # cm/sec\n", - "v2 = 3. # cm/sec\n", - "from math import log\n", - "from math import exp\n", - "#Calculations\n", - "C1byC10first = const + (1-const)*(exp(-k*al/v1))# c1/c10\n", - "appk1 = (v1/al)*(log(1/C1byC10first))# Apparent m.t.c for first case in cm/sec\n", - "C1byC10second = const + (1-const)*(exp(-((3)**0.5)*k*al/v2))#c1/c10 in second case\n", - "appk2 = (v2/al)*log(1/C1byC10second)# apparent m.t.c for second case in cm/sec\n", - "power = log(appk2/appk1)/log(v2/v1)\n", - "#Results\n", - "print\"The apparent m.t.c for the first case is cm/sec\",appk1\n", - "print\"\\nThe apparent m.t.c for the second case is cm/sec\",appk2\n", - "print\"\\nThe apparent is proportional to the power of of the velocity\",round(power,2)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9.4.1 pgno:37" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The average mass transfer coefficient is cm/sec 0.000431530124388\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "D = 1*10**-5 #cm**2/sec\n", - "d = 2.3 # cm\n", - "L = 14 # cm\n", - "v0 = 6.1 # cm/sec\n", - "#gamma(4./3.)=0.8909512761;\n", - "#calculations\n", - "k = ((3**(1./3.))/(0.8909512761))*((D/d))*(((d**2)*v0/(D*L))**(1./3.))# cm/sec\n", - "#Results\n", - "print\"The average mass transfer coefficient is cm/sec\",k\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 9.4.2 pgno:40" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The distance at which turbulent flow starts is cm 300.0\n", - "\n", - "The boundary layer for flow at this point is cm 300.0\n", - "\n", - "The boundary layer for concentration at this point is cm 300.0\n", - "\n", - "The local m.t.c at the leading edge and at the position of transistion is x10**-5 cm/sec 0.589714620247\n" - ] - } - ], - "source": [ - "#initialization of variables\n", - "tn = 300000 # turbulence number\n", - "v0 = 10 # cm/sec\n", - "p = 1 # g/cc\n", - "mu = 0.01 # g/cm-sec\n", - "delta = 2.5 #cm\n", - "D = 1*10**-5 # cm**2/sec\n", - "#Calculations\n", - "x = tn*mu/(v0*p)# cm\n", - "delta = ((280/13)**(1/2))*x*((mu/(x*v0*p))**(1/2))#cm\n", - "deltac = ((D*p/mu)**(1/3))*delta#cm\n", - "k = (0.323*(D/x)*((x*v0*p/mu)**0.5)*((mu/(p*D))**(1/3)))*10**5# x*10**-5 cm/sec\n", - "#Results\n", - "print\"The distance at which turbulent flow starts is cm\",x\n", - "print\"\\nThe boundary layer for flow at this point is cm\",delta\n", - "print\"\\nThe boundary layer for concentration at this point is cm\",deltac\n", - "print\"\\nThe local m.t.c at the leading edge and at the position of transistion is x10**-5 cm/sec\",k\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/marupeddisameer chaitanya/marupeddisameer chaitanya_version_backup/Chapter_4_Diffusion_and_Reaction_in.ipynb b/sample_notebooks/marupeddisameer chaitanya/marupeddisameer chaitanya_version_backup/Chapter_4_Diffusion_and_Reaction_in.ipynb new file mode 100755 index 00000000..a01d0a9f --- /dev/null +++ b/sample_notebooks/marupeddisameer chaitanya/marupeddisameer chaitanya_version_backup/Chapter_4_Diffusion_and_Reaction_in.ipynb @@ -0,0 +1,303 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4 Diffusion and Reaction in Porous Catalysts" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_1 pgno:135" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " OUTPUT Ex4.1.a\n", + "\n", + "=================================================\n", + "\n", + "The predicted diffusivity of Chlorine is cm2/s 0.00217149494706\n", + "\n", + "\n", + " OUTPUT Ex4.1.b\n", + "\n", + "=================================================\n", + "\n", + "The tortusity value = 1.25277093159\n", + "\n", + "\n", + " OUTPUT Ex4.1.b\n", + "\n", + "=================================================\n", + "\n", + "The Effective diffusivity of Chlorine K a atm = cm2/sec 573.0 15.0 1.83302312261e-09\n" + ] + } + ], + "source": [ + "#Harriot P.,2003,Chemical Reactor Design (I-Edition) Marcel Dekker,Inc.,USA,pp 436.\n", + "#Chapter-4 Ex4.1 Pg No. 135\n", + "#Title:Diffusivity of Chlorine and tortuosity in catalyst pellet\n", + "#===========================================================================================================\n", + "# COMMON INPUT \n", + "S_g=235.;#Total surface per gram (m2/g)\n", + "V_g=0.29E-6;#Pore volume per gram (cm3/g)\n", + "rho_p=1.41;#Density of particle (g/cm3)\n", + "D_He=0.0065;#Effective diffusivity of He (cm2/sec)\n", + "D_AB=0.73;# at 1atm and 298K\n", + "M_He=4.;#Molecular weight of He\n", + "M_Cl2=70.09;#Molecular weight of Cl2\n", + "T_ref=293;#Reference temperature\n", + "T_degC=300.;\n", + "T_01=T_degC+273;#Reaction temperature(K) (Ex4.1.a)\n", + "T_02=298.;#Operating temperature (Ex4.1.b)\n", + "T_03=573.;#operating temperature (Ex4.1.c)\n", + "P_ref=1;#Reference pressure\n", + "D_Cl2_CH4=0.15;#at 1atm 273K\n", + "P=15.;#operating pressure \n", + "#tau=1.25;#From value calculated in Ex4.1.b Pg. No. 136\n", + "from math import sqrt\n", + "\n", + "\n", + "#CALCULATION (Ex4.1.a)\n", + "r_bar=2*V_g/S_g;#Mean Pore radius\n", + "D_Cl2_Ex_a=D_He*((M_He/M_Cl2)*(T_01/T_ref))**(0.5);#Assuming Knudsen flow at 573K\n", + "\n", + "#CALCULATION (Ex4.1.b)\n", + "r_bar=2.*V_g*(10**6)/(S_g *(10**4));\n", + "D_K=9700.*(r_bar)*(T_ref/M_He)**(0.5);#Knudsen flow\n", + "D_AB1=D_AB*(293./298.)**(1.7)# at 1.5 atm and 293K\n", + "D_pore=1./((1./D_K)+(1./D_AB1));#pore diffusion\n", + "Epsilon=V_g*rho_p*(10**6);\n", + "tau=(D_pore*Epsilon)/D_He;#Tortusity\n", + "\n", + "#CALCULATION (Ex4.1.c)\n", + "D_Cl2_CH4_new=D_Cl2_CH4*(P_ref/P)*(T_03/T_ref)**(1.7);\n", + "D_K_Cl2=9700*r_bar*sqrt(T_03/M_Cl2);\n", + "D_pore=1/((1/D_Cl2_CH4_new)+(1/D_K_Cl2));\n", + "Epsilon=V_g*rho_p;\n", + "D_Cl2_Ex_c=D_pore*Epsilon/tau;\n", + "\n", + "\n", + "#OUTPUT\n", + "print '\\n OUTPUT Ex4.1.a'\n", + "print '\\n================================================='\n", + "print '\\nThe predicted diffusivity of Chlorine is cm2/s ',D_Cl2_Ex_a\n", + "print '\\n\\n OUTPUT Ex4.1.b'\n", + "print '\\n================================================='\n", + "print '\\nThe tortusity value = ',tau\n", + "print '\\n\\n OUTPUT Ex4.1.b'\n", + "print '\\n================================================='\n", + "print '\\nThe Effective diffusivity of Chlorine K a atm = cm2/sec ',T_03, P, D_Cl2_Ex_c\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_2 pgno:140" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " OUTPUT Ex4.2.a\n", + "\n", + "=================================================\n", + "\n", + " The effective diffusivity of O2 in air = cm2/s 0.0235933499021\n", + "\n", + "\n", + " OUTPUT Ex4.2.b\n", + "\n", + "=================================================\n", + "\n", + " The calculated surface mean pore radius = cm 6e-07\n", + "\n", + " The predicted pore diffusivity = cm2/sec 0.0218264089105\n", + "\n", + " The corresponding tortusity = 0.499558598529\n" + ] + } + ], + "source": [ + "#Harriot P.,2003,Chemical Reactor Design (I-Edition) Marcel Dekker,Inc.,USA,pp 436.\n", + "#Chapter-4 Ex4.2 Pg No. 140\n", + "#Title:Effective diffusivity of O2 in air\n", + "#============================================================================================================\n", + "\n", + "# COMMON INPUT\n", + "S_g=150.;#Total surface per gram (m2/g)\n", + "V_g=0.45;#Pore volume per gram (cm3/g)\n", + "V_i=0.30;#Micropore volume per gram (cm3/g)\n", + "V_a=0.15;# Macropore volume per gram (cm3/g)\n", + "rho_P=1.2;#Density of particle (g/cm3)\n", + "tau=2.5;# Tortusity\n", + "r_bar_i=40*(10**(-8));#Micropore radius\n", + "r_bar_a=2000*(10**(-8));#Macropore radius\n", + "D_AB=0.49;#For N2O2 at 1 atm (cm2/s)\n", + "M_O2=32.;#Molecular weight of O2\n", + "T=493.;#Opereating Temperature (K)\n", + "from math import sqrt\n", + "\n", + "\n", + "\n", + "#CALCULATION (Ex4.2.a)\n", + "Epsilon=V_g*rho_P;\n", + "D_K_i=9700*(r_bar_i)*sqrt(T/M_O2);#Knudsen flow for micropore\n", + "D_Pore_i=1/((1/D_K_i)+(1/D_AB))\n", + "D_K_a=9700*(r_bar_a)*sqrt(T/M_O2);\n", + "D_Pore_a=1/((1/D_K_a)+(1/D_AB));##Knudsen flow for macropore\n", + "D_Pore_Avg=(V_i*D_Pore_i+V_a*D_Pore_a)/(V_i+V_a);\n", + "D_e=Epsilon*D_Pore_Avg/tau;\n", + "\n", + "#CALCULATION (Ex4.2.b)\n", + "Epsilon=V_g*rho_P;\n", + "r_bar=2*V_g/(S_g*10**4);\n", + "D_K=9700*(r_bar)*sqrt(T/M_O2);#Knudsen Flow\n", + "D_Pore=1/((1/D_K)+(1/D_AB));\n", + "tau=D_Pore*Epsilon/D_e;\n", + "\n", + "#OUTPUT\n", + "print '\\n OUTPUT Ex4.2.a'\n", + "print '\\n================================================='\n", + "print '\\n The effective diffusivity of O2 in air = cm2/s',D_e \n", + "print '\\n\\n OUTPUT Ex4.2.b'\n", + "print '\\n================================================='\n", + "print '\\n The calculated surface mean pore radius = cm',r_bar \n", + "print '\\n The predicted pore diffusivity = cm2/sec',D_Pore \n", + "print '\\n The corresponding tortusity = ',tau\n", + "\n", + "\n", + "\n", + "#======================================================END OF PROGRAM========================================\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4_4 pgno:157" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\tBased on average pressures calculated Rate and Effectiveness factor\n", + "\n", + "\t r : (mol/s cm3) 1.17056498924e-05\n", + "\n", + "\t eta_calc : 0.174804371726\n", + "\n", + " The actual value of Effectiveness factor eta_actual : 0.427402185863\n" + ] + } + ], + "source": [ + "#Harriot P.,2003,Chemical Reactor Design (I-Edition) Marcel Dekker,Inc. USA,pp 436.\n", + "#Chapter-4 Ex4.4 Pg No.157\n", + "#Title: Effectiveness factor for solid catalyzed reaction\n", + "#======================================================================================================================\n", + "\n", + "#INPUT\n", + "D_e_A=0.02;#(cm2/s)\n", + "D_e_B=0.03;#(cm2/s)\n", + "D_e_C=0.015;#(cm2/s)\n", + "X_f_A=0.3;\n", + "X_f_B=(1-X_f_A);\n", + "eta_assumed=0.68;#Effectiveness factor from Fig.4.8 for first order reaction\n", + "T=150.;#(deg C)\n", + "T_K=T+273;#(K)\n", + "r=0.3;#(cm)Radius of catalyst sphere\n", + "P_opt=4.;#(atm)Operating Pressure \n", + "R=82.056;#(cm3 atm/K mol)Gas constant \n", + "\n", + "\n", + "#CALCULATION\n", + "#Kinetic equation r= (2.5*10**-5*P_A*P_B)/(1+0.1*P_A+2*P_C)**2\n", + "P_A=X_f_A*P_opt;\n", + "P_B=X_f_B*P_opt;\n", + "r_star=(2.5*10**-5*P_A*P_B)/(1+0.1*P_A)**2;\n", + "C_A=P_A/(R*T_K);\n", + "k=r_star/C_A;\n", + "Phi= r*(k/D_e_A)**(0.5);\n", + "P_A_bar=eta_assumed*P_A;\n", + "delta_P_A=P_A*(1-eta_assumed);\n", + "delta_P_B=delta_P_A*(D_e_A/D_e_B);\n", + "P_B_bar=P_B-delta_P_B;\n", + "delta_P_C=delta_P_A*(D_e_A/D_e_C);\n", + "P_C_bar=delta_P_C;\n", + "r_calc=(2.5*10**-5*P_A_bar*P_B_bar)/(1+0.1*P_A_bar+2*P_C_bar)**2\n", + "eta_calc=r_calc/r_star;\n", + "eta_approx=(eta_calc+eta_assumed)/2;\n", + "\n", + "#OUTPUT\n", + "#Console Output\n", + "print'\\tBased on average pressures calculated Rate and Effectiveness factor'\n", + "print'\\n\\t r : (mol/s cm3)',r_calc\n", + "print'\\n\\t eta_calc : ',eta_calc\n", + "print'\\n The actual value of Effectiveness factor eta_actual :',eta_approx\n", + "\n", + "#================================================END OF PROGRAM==================================================================================\n", + "\n", + "\n", + "\n", + "\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/marupeddisameer chaitanya/marupeddisameer chaitanya_version_backup/Chapter_4_Diffusion_and_Reaction_in_Porous.ipynb b/sample_notebooks/marupeddisameer chaitanya/marupeddisameer chaitanya_version_backup/Chapter_4_Diffusion_and_Reaction_in_Porous.ipynb deleted file mode 100755 index a01d0a9f..00000000 --- a/sample_notebooks/marupeddisameer chaitanya/marupeddisameer chaitanya_version_backup/Chapter_4_Diffusion_and_Reaction_in_Porous.ipynb +++ /dev/null @@ -1,303 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 4 Diffusion and Reaction in Porous Catalysts" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_1 pgno:135" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - " OUTPUT Ex4.1.a\n", - "\n", - "=================================================\n", - "\n", - "The predicted diffusivity of Chlorine is cm2/s 0.00217149494706\n", - "\n", - "\n", - " OUTPUT Ex4.1.b\n", - "\n", - "=================================================\n", - "\n", - "The tortusity value = 1.25277093159\n", - "\n", - "\n", - " OUTPUT Ex4.1.b\n", - "\n", - "=================================================\n", - "\n", - "The Effective diffusivity of Chlorine K a atm = cm2/sec 573.0 15.0 1.83302312261e-09\n" - ] - } - ], - "source": [ - "#Harriot P.,2003,Chemical Reactor Design (I-Edition) Marcel Dekker,Inc.,USA,pp 436.\n", - "#Chapter-4 Ex4.1 Pg No. 135\n", - "#Title:Diffusivity of Chlorine and tortuosity in catalyst pellet\n", - "#===========================================================================================================\n", - "# COMMON INPUT \n", - "S_g=235.;#Total surface per gram (m2/g)\n", - "V_g=0.29E-6;#Pore volume per gram (cm3/g)\n", - "rho_p=1.41;#Density of particle (g/cm3)\n", - "D_He=0.0065;#Effective diffusivity of He (cm2/sec)\n", - "D_AB=0.73;# at 1atm and 298K\n", - "M_He=4.;#Molecular weight of He\n", - "M_Cl2=70.09;#Molecular weight of Cl2\n", - "T_ref=293;#Reference temperature\n", - "T_degC=300.;\n", - "T_01=T_degC+273;#Reaction temperature(K) (Ex4.1.a)\n", - "T_02=298.;#Operating temperature (Ex4.1.b)\n", - "T_03=573.;#operating temperature (Ex4.1.c)\n", - "P_ref=1;#Reference pressure\n", - "D_Cl2_CH4=0.15;#at 1atm 273K\n", - "P=15.;#operating pressure \n", - "#tau=1.25;#From value calculated in Ex4.1.b Pg. No. 136\n", - "from math import sqrt\n", - "\n", - "\n", - "#CALCULATION (Ex4.1.a)\n", - "r_bar=2*V_g/S_g;#Mean Pore radius\n", - "D_Cl2_Ex_a=D_He*((M_He/M_Cl2)*(T_01/T_ref))**(0.5);#Assuming Knudsen flow at 573K\n", - "\n", - "#CALCULATION (Ex4.1.b)\n", - "r_bar=2.*V_g*(10**6)/(S_g *(10**4));\n", - "D_K=9700.*(r_bar)*(T_ref/M_He)**(0.5);#Knudsen flow\n", - "D_AB1=D_AB*(293./298.)**(1.7)# at 1.5 atm and 293K\n", - "D_pore=1./((1./D_K)+(1./D_AB1));#pore diffusion\n", - "Epsilon=V_g*rho_p*(10**6);\n", - "tau=(D_pore*Epsilon)/D_He;#Tortusity\n", - "\n", - "#CALCULATION (Ex4.1.c)\n", - "D_Cl2_CH4_new=D_Cl2_CH4*(P_ref/P)*(T_03/T_ref)**(1.7);\n", - "D_K_Cl2=9700*r_bar*sqrt(T_03/M_Cl2);\n", - "D_pore=1/((1/D_Cl2_CH4_new)+(1/D_K_Cl2));\n", - "Epsilon=V_g*rho_p;\n", - "D_Cl2_Ex_c=D_pore*Epsilon/tau;\n", - "\n", - "\n", - "#OUTPUT\n", - "print '\\n OUTPUT Ex4.1.a'\n", - "print '\\n================================================='\n", - "print '\\nThe predicted diffusivity of Chlorine is cm2/s ',D_Cl2_Ex_a\n", - "print '\\n\\n OUTPUT Ex4.1.b'\n", - "print '\\n================================================='\n", - "print '\\nThe tortusity value = ',tau\n", - "print '\\n\\n OUTPUT Ex4.1.b'\n", - "print '\\n================================================='\n", - "print '\\nThe Effective diffusivity of Chlorine K a atm = cm2/sec ',T_03, P, D_Cl2_Ex_c\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_2 pgno:140" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - " OUTPUT Ex4.2.a\n", - "\n", - "=================================================\n", - "\n", - " The effective diffusivity of O2 in air = cm2/s 0.0235933499021\n", - "\n", - "\n", - " OUTPUT Ex4.2.b\n", - "\n", - "=================================================\n", - "\n", - " The calculated surface mean pore radius = cm 6e-07\n", - "\n", - " The predicted pore diffusivity = cm2/sec 0.0218264089105\n", - "\n", - " The corresponding tortusity = 0.499558598529\n" - ] - } - ], - "source": [ - "#Harriot P.,2003,Chemical Reactor Design (I-Edition) Marcel Dekker,Inc.,USA,pp 436.\n", - "#Chapter-4 Ex4.2 Pg No. 140\n", - "#Title:Effective diffusivity of O2 in air\n", - "#============================================================================================================\n", - "\n", - "# COMMON INPUT\n", - "S_g=150.;#Total surface per gram (m2/g)\n", - "V_g=0.45;#Pore volume per gram (cm3/g)\n", - "V_i=0.30;#Micropore volume per gram (cm3/g)\n", - "V_a=0.15;# Macropore volume per gram (cm3/g)\n", - "rho_P=1.2;#Density of particle (g/cm3)\n", - "tau=2.5;# Tortusity\n", - "r_bar_i=40*(10**(-8));#Micropore radius\n", - "r_bar_a=2000*(10**(-8));#Macropore radius\n", - "D_AB=0.49;#For N2O2 at 1 atm (cm2/s)\n", - "M_O2=32.;#Molecular weight of O2\n", - "T=493.;#Opereating Temperature (K)\n", - "from math import sqrt\n", - "\n", - "\n", - "\n", - "#CALCULATION (Ex4.2.a)\n", - "Epsilon=V_g*rho_P;\n", - "D_K_i=9700*(r_bar_i)*sqrt(T/M_O2);#Knudsen flow for micropore\n", - "D_Pore_i=1/((1/D_K_i)+(1/D_AB))\n", - "D_K_a=9700*(r_bar_a)*sqrt(T/M_O2);\n", - "D_Pore_a=1/((1/D_K_a)+(1/D_AB));##Knudsen flow for macropore\n", - "D_Pore_Avg=(V_i*D_Pore_i+V_a*D_Pore_a)/(V_i+V_a);\n", - "D_e=Epsilon*D_Pore_Avg/tau;\n", - "\n", - "#CALCULATION (Ex4.2.b)\n", - "Epsilon=V_g*rho_P;\n", - "r_bar=2*V_g/(S_g*10**4);\n", - "D_K=9700*(r_bar)*sqrt(T/M_O2);#Knudsen Flow\n", - "D_Pore=1/((1/D_K)+(1/D_AB));\n", - "tau=D_Pore*Epsilon/D_e;\n", - "\n", - "#OUTPUT\n", - "print '\\n OUTPUT Ex4.2.a'\n", - "print '\\n================================================='\n", - "print '\\n The effective diffusivity of O2 in air = cm2/s',D_e \n", - "print '\\n\\n OUTPUT Ex4.2.b'\n", - "print '\\n================================================='\n", - "print '\\n The calculated surface mean pore radius = cm',r_bar \n", - "print '\\n The predicted pore diffusivity = cm2/sec',D_Pore \n", - "print '\\n The corresponding tortusity = ',tau\n", - "\n", - "\n", - "\n", - "#======================================================END OF PROGRAM========================================\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 4_4 pgno:157" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\tBased on average pressures calculated Rate and Effectiveness factor\n", - "\n", - "\t r : (mol/s cm3) 1.17056498924e-05\n", - "\n", - "\t eta_calc : 0.174804371726\n", - "\n", - " The actual value of Effectiveness factor eta_actual : 0.427402185863\n" - ] - } - ], - "source": [ - "#Harriot P.,2003,Chemical Reactor Design (I-Edition) Marcel Dekker,Inc. USA,pp 436.\n", - "#Chapter-4 Ex4.4 Pg No.157\n", - "#Title: Effectiveness factor for solid catalyzed reaction\n", - "#======================================================================================================================\n", - "\n", - "#INPUT\n", - "D_e_A=0.02;#(cm2/s)\n", - "D_e_B=0.03;#(cm2/s)\n", - "D_e_C=0.015;#(cm2/s)\n", - "X_f_A=0.3;\n", - "X_f_B=(1-X_f_A);\n", - "eta_assumed=0.68;#Effectiveness factor from Fig.4.8 for first order reaction\n", - "T=150.;#(deg C)\n", - "T_K=T+273;#(K)\n", - "r=0.3;#(cm)Radius of catalyst sphere\n", - "P_opt=4.;#(atm)Operating Pressure \n", - "R=82.056;#(cm3 atm/K mol)Gas constant \n", - "\n", - "\n", - "#CALCULATION\n", - "#Kinetic equation r= (2.5*10**-5*P_A*P_B)/(1+0.1*P_A+2*P_C)**2\n", - "P_A=X_f_A*P_opt;\n", - "P_B=X_f_B*P_opt;\n", - "r_star=(2.5*10**-5*P_A*P_B)/(1+0.1*P_A)**2;\n", - "C_A=P_A/(R*T_K);\n", - "k=r_star/C_A;\n", - "Phi= r*(k/D_e_A)**(0.5);\n", - "P_A_bar=eta_assumed*P_A;\n", - "delta_P_A=P_A*(1-eta_assumed);\n", - "delta_P_B=delta_P_A*(D_e_A/D_e_B);\n", - "P_B_bar=P_B-delta_P_B;\n", - "delta_P_C=delta_P_A*(D_e_A/D_e_C);\n", - "P_C_bar=delta_P_C;\n", - "r_calc=(2.5*10**-5*P_A_bar*P_B_bar)/(1+0.1*P_A_bar+2*P_C_bar)**2\n", - "eta_calc=r_calc/r_star;\n", - "eta_approx=(eta_calc+eta_assumed)/2;\n", - "\n", - "#OUTPUT\n", - "#Console Output\n", - "print'\\tBased on average pressures calculated Rate and Effectiveness factor'\n", - "print'\\n\\t r : (mol/s cm3)',r_calc\n", - "print'\\n\\t eta_calc : ',eta_calc\n", - "print'\\n The actual value of Effectiveness factor eta_actual :',eta_approx\n", - "\n", - "#================================================END OF PROGRAM==================================================================================\n", - "\n", - "\n", - "\n", - "\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/pramodkumardesu/Chapter_2.ipynb b/sample_notebooks/pramodkumardesu/Chapter_2.ipynb new file mode 100755 index 00000000..b232b9ae --- /dev/null +++ b/sample_notebooks/pramodkumardesu/Chapter_2.ipynb @@ -0,0 +1,263 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 2 Transmission Lines" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_1 pgno:65" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Maximum field = V/m per volt 42064315640.1\n" + ] + } + ], + "source": [ + "#Chapter 2, Example 1, page 65\n", + "#Calculate the maximum field at the sphere surface\n", + "\n", + "#Calulating Field at surface E based on figure 2.31 and table 2.3\n", + "from math import pi\n", + "Q1 = 0.25\n", + "e0 = 8.85418*10**-12 #Epselon nought\n", + "RV1= ((1/0.25**2)+(0.067/(0.25-0.067)**2)+(0.0048/(0.25-0.067)**2))\n", + "RV2= ((0.25+0.01795+0.00128)/(0.75-0.067)**2)\n", + "RV= RV1+RV2\n", + "E = (Q1*RV)/(4*pi*e0)\n", + "print\"Maximum field = V/m per volt\",E\n", + "\n", + "#Answers vary due to round off error\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_2 pgno:66" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Part a\t\n", + "Equivalent radius = m \t0.0887411967465\n", + "Charge per bundle = uC/m \t4.88704086264e-06\n", + "Charge per sunconducter = uC/m \t2.44352043132e-06\n", + "\tPart b\n", + "\tSub part 1\t\n", + "Maximum feild = kV/m \t2607466.95017\n", + "Maximum feild = kV/m \t2412255.52075\n", + "Maximum feild = kV/m \t2509861.23546\n", + "\tSub part 2\t\n", + "EO1 = kV/m \t2597956.83558\n", + "EO2 = kV/m \t2597429.47744\n", + "EI1 = kV/m \t2402709.21273\n", + "EI2 = kV/m \t2402258.0563\n", + "\tPart c\t\n", + "The average of the maximum gradient = kV/m \t2597693.15651\n" + ] + } + ], + "source": [ + "#Chapter 2, Exmaple 2, page 66\n", + "\n", + "\n", + "#calculation based on figure 2.32\n", + "from math import sqrt,pi,log\n", + "\n", + "#(a)Charge on each bundle\n", + "print\"Part a\\t\"\n", + "req = sqrt(0.0175*0.45)\n", + "print\"Equivalent radius = m \\t\", req\n", + "V = 400*10**3 #Voltage\n", + "H = 12. #bundle height in m\n", + "d = 9. #pole to pole spacing in m\n", + "e0 = 8.85418*10**-12 #Epselon nought\n", + "Hd = sqrt((2*H)**2+d**2)#2*H**2 + d**2\n", + "Q = V*2*pi*e0/(log((2*H/req))-log((Hd/d)))\n", + "q = Q/2\n", + "print\"Charge per bundle = uC/m \\t\",Q #micro C/m\n", + "print\"Charge per sunconducter = uC/m \\t\",q #micro C/m\n", + "\n", + "#(b part i)Maximim & average surface feild\n", + "print\"\\tPart b\"\n", + "print\"\\tSub part 1\\t\"\n", + "r = 0.0175 #subconductor radius\n", + "R = 0.45 #conductor to subconductor spacing\n", + "MF = (q/(2*pi*e0))*((1/r)+(1/R)) # maximum feild\n", + "print\"Maximum feild = kV/m \\t\",MF\n", + "MSF = (q/(2*pi*e0))*((1/r)-(1/R)) # maximum surface feild\n", + "print\"Maximum feild = kV/m \\t\",MSF\n", + "ASF = (q/(2*pi*e0))*(1/r) # Average surface feild\n", + "print\"Maximum feild = kV/m \\t\",ASF\n", + "\n", + "#(b part ii) Considering the two sunconductors on the left\n", + "print\"\\tSub part 2\\t\"\n", + "#field at the outer point of subconductor #1 \n", + "drO1 = 1/(d+r)\n", + "dRrO1 = 1/(d+R+r)\n", + "EO1 = MF -((q/(2*pi*e0))*(drO1+dRrO1))\n", + "print\"EO1 = kV/m \\t\",EO1\n", + "#field at the outer point of subconductor #2 \n", + "drO2 = 1/(d-r)\n", + "dRrO2 = 1/(d-R-r)\n", + "EO2 = MF -((q/(2*pi*e0))*(dRrO2+drO2))\n", + "print\"EO2 = kV/m \\t\",EO2\n", + "\n", + "#field at the inner point of subconductor #1 \n", + "drI1 = 1/(d-r)\n", + "dRrI1 = 1/(d+R-r)\n", + "EI1 = MSF -((q/(2*pi*e0))*(drI1+dRrI1))\n", + "print\"EI1 = kV/m \\t\",EI1\n", + "#field at the inner point of subconductor #2 \n", + "drI2 = 1/(d+r)\n", + "dRrI2 = 1/(d-R+r)\n", + "EI2 = MSF -((q/(2*pi*e0))*(dRrI2+drI2)) \n", + "print\"EI2 = kV/m \\t\",EI2\n", + "\n", + "#(part c)Average of the maximim gradient\n", + "print\"\\tPart c\\t\"\n", + "Eavg = (EO1+EO2)/2\n", + "print\"The average of the maximum gradient = kV/m \\t\",Eavg\n", + "\n", + "#Answers might vary due to round off error\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_3 pgno:69" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Electric Feild = V/m \t35950238891.0\n" + ] + } + ], + "source": [ + "#Chapter 2, Exmaple 3, page 69\n", + "#Electric feild induced at x\n", + "from math import pi\n", + "e0 = 8.85418*10**-12 #Epselon nought\n", + "q = 1 # C/m\n", + "C = (q/(2*pi*e0))\n", + "#Based on figure 2.33\n", + "E = C-(C*(1/3+1/7))+(C*(1+1/5+1/9))+(C*(1/5+1/9))-(C*(1/3+1/7))\n", + "print\"Electric Feild = V/m \\t\",E\n", + "\n", + "#Answers might vary due to round off error\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2_4 pgno:70" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\tThickness of graded design= cm \t4.24264068712\n", + "Curve = cm**2 \t62.4264068712\n", + "V1 = cm**3 \t47402.906725\n", + "Thickness of regular design = cm \t14.684289433\n", + "V2 = cm**3 \t861.944682812\n" + ] + } + ], + "source": [ + "#Chapter 2, Exmaple 4, page 70\n", + "#Calculate the volume of the insulator\n", + "from math import sqrt,pi,e\n", + "#Thinkness of graded design\n", + "V = 150*sqrt(2)\n", + "Ebd = 50\n", + "T = V/Ebd\n", + "print\"\\tThickness of graded design= cm \\t\",T\n", + "#Based on figure 2.24\n", + "r = 2 # radius of the conductor\n", + "l = 10 #length of graded cylinder; The textbook uses 10 instead of 20\n", + "zr = l*(T+r)\n", + "print\"Curve = cm**2 \\t\",zr\n", + "#Volume of graded design V1\n", + "V1 = 4*pi*zr*(zr-r)\n", + "print\"V1 = cm**3 \\t\",V1 #Unit is wrong in the textbook\n", + "#Thickness of regular design as obtained form Eq.2.77\n", + "pow = V/(2*Ebd)\n", + "t = 2*(e**pow-1)\n", + "print\"Thickness of regular design = cm \\t\",t\n", + "#Volume of regular design V2\n", + "V2 = pi*((2+t)**2-4)\n", + "print\"V2 = cm**3 \\t\",V2#unit not mentioned in textbook\n", + " \n", + "#Answers may vary due to round off error\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/pramodkumardesu/Chapter_2_Transmission.ipynb b/sample_notebooks/pramodkumardesu/Chapter_2_Transmission.ipynb deleted file mode 100755 index b232b9ae..00000000 --- a/sample_notebooks/pramodkumardesu/Chapter_2_Transmission.ipynb +++ /dev/null @@ -1,263 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 2 Transmission Lines" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_1 pgno:65" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Maximum field = V/m per volt 42064315640.1\n" - ] - } - ], - "source": [ - "#Chapter 2, Example 1, page 65\n", - "#Calculate the maximum field at the sphere surface\n", - "\n", - "#Calulating Field at surface E based on figure 2.31 and table 2.3\n", - "from math import pi\n", - "Q1 = 0.25\n", - "e0 = 8.85418*10**-12 #Epselon nought\n", - "RV1= ((1/0.25**2)+(0.067/(0.25-0.067)**2)+(0.0048/(0.25-0.067)**2))\n", - "RV2= ((0.25+0.01795+0.00128)/(0.75-0.067)**2)\n", - "RV= RV1+RV2\n", - "E = (Q1*RV)/(4*pi*e0)\n", - "print\"Maximum field = V/m per volt\",E\n", - "\n", - "#Answers vary due to round off error\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_2 pgno:66" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Part a\t\n", - "Equivalent radius = m \t0.0887411967465\n", - "Charge per bundle = uC/m \t4.88704086264e-06\n", - "Charge per sunconducter = uC/m \t2.44352043132e-06\n", - "\tPart b\n", - "\tSub part 1\t\n", - "Maximum feild = kV/m \t2607466.95017\n", - "Maximum feild = kV/m \t2412255.52075\n", - "Maximum feild = kV/m \t2509861.23546\n", - "\tSub part 2\t\n", - "EO1 = kV/m \t2597956.83558\n", - "EO2 = kV/m \t2597429.47744\n", - "EI1 = kV/m \t2402709.21273\n", - "EI2 = kV/m \t2402258.0563\n", - "\tPart c\t\n", - "The average of the maximum gradient = kV/m \t2597693.15651\n" - ] - } - ], - "source": [ - "#Chapter 2, Exmaple 2, page 66\n", - "\n", - "\n", - "#calculation based on figure 2.32\n", - "from math import sqrt,pi,log\n", - "\n", - "#(a)Charge on each bundle\n", - "print\"Part a\\t\"\n", - "req = sqrt(0.0175*0.45)\n", - "print\"Equivalent radius = m \\t\", req\n", - "V = 400*10**3 #Voltage\n", - "H = 12. #bundle height in m\n", - "d = 9. #pole to pole spacing in m\n", - "e0 = 8.85418*10**-12 #Epselon nought\n", - "Hd = sqrt((2*H)**2+d**2)#2*H**2 + d**2\n", - "Q = V*2*pi*e0/(log((2*H/req))-log((Hd/d)))\n", - "q = Q/2\n", - "print\"Charge per bundle = uC/m \\t\",Q #micro C/m\n", - "print\"Charge per sunconducter = uC/m \\t\",q #micro C/m\n", - "\n", - "#(b part i)Maximim & average surface feild\n", - "print\"\\tPart b\"\n", - "print\"\\tSub part 1\\t\"\n", - "r = 0.0175 #subconductor radius\n", - "R = 0.45 #conductor to subconductor spacing\n", - "MF = (q/(2*pi*e0))*((1/r)+(1/R)) # maximum feild\n", - "print\"Maximum feild = kV/m \\t\",MF\n", - "MSF = (q/(2*pi*e0))*((1/r)-(1/R)) # maximum surface feild\n", - "print\"Maximum feild = kV/m \\t\",MSF\n", - "ASF = (q/(2*pi*e0))*(1/r) # Average surface feild\n", - "print\"Maximum feild = kV/m \\t\",ASF\n", - "\n", - "#(b part ii) Considering the two sunconductors on the left\n", - "print\"\\tSub part 2\\t\"\n", - "#field at the outer point of subconductor #1 \n", - "drO1 = 1/(d+r)\n", - "dRrO1 = 1/(d+R+r)\n", - "EO1 = MF -((q/(2*pi*e0))*(drO1+dRrO1))\n", - "print\"EO1 = kV/m \\t\",EO1\n", - "#field at the outer point of subconductor #2 \n", - "drO2 = 1/(d-r)\n", - "dRrO2 = 1/(d-R-r)\n", - "EO2 = MF -((q/(2*pi*e0))*(dRrO2+drO2))\n", - "print\"EO2 = kV/m \\t\",EO2\n", - "\n", - "#field at the inner point of subconductor #1 \n", - "drI1 = 1/(d-r)\n", - "dRrI1 = 1/(d+R-r)\n", - "EI1 = MSF -((q/(2*pi*e0))*(drI1+dRrI1))\n", - "print\"EI1 = kV/m \\t\",EI1\n", - "#field at the inner point of subconductor #2 \n", - "drI2 = 1/(d+r)\n", - "dRrI2 = 1/(d-R+r)\n", - "EI2 = MSF -((q/(2*pi*e0))*(dRrI2+drI2)) \n", - "print\"EI2 = kV/m \\t\",EI2\n", - "\n", - "#(part c)Average of the maximim gradient\n", - "print\"\\tPart c\\t\"\n", - "Eavg = (EO1+EO2)/2\n", - "print\"The average of the maximum gradient = kV/m \\t\",Eavg\n", - "\n", - "#Answers might vary due to round off error\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_3 pgno:69" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Electric Feild = V/m \t35950238891.0\n" - ] - } - ], - "source": [ - "#Chapter 2, Exmaple 3, page 69\n", - "#Electric feild induced at x\n", - "from math import pi\n", - "e0 = 8.85418*10**-12 #Epselon nought\n", - "q = 1 # C/m\n", - "C = (q/(2*pi*e0))\n", - "#Based on figure 2.33\n", - "E = C-(C*(1/3+1/7))+(C*(1+1/5+1/9))+(C*(1/5+1/9))-(C*(1/3+1/7))\n", - "print\"Electric Feild = V/m \\t\",E\n", - "\n", - "#Answers might vary due to round off error\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 2_4 pgno:70" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\tThickness of graded design= cm \t4.24264068712\n", - "Curve = cm**2 \t62.4264068712\n", - "V1 = cm**3 \t47402.906725\n", - "Thickness of regular design = cm \t14.684289433\n", - "V2 = cm**3 \t861.944682812\n" - ] - } - ], - "source": [ - "#Chapter 2, Exmaple 4, page 70\n", - "#Calculate the volume of the insulator\n", - "from math import sqrt,pi,e\n", - "#Thinkness of graded design\n", - "V = 150*sqrt(2)\n", - "Ebd = 50\n", - "T = V/Ebd\n", - "print\"\\tThickness of graded design= cm \\t\",T\n", - "#Based on figure 2.24\n", - "r = 2 # radius of the conductor\n", - "l = 10 #length of graded cylinder; The textbook uses 10 instead of 20\n", - "zr = l*(T+r)\n", - "print\"Curve = cm**2 \\t\",zr\n", - "#Volume of graded design V1\n", - "V1 = 4*pi*zr*(zr-r)\n", - "print\"V1 = cm**3 \\t\",V1 #Unit is wrong in the textbook\n", - "#Thickness of regular design as obtained form Eq.2.77\n", - "pow = V/(2*Ebd)\n", - "t = 2*(e**pow-1)\n", - "print\"Thickness of regular design = cm \\t\",t\n", - "#Volume of regular design V2\n", - "V2 = pi*((2+t)**2-4)\n", - "print\"V2 = cm**3 \\t\",V2#unit not mentioned in textbook\n", - " \n", - "#Answers may vary due to round off error\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/ravindra m gowda/Chapter_1_Basics_of.ipynb b/sample_notebooks/ravindra m gowda/Chapter_1_Basics_of.ipynb new file mode 100644 index 00000000..62799900 --- /dev/null +++ b/sample_notebooks/ravindra m gowda/Chapter_1_Basics_of.ipynb @@ -0,0 +1,461 @@ +{ + "metadata": { + "name": " Chapter 1 Basics of thermodynamics Rudramani" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": "Basics of Thermodynamics" + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Ex 1.1 # pageno 34" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "f=-40 # medium temperature in -40 degree\nf1=32 # standard value in 32\nT=(f-f1)*5/9 #temperature in degree\nprint \"hence -40 on the fahrenheit scale is equal to \",T,\" on the degree celsius\"", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "hence -40 on the fahrenheit scale is equal to -40 on the degree celsius\n" + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Ex 1.2 # pageno 34" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "# to find density\nmass=1600 #mass in kg\nv=2 # volume in 2m3\nd=mass/v # density in kg/m3\nprint 'Density =mass/volume =',d,'kg/m3'\n", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Density =mass/volume = 800 kg/m3\n" + } + ], + "prompt_number": 107 + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": "Ex 1.3 # page no 35" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "# to find specific weight of oil\nm=1600 # mass of oil\ng=9.81 # acceleration due to gravity\nv=2 # volume\ns=(m*g)/v # specific gravity\nprint s,\"N/m3\"", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "7848.0 N/m3\n" + } + ], + "prompt_number": 106 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Ex 1.4 #pageno 35" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "Do=float(800) #Density of oil\nDW=float(1000) #Density of water\n\n#calculation\nSG=float(Do/DW) #Specific grav\n#print SG\n#print ('%.1f' %(SG*.1))\n#output\nprint \"Specific gravity \",SG", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Specific gravity 0.8\n" + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Ex 1.5 # pageno 35" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "# to find kinematic viscosity\nu=0.001 #viscosity of oil\np=800 # specific gravity\nk=u/p # kinematic viscosity\nprint \"kinematic viscosity\", k,\"m2/s\"", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "kinematic viscosity 1.25e-06 m2/s\n" + } + ], + "prompt_number": 40 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Ex 1.6 # pageno 35" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "# to find the absolute pressure\np1=13600 # atmospheric pressue\ng=9.81# vaccum pressure\nh=0.76 #barometric pressure of mercury\nBa=p1*g*h\nprint 'Barometric pressure',round(Ba/1000,1),'kN/m2'\ngauge= 5000# gauge pressure\nAb=(Ba/1000)+gauge # Absolute pressure=atmospheric pressure + gauge pressure\nprint 'Absoulte pressure',round(Ab,1),'kPa = or ',round(Ab/1000,1),'bar'", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Barometric pressure 101.4 kN/m2\nAbsoulte pressure 5101.4 kPa = or 5.1 bar\n" + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Ex 1.7 #pageno 35" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "# to find absolute temperature\nbar=760 # barometeric pressure\nvac=700 # vacuum pressure\nab=bar-vac\nprint ab,'mm of Hg'\np=13600 # specific gravity \ng=9.81 # accelration due to gravity\nh=0.06 # N/m2\nAb=(p*g*h)\nprint 'Absolute pressure',Ab,'N/m2'", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "60 mm of Hg\nAbsolute pressure 8004.96 N/m2\n" + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Ex 1.8 #pageno 35" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#page no35 to find heat required \nt2=1300 # temperature in kelvin\nt1=290 # temperature 290k\nc=.49 # mass 0.49 kj/kg k\nm=200 # mass in kg\nH=(m*c)*(t2-t1)\nprint 'Heat required',H,'kJ'", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Heat required 98980.0 kJ\n" + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Ex 1.9 #pageno 36" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "# to find change in internal energy\nm=-0.3 # mechanical stirrer\nt=5 # min\nt1=5*60 # minutes into seconds\nw=m*t1 # work done by mechanical stirrer\nprint 'work done by mechanical stirrer',w,'kJ'\nq=5*300 # charge in t*w\nu=q+w # U=Q-W\nprint 'change in internal energy of water U=Q-W',u,'kJ'", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "work done by mechanical stirrer -90.0 kJ\nchange in internal energy of water U=Q-W 1410.0 kJ\n" + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Ex 1.10 # pageno 36" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "# from tables h=460.545 \nh=460.545 #kJ/kg \nv=0.066484 # m3/kg\np=400 # pressure from table \nu=h-(p*v) # kJ/kg\nprint 'U=',u,'kJ/kg'", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "U= 433.9514 kJ/kg\n" + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Ex 1.11 #pageno 36" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "# to calculate total work done\np1=4 # bar 1\np2=1 # bar2\ng=1.4 # gamma\nt1=425 # t1 in temperature 425k\nte=(g-1)/g #gamma-1/gamma\ng1=(p1/p2)**te\nt2=t1/g1 # temperature T2\nprint 'T2 =',round(t2,1),'K'\nv1=0.2 # volume of 0.2 m3\nv3=1/g # 1/gamma\nv2=(0.25)**v3\nprint 'V1/V2',round(v2,4)\nvol=v1/v2\nprint 'V2 = ',round(vol,4),'m3'\nR=1-v3\nprint 'R=cp-cv=',round(R*1000,1),'J/kg K'\nm=(p1*v1*10**5)/(t2*t1)\nprint round(m,3),'kg'\nen=70\nt3=(en/m)+(t2)\nprint 'T3 =',round(t3,1),'K'\nV3=vol*t3/t2\nprint 'V3 =',round(V3,3),'m3'\nW=((p1*v1*10**5)-(p2*vol*10**5))/0.4\nprint 'W1-2 =',round(W/1000,3),'kJ'\nW2=p2*10**5*(V3-vol)\nprint 'W2-3 = ',round(W2*100,2),'kJ'\nW1=W+W2\nprint 'W =W1-2+W2-3 =',round(W1/1000,3),'kJ'", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "T2 = 286.0 K\nV1/V2 0.3715\nV2 = 0.5384 m3\nR=cp-cv= 285.7 J/kg K\n0.658 kg\nT3 = 392.4 K\nV3 = 0.739 m3\nW1-2 = 65.41 kJ\nW2-3 = 2002026.54 kJ\nW =W1-2+W2-3 = 85.43 kJ\n" + } + ], + "prompt_number": 51 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Ex1.12\n" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "# pageno 36 to find final temperature\n#from figure ddepicts the process given in book\nT1=300 # temperature in 300K\nv2=float(0.003) #volume in 0.003m3\nv1=float(0.03)\nn=float(1.3)#n\nt=(v2/v1)**(n-1)\nprint round(t,3)\nT2=T1/t # temperature in degree c\np=2\nprint 'T2 =',round(T2),'=' ,round(T2-273),' degree C'\np1=(v2/v1)**n\np2=p/p1\nprint 'P2 =',round(p2),'bar=',round(p2),'10**5 N/m2'\nw=((p2*10**5*v2)-(p*10**5*v1))/(n-1)# work done during compression\nprint 'W1-2= ',round(w),'J',round(w,1)/1000,'kJ' ", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "0.501\nT2 = 599.0 = 326.0 degree C\nP2 = 40.0 bar= 40.0 10**5 N/m2\nW1-2= 19905.0 J 19.9052 kJ\n" + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "EX 1.13 #pageno 38" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "Thigh=float(1200) # temperature in high\nK=float(273) # 273 in kelvin\nth=float(Thigh+K) #convert degree into kelvin\nTlow = float(150) # temperature in low\ntl=float(Tlow+K) #convert degree into kelvin\nn=float((th-tl)/th) #effiency in percentage of engine\nprint 'Effiency = ',round(n,3),'=',round(n*100,3),'%'\n", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Effiency = 0.713 = 71.283 %\n" + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Ex1.14 #pageno 38" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#to find heat supplied by each source and to effiency of the engine\n# to find reversible engine mentioned in figure in the textbook\nt1=float(1000) # constant temperature\nt2=float(310)# constant temperature\nn1=float((t1-t2)/t1)\nprint 'n1 =',n1\nt3=float(800)# constant temperature\nn2=float((t3-t2)/t3)\nprint 'n2 =',n2\nQ1=25.8 \nQ2=134.2\nW=100# work obtained\nth=W/(Q1+Q2) # heat supllied from the source\nprint 'Thermal efficiency of the engine = ',th,'=',th*100,'%'\n", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "n1 = 0.69\nn2 = 0.6125\nThermal efficiency of the engine = 0.625 = 62.5 %\n" + } + ], + "prompt_number": 104 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Ex 1.15 " + }, + { + "cell_type": "code", + "collapsed": false, + "input": "#to find power required to drive the plant\ntlow=float(263) # low temperature\nthigh=float(300) # high temperature\ncop=float(tlow/(thigh-tlow)) #coefficient of performance ideal\nprint 'COP ideal =',round(cop,2)\np=0.6\ncopac=cop*p #coefficient of performance actual\nprint 'COP actual =',round(copac,3)\nhe= 30*10**3\nw=he/copac # power required to drive plant\nprint 'power required to run the plant = ',round(w/1000,3),'kW'", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "COP ideal = 7.11\nCOP actual = 4.265\npower required to run the plant = 7.034 kW\n" + } + ], + "prompt_number": 83 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "\nEx 1.16 \n" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "# to find conduction heat transfer rate through the plate\nT2=600 # high temperature\nT1=100# low temperature\nL=0.1 # thickness of slab\nK=20 # thermal conductivity \nA=1 # area in m2\nQ=(K*A)*(T2-T1)/L\nprint 'Q =',Q/1000,'kW'", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Q = 100.0 kW\n" + } + ], + "prompt_number": 88 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Ex1.17" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "# To find heat conduction \nt1=1300 #temperature at 1300 degree c\nt3=115 # temperature at 115 degree c\nl1=0.5 # thickneess of slab\nk1=1.4 # thermal conductivity\na=1 # constant a=1\nl2=0.161 # thickness of slab 2\nk2=0.35 # thermal conductivity of second slab\nQ=(t1-t3)/((l1/(a*k1))+(l2/(a*k2))) # conduction of heat transfer\nprint 'Q=',round(Q,1),'W =',round(Q/1000,2),'kW'\n", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Q= 1450.2 W = 1.45 kW\n" + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Ex 1.18 pageno 40" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "# to find conduction transfer\nimport math\nt1=float(300)\nt2=float(200)\nl=float(2)\nk=float(70)\nr2=float(0.1)\nr1=float(0.05)\nQ=float((k*2*3.14*l*(t1-t2))/(math.log((r2/r1))))\nprint 'Q= ',round(Q,2),'W =',round(Q/1000,2),'kW'", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Q= 126841.75 W = 126.84 kW\n" + } + ], + "prompt_number": 53 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "EX 1.19 pageno 40" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "# to find internal temperature and conduction transfer rate\nimport math\nt1=float(225)# temperature in degree\nt4=float(25) # temperature in degree\nL=1 #length in m\nk1=float(50) #thermal conductivity constant\nr1=float(5)#thermal conductivity constant\nr2=float(5.5)#thermal conductivity constant\nk2=float(0.06) #thermal conductivity constant\nr3=float(10.0)#thermal conductivity constant\nr4=float(15.5)#thermal conductivity constant\nk4=float(1/(k1)) #1/k1\nk3=0.12 #thermal conductivity constant\np=float(1/(2*math.pi*L)) #1/2pil\nk5=float(1/(k2)) #1/k2\nk6=float(1/(k3)) #1/k3\nQ=float((t1-t4)/(p*((k4*math.log(r1/r2))+(k5*math.log(r3/r2))+(k6*math.log(r4/r3))))) #Conduction transfer\nprint 'Q= ',round(Q,2),'W'\nprint 'calculation error in textbook' # error in textbook\nT2=(t1-float(Q*p*(k4*math.log(r2/r1)))) # internal temperature T2\nprint 'T2 = ',round(T2,1),'Degree C' \nT3 =(T2-float(Q*p*(k5*math.log(r3/r2)))) # internal temperature T3\nprint 'T3 =',round(T3,2),'Degree C'", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Q= 92.3 W\ncalculation error in textbook\nT2 = 225.0 Degree C\nT3 = 78.6 Degree C\n" + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Ex 1.20 pageno 41" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "# to find conduction heat transfer rate through hallow sphere\nimport math3\nt1=290 # inner surface temperature\nt3=20 # outter surface temperature\nk1=float(70) # thermal conductivity k1\nr2=float(0.15) # radius r2\nr1=0.05 # radius r1\nk2=float(15) # thermal conductivity k2\nr3= float(0.2) # radius r3\np=float(1/(4*3.14)) #1/4pi\nr5=float((1)/(k1)) # 1/k1\nr4=float((1)/(k2)) #1/k2\nQ=float((t1-t3)/((p)*((r5*((r2-r1)/(r1*r2)))+(r4*((r3-r2)/(r3*r2)))))) # thermal conductivity\nprint 'Q= ',round(Q,2),'W'\n ", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Q= 11244.51 W\n" + } + ], + "prompt_number": 41 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": "Ex 1.21 #page no 41" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "# to determine radiation heat exchange between to plates\nsigma=0.567*10**-7 # surface density of square plate\nt1=1273# temperature of plate1\nt2=773 # temperature of plate 2\nf12=0.415 # shape factor\na1=1 # area of size 1mx1m\nQ=a1*f12*sigma*((t1**4)-(t2**4)) # thermal conductivity\nprint 'Q=',round(Q,2),'W =',round(Q/1000,2),'kW'", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Q= 53392.43 W = 53.39 kW\n" + } + ], + "prompt_number": 44 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/ravindra m gowda/Chapter_1_Basics_of_thermodynamics.ipynb b/sample_notebooks/ravindra m gowda/Chapter_1_Basics_of_thermodynamics.ipynb deleted file mode 100644 index 62799900..00000000 --- a/sample_notebooks/ravindra m gowda/Chapter_1_Basics_of_thermodynamics.ipynb +++ /dev/null @@ -1,461 +0,0 @@ -{ - "metadata": { - "name": " Chapter 1 Basics of thermodynamics Rudramani" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": "Basics of Thermodynamics" - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Ex 1.1 # pageno 34" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "f=-40 # medium temperature in -40 degree\nf1=32 # standard value in 32\nT=(f-f1)*5/9 #temperature in degree\nprint \"hence -40 on the fahrenheit scale is equal to \",T,\" on the degree celsius\"", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "hence -40 on the fahrenheit scale is equal to -40 on the degree celsius\n" - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Ex 1.2 # pageno 34" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "# to find density\nmass=1600 #mass in kg\nv=2 # volume in 2m3\nd=mass/v # density in kg/m3\nprint 'Density =mass/volume =',d,'kg/m3'\n", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Density =mass/volume = 800 kg/m3\n" - } - ], - "prompt_number": 107 - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": "Ex 1.3 # page no 35" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "# to find specific weight of oil\nm=1600 # mass of oil\ng=9.81 # acceleration due to gravity\nv=2 # volume\ns=(m*g)/v # specific gravity\nprint s,\"N/m3\"", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "7848.0 N/m3\n" - } - ], - "prompt_number": 106 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Ex 1.4 #pageno 35" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "Do=float(800) #Density of oil\nDW=float(1000) #Density of water\n\n#calculation\nSG=float(Do/DW) #Specific grav\n#print SG\n#print ('%.1f' %(SG*.1))\n#output\nprint \"Specific gravity \",SG", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Specific gravity 0.8\n" - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Ex 1.5 # pageno 35" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "# to find kinematic viscosity\nu=0.001 #viscosity of oil\np=800 # specific gravity\nk=u/p # kinematic viscosity\nprint \"kinematic viscosity\", k,\"m2/s\"", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "kinematic viscosity 1.25e-06 m2/s\n" - } - ], - "prompt_number": 40 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Ex 1.6 # pageno 35" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "# to find the absolute pressure\np1=13600 # atmospheric pressue\ng=9.81# vaccum pressure\nh=0.76 #barometric pressure of mercury\nBa=p1*g*h\nprint 'Barometric pressure',round(Ba/1000,1),'kN/m2'\ngauge= 5000# gauge pressure\nAb=(Ba/1000)+gauge # Absolute pressure=atmospheric pressure + gauge pressure\nprint 'Absoulte pressure',round(Ab,1),'kPa = or ',round(Ab/1000,1),'bar'", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Barometric pressure 101.4 kN/m2\nAbsoulte pressure 5101.4 kPa = or 5.1 bar\n" - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Ex 1.7 #pageno 35" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "# to find absolute temperature\nbar=760 # barometeric pressure\nvac=700 # vacuum pressure\nab=bar-vac\nprint ab,'mm of Hg'\np=13600 # specific gravity \ng=9.81 # accelration due to gravity\nh=0.06 # N/m2\nAb=(p*g*h)\nprint 'Absolute pressure',Ab,'N/m2'", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "60 mm of Hg\nAbsolute pressure 8004.96 N/m2\n" - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Ex 1.8 #pageno 35" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#page no35 to find heat required \nt2=1300 # temperature in kelvin\nt1=290 # temperature 290k\nc=.49 # mass 0.49 kj/kg k\nm=200 # mass in kg\nH=(m*c)*(t2-t1)\nprint 'Heat required',H,'kJ'", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Heat required 98980.0 kJ\n" - } - ], - "prompt_number": 19 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Ex 1.9 #pageno 36" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "# to find change in internal energy\nm=-0.3 # mechanical stirrer\nt=5 # min\nt1=5*60 # minutes into seconds\nw=m*t1 # work done by mechanical stirrer\nprint 'work done by mechanical stirrer',w,'kJ'\nq=5*300 # charge in t*w\nu=q+w # U=Q-W\nprint 'change in internal energy of water U=Q-W',u,'kJ'", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "work done by mechanical stirrer -90.0 kJ\nchange in internal energy of water U=Q-W 1410.0 kJ\n" - } - ], - "prompt_number": 26 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Ex 1.10 # pageno 36" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "# from tables h=460.545 \nh=460.545 #kJ/kg \nv=0.066484 # m3/kg\np=400 # pressure from table \nu=h-(p*v) # kJ/kg\nprint 'U=',u,'kJ/kg'", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "U= 433.9514 kJ/kg\n" - } - ], - "prompt_number": 29 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Ex 1.11 #pageno 36" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "# to calculate total work done\np1=4 # bar 1\np2=1 # bar2\ng=1.4 # gamma\nt1=425 # t1 in temperature 425k\nte=(g-1)/g #gamma-1/gamma\ng1=(p1/p2)**te\nt2=t1/g1 # temperature T2\nprint 'T2 =',round(t2,1),'K'\nv1=0.2 # volume of 0.2 m3\nv3=1/g # 1/gamma\nv2=(0.25)**v3\nprint 'V1/V2',round(v2,4)\nvol=v1/v2\nprint 'V2 = ',round(vol,4),'m3'\nR=1-v3\nprint 'R=cp-cv=',round(R*1000,1),'J/kg K'\nm=(p1*v1*10**5)/(t2*t1)\nprint round(m,3),'kg'\nen=70\nt3=(en/m)+(t2)\nprint 'T3 =',round(t3,1),'K'\nV3=vol*t3/t2\nprint 'V3 =',round(V3,3),'m3'\nW=((p1*v1*10**5)-(p2*vol*10**5))/0.4\nprint 'W1-2 =',round(W/1000,3),'kJ'\nW2=p2*10**5*(V3-vol)\nprint 'W2-3 = ',round(W2*100,2),'kJ'\nW1=W+W2\nprint 'W =W1-2+W2-3 =',round(W1/1000,3),'kJ'", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "T2 = 286.0 K\nV1/V2 0.3715\nV2 = 0.5384 m3\nR=cp-cv= 285.7 J/kg K\n0.658 kg\nT3 = 392.4 K\nV3 = 0.739 m3\nW1-2 = 65.41 kJ\nW2-3 = 2002026.54 kJ\nW =W1-2+W2-3 = 85.43 kJ\n" - } - ], - "prompt_number": 51 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Ex1.12\n" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "# pageno 36 to find final temperature\n#from figure ddepicts the process given in book\nT1=300 # temperature in 300K\nv2=float(0.003) #volume in 0.003m3\nv1=float(0.03)\nn=float(1.3)#n\nt=(v2/v1)**(n-1)\nprint round(t,3)\nT2=T1/t # temperature in degree c\np=2\nprint 'T2 =',round(T2),'=' ,round(T2-273),' degree C'\np1=(v2/v1)**n\np2=p/p1\nprint 'P2 =',round(p2),'bar=',round(p2),'10**5 N/m2'\nw=((p2*10**5*v2)-(p*10**5*v1))/(n-1)# work done during compression\nprint 'W1-2= ',round(w),'J',round(w,1)/1000,'kJ' ", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "0.501\nT2 = 599.0 = 326.0 degree C\nP2 = 40.0 bar= 40.0 10**5 N/m2\nW1-2= 19905.0 J 19.9052 kJ\n" - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "EX 1.13 #pageno 38" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "Thigh=float(1200) # temperature in high\nK=float(273) # 273 in kelvin\nth=float(Thigh+K) #convert degree into kelvin\nTlow = float(150) # temperature in low\ntl=float(Tlow+K) #convert degree into kelvin\nn=float((th-tl)/th) #effiency in percentage of engine\nprint 'Effiency = ',round(n,3),'=',round(n*100,3),'%'\n", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Effiency = 0.713 = 71.283 %\n" - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Ex1.14 #pageno 38" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#to find heat supplied by each source and to effiency of the engine\n# to find reversible engine mentioned in figure in the textbook\nt1=float(1000) # constant temperature\nt2=float(310)# constant temperature\nn1=float((t1-t2)/t1)\nprint 'n1 =',n1\nt3=float(800)# constant temperature\nn2=float((t3-t2)/t3)\nprint 'n2 =',n2\nQ1=25.8 \nQ2=134.2\nW=100# work obtained\nth=W/(Q1+Q2) # heat supllied from the source\nprint 'Thermal efficiency of the engine = ',th,'=',th*100,'%'\n", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "n1 = 0.69\nn2 = 0.6125\nThermal efficiency of the engine = 0.625 = 62.5 %\n" - } - ], - "prompt_number": 104 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Ex 1.15 " - }, - { - "cell_type": "code", - "collapsed": false, - "input": "#to find power required to drive the plant\ntlow=float(263) # low temperature\nthigh=float(300) # high temperature\ncop=float(tlow/(thigh-tlow)) #coefficient of performance ideal\nprint 'COP ideal =',round(cop,2)\np=0.6\ncopac=cop*p #coefficient of performance actual\nprint 'COP actual =',round(copac,3)\nhe= 30*10**3\nw=he/copac # power required to drive plant\nprint 'power required to run the plant = ',round(w/1000,3),'kW'", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "COP ideal = 7.11\nCOP actual = 4.265\npower required to run the plant = 7.034 kW\n" - } - ], - "prompt_number": 83 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "\nEx 1.16 \n" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "# to find conduction heat transfer rate through the plate\nT2=600 # high temperature\nT1=100# low temperature\nL=0.1 # thickness of slab\nK=20 # thermal conductivity \nA=1 # area in m2\nQ=(K*A)*(T2-T1)/L\nprint 'Q =',Q/1000,'kW'", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Q = 100.0 kW\n" - } - ], - "prompt_number": 88 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Ex1.17" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "# To find heat conduction \nt1=1300 #temperature at 1300 degree c\nt3=115 # temperature at 115 degree c\nl1=0.5 # thickneess of slab\nk1=1.4 # thermal conductivity\na=1 # constant a=1\nl2=0.161 # thickness of slab 2\nk2=0.35 # thermal conductivity of second slab\nQ=(t1-t3)/((l1/(a*k1))+(l2/(a*k2))) # conduction of heat transfer\nprint 'Q=',round(Q,1),'W =',round(Q/1000,2),'kW'\n", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Q= 1450.2 W = 1.45 kW\n" - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Ex 1.18 pageno 40" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "# to find conduction transfer\nimport math\nt1=float(300)\nt2=float(200)\nl=float(2)\nk=float(70)\nr2=float(0.1)\nr1=float(0.05)\nQ=float((k*2*3.14*l*(t1-t2))/(math.log((r2/r1))))\nprint 'Q= ',round(Q,2),'W =',round(Q/1000,2),'kW'", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Q= 126841.75 W = 126.84 kW\n" - } - ], - "prompt_number": 53 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "EX 1.19 pageno 40" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "# to find internal temperature and conduction transfer rate\nimport math\nt1=float(225)# temperature in degree\nt4=float(25) # temperature in degree\nL=1 #length in m\nk1=float(50) #thermal conductivity constant\nr1=float(5)#thermal conductivity constant\nr2=float(5.5)#thermal conductivity constant\nk2=float(0.06) #thermal conductivity constant\nr3=float(10.0)#thermal conductivity constant\nr4=float(15.5)#thermal conductivity constant\nk4=float(1/(k1)) #1/k1\nk3=0.12 #thermal conductivity constant\np=float(1/(2*math.pi*L)) #1/2pil\nk5=float(1/(k2)) #1/k2\nk6=float(1/(k3)) #1/k3\nQ=float((t1-t4)/(p*((k4*math.log(r1/r2))+(k5*math.log(r3/r2))+(k6*math.log(r4/r3))))) #Conduction transfer\nprint 'Q= ',round(Q,2),'W'\nprint 'calculation error in textbook' # error in textbook\nT2=(t1-float(Q*p*(k4*math.log(r2/r1)))) # internal temperature T2\nprint 'T2 = ',round(T2,1),'Degree C' \nT3 =(T2-float(Q*p*(k5*math.log(r3/r2)))) # internal temperature T3\nprint 'T3 =',round(T3,2),'Degree C'", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Q= 92.3 W\ncalculation error in textbook\nT2 = 225.0 Degree C\nT3 = 78.6 Degree C\n" - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Ex 1.20 pageno 41" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "# to find conduction heat transfer rate through hallow sphere\nimport math3\nt1=290 # inner surface temperature\nt3=20 # outter surface temperature\nk1=float(70) # thermal conductivity k1\nr2=float(0.15) # radius r2\nr1=0.05 # radius r1\nk2=float(15) # thermal conductivity k2\nr3= float(0.2) # radius r3\np=float(1/(4*3.14)) #1/4pi\nr5=float((1)/(k1)) # 1/k1\nr4=float((1)/(k2)) #1/k2\nQ=float((t1-t3)/((p)*((r5*((r2-r1)/(r1*r2)))+(r4*((r3-r2)/(r3*r2)))))) # thermal conductivity\nprint 'Q= ',round(Q,2),'W'\n ", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Q= 11244.51 W\n" - } - ], - "prompt_number": 41 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": "Ex 1.21 #page no 41" - }, - { - "cell_type": "code", - "collapsed": false, - "input": "# to determine radiation heat exchange between to plates\nsigma=0.567*10**-7 # surface density of square plate\nt1=1273# temperature of plate1\nt2=773 # temperature of plate 2\nf12=0.415 # shape factor\na1=1 # area of size 1mx1m\nQ=a1*f12*sigma*((t1**4)-(t2**4)) # thermal conductivity\nprint 'Q=',round(Q,2),'W =',round(Q/1000,2),'kW'", - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": "Q= 53392.43 W = 53.39 kW\n" - } - ], - "prompt_number": 44 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/vijayadurga/Chapter_5_Force_Torque_and_Shaft.ipynb b/sample_notebooks/vijayadurga/Chapter_5_Force_Torque_and_Shaft.ipynb new file mode 100755 index 00000000..379da0ca --- /dev/null +++ b/sample_notebooks/vijayadurga/Chapter_5_Force_Torque_and_Shaft.ipynb @@ -0,0 +1,265 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5 Force Torque and Shaft power Measurement" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_1 pgno:204" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x=(Sg*sig_f*(1+v))/(2*E)\n", + "('a voltmeter with a maximum range of mV is suitable for measurement', 94.9385766342288)\n", + "Round it off to get the suitable range voltmeter\n" + ] + } + ], + "source": [ + "#CHAPTER 5_ Force,Torque and Shaft Power Measurement\n", + "#Caption : Load cell\n", + "# Example 1# Page 294\n", + "from math import sqrt\n", + "\n", + "Sg=2.; # Strain gage factor\n", + "Rg=120.; # Gage resistance\n", + "v=0.3 # poissons ratio\n", + "E=210*10**9; # for steel\n", + "Pd=1. #('enter the power dissipation capacity=:')\n", + "# Looking for a suitable voltage measuring system\n", + "sig_f=700*10**6 #('enter the fatigue strength=:')\n", + "P_max=10000. #('enter the maximum load=:')\n", + "# For a load cell of square cross-section d,\n", + "d=sqrt(P_max/sig_f);\n", + "Ei=sqrt(4*Rg*Pd) #input excitation to the bridge circuit\n", + "x=(Sg*sig_f*(1+v))/(2*E);\n", + "dEo_max=x*Ei*10**3;\n", + "print (\"x=(Sg*sig_f*(1+v))/(2*E)\")\n", + "print ('a voltmeter with a maximum range of mV is suitable for measurement',dEo_max)\n", + "print (\"Round it off to get the suitable range voltmeter\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_2 pgno:295" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "('(dE/V)_max= d\\n ', 4285714.285714285)\n", + "Sensitivity of this load cell is nV/N/per unit excitation 42.8571428571\n" + ] + } + ], + "source": [ + "#CHAPTER 5_ Force,Torque and Shaft Power Measurement\n", + "#Caption : Load cell\n", + "# Example 2# Page 295\n", + "\n", + "b=.2 #('enter the width of load cell=:')\n", + "h=.05 #('enter the thickness of load cell=:')\n", + "Sg=2.;\n", + "Rg=120.;\n", + "sig_f=150*10**6 #('enter the fatigue strength=:')\n", + "E=70.; #(in GPa) for aluminium\n", + "v=0.33; #poissons ratio\n", + "# Let dE/V_max be represented by W\n", + "W=Sg*sig_f/E;\n", + "print('(dE/V)_max= d\\n ',W)\n", + "P_max=100000. #('enter the value of maximum load=:')\n", + "l=sig_f*b*h**2/(6*P_max);\n", + "\n", + "S=(6*Sg*l)/(E*b*h**2);\n", + "print'Sensitivity of this load cell is nV/N/per unit excitation',S\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_3 pgno:296" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Sensitivity of this load cell is micro V/N\n", + "0.13\n", + "The maximum density that can be achieved without endangering the strain gage sensors is micro V/N\n", + "0.284815729903\n", + "The voltage ratio is mV/V 3.9\n" + ] + } + ], + "source": [ + "#CHAPTER 5_ Force,Torque and Shaft Power Measurement\n", + "#Caption : Load cell\n", + "# Example 3# Page 296\n", + "from math import sqrt\n", + "Sg=2;\n", + "v=0.3; #poissons ratio\n", + "Ei=10. #('enter the excitation voltage=:')\n", + "A=5*10**-4 #('enter the area of load cell=:')\n", + "E=200.; #(in Gpa) Youngs modulus\n", + "# Let sensitivity Eo/P be represented by Se\n", + "Se=Sg*(1+v)*Ei/(2*A*E)*.001;\n", + "print'Sensitivity of this load cell is micro V/N\\n',Se\n", + "Rg=120. #given\n", + "Pd=1. #('enter the power dissipated in each gage=:')\n", + "Ei_max=sqrt(4*Rg*Pd)\n", + "Se_max=Sg*(1+v)*Ei_max/(2*A*E)*.001\n", + "print'The maximum density that can be achieved without endangering the strain gage sensors is micro V/N\\n',Se_max\n", + "# Let (Eo/Ei)_max be represented by Em\n", + "sig_f=600*10**6 #('enter the fatigue strength=:')\n", + "Em=Sg*sig_f*(1+v)/(2*E)*10**-6\n", + "print'The voltage ratio is mV/V',Em\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_4 pgno:302" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "('Relative displacement is d', 1.9999999999999997e-08)\n", + "wnc**2 is approx. 10**9. So,\n", + "Z is approx. 20nm(rms)\n", + "Actual force transmitted to the plate is d N 18.0260791198\n" + ] + } + ], + "source": [ + "#CHAPTER 5_ Force,Torque and Shaft Power Measurement\n", + "#Caption : Piezoelectric Transducers\n", + "# Example 4# Page 302\n", + "from math import sqrt,pi\n", + "mc=0.04 #('enter the connector mass=:')\n", + "m=0.01 #('enter the seismic mass=:')\n", + "k=10**9 #('enter the stiffness of the sensing element=:')\n", + "Sf=.005 #('enter the sensitivity of the transducer=:')\n", + "Xi=100*10**-6 # ('enter the displacement amplitude of the shaker vibration=:')\n", + "Eo=.1 #('enter the reading of voltage recorder connected to the transducer=:')\n", + "wnc=sqrt(k/(m+mc));\n", + "R=20; #20N (rms)\n", + "Z=(1/(m+mc))*(1/wnc**2)*R;\n", + "print('Relative displacement is d',Z)\n", + "print(\"wnc**2 is approx. 10**9. So,\")\n", + "print(\"Z is approx. 20nm(rms)\")\n", + "f=100.; # given\n", + "\n", + "F=R-((2*pi*f)**2*(m+mc)*Xi);\n", + "print'Actual force transmitted to the plate is d N',F\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5_5 pgno:308" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The load torque is d N-m 1636.24617374\n" + ] + } + ], + "source": [ + "#CHAPTER 5_ Force,Torque and Shaft Power Measurement\n", + "#Caption : Torque measurement on rotating shaft\n", + "# Example 5# Page 308\n", + "Sg=2.;\n", + "Rg=120.;\n", + "G=80*10**9 #('enter the sheer modulus of elasticity=:')\n", + "D=0.05 #('enter the shaft diameter=:')\n", + "dR=0.1 # given\n", + "# we have to find the load torque\n", + "from math import pi\n", + "\n", + "y=2*dR/(Rg*Sg);\n", + "tou_xy=y*G;\n", + "j=pi*D**4;\n", + "T=tou_xy*2*j/(D*32);\n", + "print'The load torque is d N-m',T" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/vijayadurga/Chapter_5_Force_Torque_and_Shaft_power.ipynb b/sample_notebooks/vijayadurga/Chapter_5_Force_Torque_and_Shaft_power.ipynb deleted file mode 100755 index 379da0ca..00000000 --- a/sample_notebooks/vijayadurga/Chapter_5_Force_Torque_and_Shaft_power.ipynb +++ /dev/null @@ -1,265 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 5 Force Torque and Shaft power Measurement" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_1 pgno:204" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "x=(Sg*sig_f*(1+v))/(2*E)\n", - "('a voltmeter with a maximum range of mV is suitable for measurement', 94.9385766342288)\n", - "Round it off to get the suitable range voltmeter\n" - ] - } - ], - "source": [ - "#CHAPTER 5_ Force,Torque and Shaft Power Measurement\n", - "#Caption : Load cell\n", - "# Example 1# Page 294\n", - "from math import sqrt\n", - "\n", - "Sg=2.; # Strain gage factor\n", - "Rg=120.; # Gage resistance\n", - "v=0.3 # poissons ratio\n", - "E=210*10**9; # for steel\n", - "Pd=1. #('enter the power dissipation capacity=:')\n", - "# Looking for a suitable voltage measuring system\n", - "sig_f=700*10**6 #('enter the fatigue strength=:')\n", - "P_max=10000. #('enter the maximum load=:')\n", - "# For a load cell of square cross-section d,\n", - "d=sqrt(P_max/sig_f);\n", - "Ei=sqrt(4*Rg*Pd) #input excitation to the bridge circuit\n", - "x=(Sg*sig_f*(1+v))/(2*E);\n", - "dEo_max=x*Ei*10**3;\n", - "print (\"x=(Sg*sig_f*(1+v))/(2*E)\")\n", - "print ('a voltmeter with a maximum range of mV is suitable for measurement',dEo_max)\n", - "print (\"Round it off to get the suitable range voltmeter\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_2 pgno:295" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "('(dE/V)_max= d\\n ', 4285714.285714285)\n", - "Sensitivity of this load cell is nV/N/per unit excitation 42.8571428571\n" - ] - } - ], - "source": [ - "#CHAPTER 5_ Force,Torque and Shaft Power Measurement\n", - "#Caption : Load cell\n", - "# Example 2# Page 295\n", - "\n", - "b=.2 #('enter the width of load cell=:')\n", - "h=.05 #('enter the thickness of load cell=:')\n", - "Sg=2.;\n", - "Rg=120.;\n", - "sig_f=150*10**6 #('enter the fatigue strength=:')\n", - "E=70.; #(in GPa) for aluminium\n", - "v=0.33; #poissons ratio\n", - "# Let dE/V_max be represented by W\n", - "W=Sg*sig_f/E;\n", - "print('(dE/V)_max= d\\n ',W)\n", - "P_max=100000. #('enter the value of maximum load=:')\n", - "l=sig_f*b*h**2/(6*P_max);\n", - "\n", - "S=(6*Sg*l)/(E*b*h**2);\n", - "print'Sensitivity of this load cell is nV/N/per unit excitation',S\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_3 pgno:296" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Sensitivity of this load cell is micro V/N\n", - "0.13\n", - "The maximum density that can be achieved without endangering the strain gage sensors is micro V/N\n", - "0.284815729903\n", - "The voltage ratio is mV/V 3.9\n" - ] - } - ], - "source": [ - "#CHAPTER 5_ Force,Torque and Shaft Power Measurement\n", - "#Caption : Load cell\n", - "# Example 3# Page 296\n", - "from math import sqrt\n", - "Sg=2;\n", - "v=0.3; #poissons ratio\n", - "Ei=10. #('enter the excitation voltage=:')\n", - "A=5*10**-4 #('enter the area of load cell=:')\n", - "E=200.; #(in Gpa) Youngs modulus\n", - "# Let sensitivity Eo/P be represented by Se\n", - "Se=Sg*(1+v)*Ei/(2*A*E)*.001;\n", - "print'Sensitivity of this load cell is micro V/N\\n',Se\n", - "Rg=120. #given\n", - "Pd=1. #('enter the power dissipated in each gage=:')\n", - "Ei_max=sqrt(4*Rg*Pd)\n", - "Se_max=Sg*(1+v)*Ei_max/(2*A*E)*.001\n", - "print'The maximum density that can be achieved without endangering the strain gage sensors is micro V/N\\n',Se_max\n", - "# Let (Eo/Ei)_max be represented by Em\n", - "sig_f=600*10**6 #('enter the fatigue strength=:')\n", - "Em=Sg*sig_f*(1+v)/(2*E)*10**-6\n", - "print'The voltage ratio is mV/V',Em\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_4 pgno:302" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "('Relative displacement is d', 1.9999999999999997e-08)\n", - "wnc**2 is approx. 10**9. So,\n", - "Z is approx. 20nm(rms)\n", - "Actual force transmitted to the plate is d N 18.0260791198\n" - ] - } - ], - "source": [ - "#CHAPTER 5_ Force,Torque and Shaft Power Measurement\n", - "#Caption : Piezoelectric Transducers\n", - "# Example 4# Page 302\n", - "from math import sqrt,pi\n", - "mc=0.04 #('enter the connector mass=:')\n", - "m=0.01 #('enter the seismic mass=:')\n", - "k=10**9 #('enter the stiffness of the sensing element=:')\n", - "Sf=.005 #('enter the sensitivity of the transducer=:')\n", - "Xi=100*10**-6 # ('enter the displacement amplitude of the shaker vibration=:')\n", - "Eo=.1 #('enter the reading of voltage recorder connected to the transducer=:')\n", - "wnc=sqrt(k/(m+mc));\n", - "R=20; #20N (rms)\n", - "Z=(1/(m+mc))*(1/wnc**2)*R;\n", - "print('Relative displacement is d',Z)\n", - "print(\"wnc**2 is approx. 10**9. So,\")\n", - "print(\"Z is approx. 20nm(rms)\")\n", - "f=100.; # given\n", - "\n", - "F=R-((2*pi*f)**2*(m+mc)*Xi);\n", - "print'Actual force transmitted to the plate is d N',F\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 5_5 pgno:308" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The load torque is d N-m 1636.24617374\n" - ] - } - ], - "source": [ - "#CHAPTER 5_ Force,Torque and Shaft Power Measurement\n", - "#Caption : Torque measurement on rotating shaft\n", - "# Example 5# Page 308\n", - "Sg=2.;\n", - "Rg=120.;\n", - "G=80*10**9 #('enter the sheer modulus of elasticity=:')\n", - "D=0.05 #('enter the shaft diameter=:')\n", - "dR=0.1 # given\n", - "# we have to find the load torque\n", - "from math import pi\n", - "\n", - "y=2*dR/(Rg*Sg);\n", - "tou_xy=y*G;\n", - "j=pi*D**4;\n", - "T=tou_xy*2*j/(D*32);\n", - "print'The load torque is d N-m',T" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/sample_notebooks/vijayadurga/sample.ipynb b/sample_notebooks/vijayadurga/sample.ipynb new file mode 100755 index 00000000..f655751e --- /dev/null +++ b/sample_notebooks/vijayadurga/sample.ipynb @@ -0,0 +1,410 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 3 Fundamentals of Fault Clearing and Switching Phenomena" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_1 pgno:24" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the transient current =A 1.56\n" + ] + } + ], + "source": [ + "from math import pi,exp\n", + "from math import atan,sin\n", + "from math import sqrt\n", + "R=10; \n", + "L=0.1; \n", + "f=50; \n", + "w=2*pi*f; \n", + "k=sqrt((R**2)+((w*L)**2));\n", + "angle=atan(w*L/R);\n", + "E=400 \n", + "A=E*sin(angle)/k;\n", + "i=A*exp((-R)*.02/L);\n", + "i=round(i*100)/100;\n", + "print\"the transient current =A\",i\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_2 pgno:26" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "current in amperes for part1=A\n", + "4.1\n", + "current in part 2& part 3= 0\n", + "\n", + "the DC component vanishes if e=V 141.4\n", + "\n", + "current at .5 cycles for t1=sec \n", + "current in the problem = A 0.01 1.50368424845\n", + "\n", + "current at 1.5 cycles for t2=sec \n", + "current in the problem = A 0.03 0.203501533662\n", + "\n", + "current at 5.5 cycles for t3=sec \n", + "current in the problem = A 0.11 6.82671592646e-05\n", + "the difference in result is due to erroneous value in textbook.\n" + ] + } + ], + "source": [ + "from math import sqrt,sin,atan,pi,exp\n", + "R=10; \n", + "L=0.1; \n", + "f=50; \n", + "w=2*pi*f; \n", + "k=sqrt((R**2)+((w*L)**2));\n", + "angle=atan(w*L/R); \n", + "E=100; \n", + "Em=sqrt(2)*E; \n", + "A=Em*sin(angle)/k;\n", + "i1=A; \n", + "Em=round(Em*10)/10;\n", + "i1=round(i1*10)/10;\n", + "print\"current in amperes for part1=A\\n\",i1\n", + "print\"current in part 2& part 3= 0\\n\"\n", + "print\"the DC component vanishes if e=V\",Em#the error is due to the erroneous values in the textbook\n", + "\n", + "t1=0.5*.02; \n", + "i2=A*exp((-R)*t1/L);\n", + "print\"\\ncurrent at .5 cycles for t1=sec \\ncurrent in the problem = A\",t1,i2\n", + "t2=1.5*.02;\n", + "i3=A*exp((-R)*t2/L);\n", + "print\"\\ncurrent at 1.5 cycles for t2=sec \\ncurrent in the problem = A\",t2,i3\n", + "t3=5.5*.02;\n", + "i4=A*exp((-R)*t3/L);\n", + "print\"\\ncurrent at 5.5 cycles for t3=sec \\ncurrent in the problem = A\",t3,i4\n", + "\n", + "\n", + "print\"the difference in result is due to erroneous value in textbook.\"\n", + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_3 pgno:28" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "frequency of oscillations=c/s 72400.0\n", + "\n", + "time of maximum restriking voltage=microsec 3.46\n", + "\n", + "maximum restriking voltage=V/microsecs 2430.0\n" + ] + } + ], + "source": [ + "from math import sqrt,e,pi\n", + "C=.003e-6 \n", + "L=1.6e-3 \n", + "y=sqrt(L*C);\n", + "y=round(y*1e7)/1e7;\n", + "f=(2*3.14*y)**-1; \n", + "f=round(f/100)*100;\n", + "i=7500;\n", + "E=i*2*3.15*L*50;\n", + "Em=1.414*E;\n", + "Em=round(Em/10)*10\n", + "t=y*pi/2;\n", + "t=t*1e6;\n", + "t=round(t*100)/100;\n", + "e=Em/y;\n", + "e=round((e)/1e6)*1e6;\n", + "e=round(e/1e7)*1e7\n", + "print\"frequency of oscillations=c/s\",f\n", + "print\"\\ntime of maximum restriking voltage=microsec\",t\n", + "print\"\\nmaximum restriking voltage=V/microsecs\",e/1e6\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_4 pgno:30" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "peak restriking voltage=kV 18.0\n", + "\n", + "frequency of oscillations=c/s 12637.7514913\n", + "\n", + "average rate of restriking voltage=kV/microsecs 0.455\n", + "\n", + "max restriking voltage=V/microsecs 714.0\n" + ] + } + ], + "source": [ + "from math import pi,sqrt\n", + "R=5 \n", + "f=50\n", + "L=R/(2*pi*f);\n", + "V=11e3;\n", + "Vph=11/sqrt(3);\n", + "C=0.01e-6;\n", + "y=sqrt(L*C);\n", + "Em=sqrt(2)*Vph;\n", + "ep=2*Em;\n", + "ep=round(ep*10)/10;\n", + "y=round(y*1e7)/1e7;\n", + "t=y*pi;\n", + "t=round(t*1e7)/1e7\n", + "ea=ep/t;\n", + "ea=round(ea/1e3)*1e3\n", + "fn=(2*3.14*y)**-1;\n", + "Em=round(Em)\n", + "Emax=Em/y;\n", + "Emax=round(Emax/1000)*1e3;\n", + "print\"peak restriking voltage=kV\",ep\n", + "print\"\\nfrequency of oscillations=c/s\",fn\n", + "print\"\\naverage rate of restriking voltage=kV/microsecs\",ea/1e6\n", + "print\"\\nmax restriking voltage=V/microsecs\",Emax/1e3\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_5 pgno:31" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "average restriking voltage=V/microsecs 1220.0\n" + ] + } + ], + "source": [ + "from math import pi,sqrt\n", + "E=19.1*1e3;\n", + "L=10*1e-3;\n", + "C=.02*1e-6;\n", + "Em=sqrt(2)*E;\n", + "y=sqrt(L*C);\n", + "t=pi*y*1e6;\n", + "emax=2*Em;\n", + "eavg=emax/t;\n", + "eavg=round(eavg/10)*10\n", + "print\"average restriking voltage=V/microsecs\",eavg\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_6 pgno:33" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "average restriking voltage=kV/microsecs 4.8\n" + ] + } + ], + "source": [ + "from math import e,sqrt,acos,sin\n", + "V=78e3;\n", + "Vph=V/sqrt(3);\n", + "Em=2*Vph;\n", + "pf=0.4;\n", + "angle=acos(pf);\n", + "k1=sin(angle); \n", + "k1=round(k1*100)/100;\n", + "k2=.951;\n", + "k3=1;\n", + "k=k1*k2*k3;\n", + "k=round(k*1000)/1e3;\n", + "E=k*Em;\n", + "f=15000.; \n", + "t=1/(2*f);\n", + "t=round(t*1e6);\n", + "eavg=2*E/t;\n", + "eavg=round(eavg/100)*100;\n", + "print\"average restriking voltage=kV/microsecs\",eavg/1e3\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_7 pgno:35" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "average voltage in volts=V/microsecs 1430.0\n", + "frequency of oscillation =c/s 7143.0\n" + ] + } + ], + "source": [ + "Em=100e3\n", + "t=70e-6\n", + "Ea=Em/t/1e6\n", + "f=1/(2*t);\n", + "Ea=round(Ea/10)*10;\n", + "f=round(f);\n", + "print\"average voltage in volts=V/microsecs\",Ea\n", + "print\"frequency of oscillation =c/s\",f\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3_8 pgno:37" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "damping resistance in ohms=kohms 12.25\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "L=6; \n", + "C=0.01e-6;\n", + "i=10;\n", + "v=i*sqrt(L/C);\n", + "R=.5*v/i;\n", + "R=round(R/10)*10;\n", + "print\"damping resistance in ohms=kohms\",R/1e3\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/vijayadurga/sample_(chapter.ipynb b/sample_notebooks/vijayadurga/sample_(chapter.ipynb deleted file mode 100755 index f655751e..00000000 --- a/sample_notebooks/vijayadurga/sample_(chapter.ipynb +++ /dev/null @@ -1,410 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 3 Fundamentals of Fault Clearing and Switching Phenomena" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_1 pgno:24" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "the transient current =A 1.56\n" - ] - } - ], - "source": [ - "from math import pi,exp\n", - "from math import atan,sin\n", - "from math import sqrt\n", - "R=10; \n", - "L=0.1; \n", - "f=50; \n", - "w=2*pi*f; \n", - "k=sqrt((R**2)+((w*L)**2));\n", - "angle=atan(w*L/R);\n", - "E=400 \n", - "A=E*sin(angle)/k;\n", - "i=A*exp((-R)*.02/L);\n", - "i=round(i*100)/100;\n", - "print\"the transient current =A\",i\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_2 pgno:26" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "current in amperes for part1=A\n", - "4.1\n", - "current in part 2& part 3= 0\n", - "\n", - "the DC component vanishes if e=V 141.4\n", - "\n", - "current at .5 cycles for t1=sec \n", - "current in the problem = A 0.01 1.50368424845\n", - "\n", - "current at 1.5 cycles for t2=sec \n", - "current in the problem = A 0.03 0.203501533662\n", - "\n", - "current at 5.5 cycles for t3=sec \n", - "current in the problem = A 0.11 6.82671592646e-05\n", - "the difference in result is due to erroneous value in textbook.\n" - ] - } - ], - "source": [ - "from math import sqrt,sin,atan,pi,exp\n", - "R=10; \n", - "L=0.1; \n", - "f=50; \n", - "w=2*pi*f; \n", - "k=sqrt((R**2)+((w*L)**2));\n", - "angle=atan(w*L/R); \n", - "E=100; \n", - "Em=sqrt(2)*E; \n", - "A=Em*sin(angle)/k;\n", - "i1=A; \n", - "Em=round(Em*10)/10;\n", - "i1=round(i1*10)/10;\n", - "print\"current in amperes for part1=A\\n\",i1\n", - "print\"current in part 2& part 3= 0\\n\"\n", - "print\"the DC component vanishes if e=V\",Em#the error is due to the erroneous values in the textbook\n", - "\n", - "t1=0.5*.02; \n", - "i2=A*exp((-R)*t1/L);\n", - "print\"\\ncurrent at .5 cycles for t1=sec \\ncurrent in the problem = A\",t1,i2\n", - "t2=1.5*.02;\n", - "i3=A*exp((-R)*t2/L);\n", - "print\"\\ncurrent at 1.5 cycles for t2=sec \\ncurrent in the problem = A\",t2,i3\n", - "t3=5.5*.02;\n", - "i4=A*exp((-R)*t3/L);\n", - "print\"\\ncurrent at 5.5 cycles for t3=sec \\ncurrent in the problem = A\",t3,i4\n", - "\n", - "\n", - "print\"the difference in result is due to erroneous value in textbook.\"\n", - " " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_3 pgno:28" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "frequency of oscillations=c/s 72400.0\n", - "\n", - "time of maximum restriking voltage=microsec 3.46\n", - "\n", - "maximum restriking voltage=V/microsecs 2430.0\n" - ] - } - ], - "source": [ - "from math import sqrt,e,pi\n", - "C=.003e-6 \n", - "L=1.6e-3 \n", - "y=sqrt(L*C);\n", - "y=round(y*1e7)/1e7;\n", - "f=(2*3.14*y)**-1; \n", - "f=round(f/100)*100;\n", - "i=7500;\n", - "E=i*2*3.15*L*50;\n", - "Em=1.414*E;\n", - "Em=round(Em/10)*10\n", - "t=y*pi/2;\n", - "t=t*1e6;\n", - "t=round(t*100)/100;\n", - "e=Em/y;\n", - "e=round((e)/1e6)*1e6;\n", - "e=round(e/1e7)*1e7\n", - "print\"frequency of oscillations=c/s\",f\n", - "print\"\\ntime of maximum restriking voltage=microsec\",t\n", - "print\"\\nmaximum restriking voltage=V/microsecs\",e/1e6\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_4 pgno:30" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "peak restriking voltage=kV 18.0\n", - "\n", - "frequency of oscillations=c/s 12637.7514913\n", - "\n", - "average rate of restriking voltage=kV/microsecs 0.455\n", - "\n", - "max restriking voltage=V/microsecs 714.0\n" - ] - } - ], - "source": [ - "from math import pi,sqrt\n", - "R=5 \n", - "f=50\n", - "L=R/(2*pi*f);\n", - "V=11e3;\n", - "Vph=11/sqrt(3);\n", - "C=0.01e-6;\n", - "y=sqrt(L*C);\n", - "Em=sqrt(2)*Vph;\n", - "ep=2*Em;\n", - "ep=round(ep*10)/10;\n", - "y=round(y*1e7)/1e7;\n", - "t=y*pi;\n", - "t=round(t*1e7)/1e7\n", - "ea=ep/t;\n", - "ea=round(ea/1e3)*1e3\n", - "fn=(2*3.14*y)**-1;\n", - "Em=round(Em)\n", - "Emax=Em/y;\n", - "Emax=round(Emax/1000)*1e3;\n", - "print\"peak restriking voltage=kV\",ep\n", - "print\"\\nfrequency of oscillations=c/s\",fn\n", - "print\"\\naverage rate of restriking voltage=kV/microsecs\",ea/1e6\n", - "print\"\\nmax restriking voltage=V/microsecs\",Emax/1e3\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_5 pgno:31" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "average restriking voltage=V/microsecs 1220.0\n" - ] - } - ], - "source": [ - "from math import pi,sqrt\n", - "E=19.1*1e3;\n", - "L=10*1e-3;\n", - "C=.02*1e-6;\n", - "Em=sqrt(2)*E;\n", - "y=sqrt(L*C);\n", - "t=pi*y*1e6;\n", - "emax=2*Em;\n", - "eavg=emax/t;\n", - "eavg=round(eavg/10)*10\n", - "print\"average restriking voltage=V/microsecs\",eavg\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_6 pgno:33" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "average restriking voltage=kV/microsecs 4.8\n" - ] - } - ], - "source": [ - "from math import e,sqrt,acos,sin\n", - "V=78e3;\n", - "Vph=V/sqrt(3);\n", - "Em=2*Vph;\n", - "pf=0.4;\n", - "angle=acos(pf);\n", - "k1=sin(angle); \n", - "k1=round(k1*100)/100;\n", - "k2=.951;\n", - "k3=1;\n", - "k=k1*k2*k3;\n", - "k=round(k*1000)/1e3;\n", - "E=k*Em;\n", - "f=15000.; \n", - "t=1/(2*f);\n", - "t=round(t*1e6);\n", - "eavg=2*E/t;\n", - "eavg=round(eavg/100)*100;\n", - "print\"average restriking voltage=kV/microsecs\",eavg/1e3\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_7 pgno:35" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "average voltage in volts=V/microsecs 1430.0\n", - "frequency of oscillation =c/s 7143.0\n" - ] - } - ], - "source": [ - "Em=100e3\n", - "t=70e-6\n", - "Ea=Em/t/1e6\n", - "f=1/(2*t);\n", - "Ea=round(Ea/10)*10;\n", - "f=round(f);\n", - "print\"average voltage in volts=V/microsecs\",Ea\n", - "print\"frequency of oscillation =c/s\",f\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example 3_8 pgno:37" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "damping resistance in ohms=kohms 12.25\n" - ] - } - ], - "source": [ - "from math import sqrt\n", - "L=6; \n", - "C=0.01e-6;\n", - "i=10;\n", - "v=i*sqrt(L/C);\n", - "R=.5*v/i;\n", - "R=round(R/10)*10;\n", - "print\"damping resistance in ohms=kohms\",R/1e3\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} -- cgit