text stringlengths 1 7.76k | source stringlengths 17 81 |
|---|---|
182 CHAPTER 8. TIME-VARYING FIELDS • The induced potential is proportional to the rate of change of B. If B is constant in time, then there is no induction. Finally, the current in the loop is simply I = VT R (8.9) Again, electromagnetic induction induces potential, and the current flows only in response to the induced ... | Electromagnetics_Vol1_Page_197_Chunk1501 |
8.5. TRANSFORMERS: PRINCIPLE OF OPERATION 183 So VT = −2π2f0a2B0 cos 2πf0t Subsequently I = VT R = −2π2f0a2B0 R cos 2πf0t Substituting values, we have: I = −(39.5 mA) cos [(6.28 krad/s)t] It should be no surprise that VT and I vary sinusoidally, since the source (B) varies sinusoidally. A bit of useful trivia here is t... | Electromagnetics_Vol1_Page_198_Chunk1502 |
184 CHAPTER 8. TIME-VARYING FIELDS turns V 1 (1) + − V 2 (1) + − N1 turns N2 Figure 8.6: Part I of an experiment demonstrating the linking of electric circuits using a transformer. turns V (2) + − V 2 (2) + − N1 turns N2 Figure 8.7: Part II of an experiment demonstrating the linking of electric circuits using a trans... | Electromagnetics_Vol1_Page_199_Chunk1503 |
8.6. TRANSFORMERS AS TWO-PORT DEVICES 185 This expression should be familiar from elementary circuit theory – except possibly for the minus sign. The minus sign is a consequence of the fact that the coils are wound in opposite directions. We can make the above expression a little more general as follows: V1 V2 = pN1 N2... | Electromagnetics_Vol1_Page_200_Chunk1504 |
186 CHAPTER 8. TIME-VARYING FIELDS V1I1 = −V2I2. Thus, we have3 I1 I2 = −V2 V1 = −pN2 N1 (8.21) We can develop an impedance relationship for ideal transformers as follows. Let Z1 be the input impedance of the transformer; that is, the impedance looking into port 1 from the source. Thus, we have Z1 ≜V1 I1 = +p (N1/N2) V... | Electromagnetics_Vol1_Page_201_Chunk1505 |
8.7. THE ELECTRIC GENERATOR 187 Differential Single- Ended Single- Ended c⃝SpinningSpark CC BY SA 3.0 (modified) Figure 8.10: Transformers used to convert a single- ended (“unbalanced”) signal to a differential (bal- anced) signal, and back. attached to one coil from the circuit attached to the other coil. The DC-isolat... | Electromagnetics_Vol1_Page_202_Chunk1506 |
188 CHAPTER 8. TIME-VARYING FIELDS z y x V +- direction of rotation Figure 8.11: A rudimentary single-loop generator, shown at time t = 0. magnetic field lines passing through the loop, and also as usual, the simplest choice is simply the planar area bounded by the loop. The differential surface element ds is ˆnds, wh... | Electromagnetics_Vol1_Page_203_Chunk1507 |
8.8. THE MAXWELL-FARADAY EQUATION 189 It’s worth noting that the maximum voltage magnitude is achieved when the plane of the loop is parallel to B; i.e., when ˆb · ˆn(t) = 0 so that Φ(t) = 0. Why is that? Because this is when Φ(t) is most rapidly increasing or decreasing. Conversely, when the plane of the loop is perpe... | Electromagnetics_Vol1_Page_204_Chunk1508 |
190 CHAPTER 8. TIME-VARYING FIELDS in differential, as opposed to integral form. Let us now do this. We can transform the left-hand side of Equation 8.39 into a integral over S using Stokes’ Theorem. Applying Stokes’ theorem on the left, we obtain Z S (∇× E) · ds = −∂ ∂t Z S B · ds (8.40) Now exchanging the order of in... | Electromagnetics_Vol1_Page_205_Chunk1509 |
8.9. DISPLACEMENT CURRENT AND AMPERE’S LAW 191 I I S1 H C C. Burks (modified) Figure 8.12: Ampere’s Law applied to a continuous line of current. E I I S1 H C C. Burks (modified) Figure 8.13: Ampere’s Law applied to a parallel plate capacitor. integral over any open surface S that is bounded by C. Two such surfaces are sh... | Electromagnetics_Vol1_Page_206_Chunk1510 |
192 CHAPTER 8. TIME-VARYING FIELDS this expression meets our expectations: It is determined by the electric field, it is zero when the electric field is constant (i.e., not time varying), and has units of current. The quantity Id is commonly known as displacement current. It should be noted that this name is a bit mislea... | Electromagnetics_Vol1_Page_207_Chunk1511 |
8.9. DISPLACEMENT CURRENT AND AMPERE’S LAW 193 Image Credits Fig. 8.1: c⃝Y. Qin, https://commons.wikimedia.org/wiki/File:M0003 fCoilBarMagnet.svg, CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/), modified from the original. Fig. 8.2: E. Bach, https://commons.wikimedia.org/wiki/File:Faraday emf experiment.svg, p... | Electromagnetics_Vol1_Page_208_Chunk1512 |
Chapter 9 Plane Waves in Lossless Media 9.1 Maxwell’s Equations in Differential Phasor Form [m0042] In this section, we derive the phasor form of Maxwell’s Equations from the general time-varying form of these equations. Here we are interested exclusively in the differential (“point”) form of these equations. It is ass... | Electromagnetics_Vol1_Page_209_Chunk1513 |
9.1. MAXWELL’S EQUATIONS IN DIFFERENTIAL PHASOR FORM 195 After substitution into Equation 9.2: ∇× h Re n eEejωtoi = −∂ ∂t h Re n eBejωtoi (9.13) Both curl and time-differentiation are real-valued linear operations, so we are entitled to change the order of operations as follows: Re n ∇× h eEejωtio = −Re ∂ ∂t h eBejωt... | Electromagnetics_Vol1_Page_210_Chunk1514 |
196 CHAPTER 9. PLANE WAVES IN LOSSLESS MEDIA 9.2 Wave Equations for Source-Free and Lossless Regions [m0036] Electromagnetic waves are solutions to a set of coupled differential simultaneous equations – namely, Maxwell’s Equations. The general solution to these equations includes constants whose values are determined b... | Electromagnetics_Vol1_Page_211_Chunk1515 |
9.2. WAVE EQUATIONS FOR SOURCE-FREE AND LOSSLESS REGIONS 197 appears as a complex-valued quantity, then the imaginary part represents loss. To derive the wave equations we begin with the MFE, Equation 9.29. Taking the curl of both sides of the equation we obtain ∇× ∇× eE = ∇× −jωµ eH = −jωµ ∇× eH (9.32) On ... | Electromagnetics_Vol1_Page_212_Chunk1516 |
198 CHAPTER 9. PLANE WAVES IN LOSSLESS MEDIA 9.3 Types of Waves [m0142] Solutions to the electromagnetic wave equations (Section 9.2) exist in a variety of forms, representing different types of waves. It is useful to identify three particular geometries for unguided waves. Each of these geometries is defined by the sha... | Electromagnetics_Vol1_Page_213_Chunk1517 |
9.4. UNIFORM PLANE WAVES: DERIVATION 199 c⃝Y. Qin CC BY 4.0 Figure 9.3: The phasefronts of a plane wave form parallel planes. feed reflector planar p onts c⃝Y. Qin CC BY 4.0 Figure 9.4: Plane waves formed in the region in front of a parabolic reflector antenna. phasefront, as shown in Figure 9.5. An analogy is th... | Electromagnetics_Vol1_Page_214_Chunk1518 |
200 CHAPTER 9. PLANE WAVES IN LOSSLESS MEDIA assumption with no loss of generality. For example, we could alternatively select a plane of constant y, solve the problem, and then simply exchange variables to get a solution for planes of constant z (or x).1 Furthermore, the solution for any planar orientation not corresp... | Electromagnetics_Vol1_Page_215_Chunk1519 |
9.4. UNIFORM PLANE WAVES: DERIVATION 201 be proportional to the curl of the magnetic field and vice-versa. The general solution to Equation 9.54 is: eEx = E+ x0e−jβz + E− x0e+jβz (9.59) where E+ x0 and E− x0 are complex-valued constants. The values of these constants are determined by boundary conditions – possibly sour... | Electromagnetics_Vol1_Page_216_Chunk1520 |
202 CHAPTER 9. PLANE WAVES IN LOSSLESS MEDIA Again, there is no loss of generality here since the coordinate system could be rotated in such a way that any uniform plane could be described in this way. We may now determine eH from eE using the Maxwell-Faraday Equation (Section 9.2): ∇× eE = −jωµ eH (9.66) Solving this ... | Electromagnetics_Vol1_Page_217_Chunk1521 |
9.5. UNIFORM PLANE WAVES: CHARACTERISTICS 203 The wave impedance in free space, assigned the symbol η0, is η0 ≜ rµ0 ǫ0 ∼= 377 Ω. (9.74) Wrapping up our solution, we find that if eE is as given by Equation 9.65, then eH = ˆyE0 η e−jβz (9.75) 9.5 Uniform Plane Waves: Characteristics [m0039] In Section 9.4, expressions for... | Electromagnetics_Vol1_Page_218_Chunk1522 |
204 CHAPTER 9. PLANE WAVES IN LOSSLESS MEDIA x z y E H c⃝E. Boutet (Modified) CC BY SA 3.0 Figure 9.7: Relationship between the electric field di- rection, magnetic field direction, and direction of prop- agation (here, +ˆz). This result is illustrated in Figure 9.7. Note that both E and H (as well as their phasor represe... | Electromagnetics_Vol1_Page_219_Chunk1523 |
9.5. UNIFORM PLANE WAVES: CHARACTERISTICS 205 polyethylene? The frequency of interest is 1 GHz. Solution. Low-loss dielectrics exhibit µr ∼= 1 and σ ≈0. Therefore the phase velocity is vp = 1 √µ0ǫrǫ0 = c √ǫr ∼= 1.98 × 108 m/s (9.85) i.e., very nearly two-thirds of the speed of light in free space. The wavelength at 1 G... | Electromagnetics_Vol1_Page_220_Chunk1524 |
206 CHAPTER 9. PLANE WAVES IN LOSSLESS MEDIA where the propagation constant β = ω√µǫ = 2πf√µ0ǫ0 ∼= 62.9 rad/m. The answer to (b) is easiest to obtain from the plane wave relationship: eH = 1 η ˆk × E = 1 η ˆρ × | Electromagnetics_Vol1_Page_221_Chunk1525 |
9.6. WAVE POLARIZATION 207 x z by RJB1 (Modified) Figure 9.9: Linear polarization. Here Ex is shown in blue, Ey is shown in green, and E is shown in red with black vector symbols. In this example the phases of Ex and Ey are zero and φ = −π/4. Ey/Ex. This wave too is said to exhibit linear polarization, because, again, t... | Electromagnetics_Vol1_Page_222_Chunk1526 |
208 CHAPTER 9. PLANE WAVES IN LOSSLESS MEDIA by Dave3457 Figure 9.10: A circularly-polarized wave (in red, with black vector symbols) resulting from the addition of orthogonal linearly-polarized waves (shown in green and blue) that are phase-shifted by π/2 radians. resulting in rotation in the plane perpendicular to th... | Electromagnetics_Vol1_Page_223_Chunk1527 |
9.7. WAVE POWER IN A LOSSLESS MEDIUM 209 non-geosynchronous orbits typically employ circular polarization. In particular, satellites of the U.S. Global Positioning System (GPS) transmit circular polarization because of the variable geometry of the space-to-earth radio link and the tendency of the Earth’s ionosphere to ... | Electromagnetics_Vol1_Page_224_Chunk1528 |
210 CHAPTER 9. PLANE WAVES IN LOSSLESS MEDIA simply integrate the power density over this area. Let’s skip to the answer, and then consider where this answer comes from. It turns out that the instantaneous power density of a uniform plane wave is the magnitude of the Poynting vector S ≜E × H (9.106) Note that this equa... | Electromagnetics_Vol1_Page_225_Chunk1529 |
9.7. WAVE POWER IN A LOSSLESS MEDIUM 211 expressed in terms of the rms quantity lacks the factor of 1/2. Example 9.3. Power density of a typical radio wave. A radio wave transmitted from a distant location may be perceived locally as a uniform plane wave if there is no nearby structure to scatter the wave; a good examp... | Electromagnetics_Vol1_Page_226_Chunk1530 |
212 CHAPTER 9. PLANE WAVES IN LOSSLESS MEDIA Image Credits Fig. 9.1: c⃝Y. Qin, https://commons.wikimedia.org/wiki/File:M0142 fSphericalPhasefront.svg, CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Fig. 9.2 c⃝Y. Qin, https://commons.wikimedia.org/wiki/File:M0142 fCylindricalPhasefront.svg, CC BY 4.0 (https:/... | Electromagnetics_Vol1_Page_227_Chunk1531 |
Appendix A Constitutive Parameters of Some Common Materials A.1 Permittivity of Some Common Materials [m0135] The values below are relative permittivity ǫr ≜ǫ/ǫ0 for a few materials that are commonly encountered in electrical engineering applications, and for which permittivity emerges as a consideration. Note that “re... | Electromagnetics_Vol1_Page_228_Chunk1532 |
214 APPENDIX A. CONSTITUTIVE PARAMETERS OF SOME COMMON MATERIALS lower end of the range. Other liquids typically exhibit ǫr in the range 10–90, with considerable variation as a function of temperature and frequency. Animal flesh and blood consists primarily of liquid matter and so also exhibits permittivity in this rang... | Electromagnetics_Vol1_Page_229_Chunk1533 |
A.3. CONDUCTIVITY OF SOME COMMON MATERIALS 215 Ferrites include a broad range of ceramic materials that are combined with iron and various combinations of other metals and are used as magnets and magnetic devices in various electrical systems. Common ferrites exhibit µr in the range 16–640. Additional Reading: • Sectio... | Electromagnetics_Vol1_Page_230_Chunk1534 |
216 APPENDIX A. CONSTITUTIVE PARAMETERS OF SOME COMMON MATERIALS Non-conductors. Most other materials that are not well-described as conductors or semiconductors and are dry exhibit σ < 10−12 S/m. Most materials that are considered to be insulators, including air and common dielectrics, exhibit σ < 10−15 S/m, often by ... | Electromagnetics_Vol1_Page_231_Chunk1535 |
Appendix B Mathematical Formulas B.1 Trigonometry [m0138] ejθ = cos θ + j sin θ (B.1) cos θ = 1 2 | Electromagnetics_Vol1_Page_232_Chunk1536 |
218 APPENDIX B. MATHEMATICAL FORMULAS Gradient in spherical coordinates: ∇f = ˆr∂f ∂r + ˆθ1 r ∂f ∂θ + ˆφ 1 r sin θ ∂f ∂φ (B.8) Divergence Divergence in Cartesian coordinates: ∇· A = ∂Ax ∂x + ∂Ay ∂y + ∂Az ∂z (B.9) Divergence in cylindrical coordinates: ∇· A = 1 ρ ∂ ∂ρ (ρAρ) + 1 ρ ∂Aφ ∂φ + ∂Az ∂z (B.10) Divergence in sph... | Electromagnetics_Vol1_Page_233_Chunk1537 |
B.3. VECTOR IDENTITIES 219 B.3 Vector Identities [m0140] Algebraic Identities A · (B × C) = B · (C × A) = C · (A × B) (B.18) A × (B × C) = B (A · C) −C (A · B) (B.19) Identities Involving Differential Operators ∇· (∇× A) = 0 (B.20) ∇× (∇f) = 0 (B.21) ∇× (fA) = f (∇× A) + (∇f) × A (B.22) ∇· (A × B) = B · (∇× A) −A · (∇×... | Electromagnetics_Vol1_Page_234_Chunk1538 |
Appendix C Physical Constants [m0141] The speed of light in free space (c), which is the phase velocity of any electromagnetic radiation in free space, is ∼= 2.9979 × 108 m/s. This is commonly rounded up to 3 × 108 m/s. This rounding incurs error of ∼= 0.07%, which is usually much less than other errors present in elec... | Electromagnetics_Vol1_Page_235_Chunk1539 |
Index acoustic wave equation, see wave equation, acoustic admittance, 64–66 characteristic, see characteristic admittance air, 123, 124 aluminum, 170, 215 Ampere’s law general form, 190–192 magnetostatics, 88, 149–150, 152, 155, 158, 159, 167 amplifier, 59, 62 antenna, 207 dipole, 207 helical, 209 impedance matching, 58... | Electromagnetics_Vol1_Page_236_Chunk1540 |
222 INDEX dipole, see antenna displacement current, 150, 192 divergence, 85–86, 218 definition, 85 divergence theorem, 87, 104, 148, 219 dot product, 73–74 duality, 146, 197 electric field, see field, electric electric field intensity, 17–19, 94, 124 boundary conditions, 118 definition, 18 related to current, 136 electric fl... | Electromagnetics_Vol1_Page_237_Chunk1541 |
INDEX 223 perfect, 137 poor, 137 inverse square law, 20, 25 iron, 171, 214, 215 isotropic (media), 28, 196 isotropy, 28 joule heating, 144 Joule’s law, 143 kinetic energy, see energy, kinetic Kirchoff’s voltage law electrostatics, 88, 105, 108–110, 118, 180, 189 Laplace’s equation, 115, 116 Laplacian (operator), 91, 21... | Electromagnetics_Vol1_Page_238_Chunk1542 |
224 INDEX power dissipation, 143–144 Poynting theorem, 210 Poynting vector, 210 printed circuit board (PCB), 44, 46, 123 capacitance, 127–128 material, 213 propagation constant, 37 attenuation, 33, 40 phase, 6, 33, 40, 197 quantum mechanics, 19, 23 quarter-wave inverter, 58 radio (frequency), 3 reactance, 165 reflection... | Electromagnetics_Vol1_Page_239_Chunk1543 |
INDEX 225 vector arithmetic, 70–75, 219 definition, 70 identity, 219 position-fixed, 70 position-free, 70 unit, 70 velocity, 70 voltage reflection coefficient, see reflection coefficient voltage standing wave ratio (VSWR), 51 water, 213, 215 wave equation acoustic, 6 electromagnetic, 91 source-free lossless region, 196–197 T... | Electromagnetics_Vol1_Page_240_Chunk1544 |
Computer Science I Dr. Chris Bourke cbourke@cse.unl.edu Department of Computer Science & Engineering University of Nebraska–Lincoln Lincoln, NE 68588, USA 2018/10/12 08:09:12 Version 1.3.7 | ComputerScienceOne_Page_1_Chunk1545 |
Copyleft (Copyright) The entirety of this book is free and is released under a Creative Commons Attribution- ShareAlike 4.0 International License (see http://creativecommons.org/licenses/ by-sa/4.0/ for details). i | ComputerScienceOne_Page_3_Chunk1546 |
Draft Notice This book is a draft that has been released for evaluation and comment. Some of the later chapters are included as placeholders and indicators for the intended scope of the final draft, but are intentionally left blank. The author encourages people to send feedback including suggestions, corrections, and re... | ComputerScienceOne_Page_5_Chunk1547 |
Preface “If you really want to understand something, the best way is to try and explain it to someone else. That forces you to sort it out in your own mind... that’s really the essence of programming. By the time you’ve sorted out a complicated idea into little steps that even a stupid machine can deal with, you’ve cer... | ComputerScienceOne_Page_7_Chunk1548 |
Preface That’s why I like organizations like OpenStax (http://openstaxcollege.org/) that attempt to provide free and “open” learning materials. Though they have textbooks for a variety of disciplines, Computer Science is not one of them (currently, that is). This might be due to the fact that there are already a huge a... | ComputerScienceOne_Page_8_Chunk1549 |
nature (most of my students have been Engineering students). Some of them are more easily understood if students have had Calculus but it is not absolutely necessary. It may be clich´e, but the two quotes above exemplify what I believe a Computer Science I course is about. The second is from Isaac Asimov who was asked ... | ComputerScienceOne_Page_9_Chunk1550 |
Acknowledgements I’d like to thank the Department of Computer Science & Engineering at the University of Nebraska–Lincoln for their support during my writing and maintaining this book. This book is dedicated to my family. ix | ComputerScienceOne_Page_11_Chunk1551 |
Contents Copyleft (Copyright) i Draft Notice iii Preface v Acknowledgements ix 1. Introduction 1 1.1. Problem Solving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2. Computing Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.3. Basic Program Structure . . . . . . . . . . .... | ComputerScienceOne_Page_13_Chunk1552 |
. . . . . . . . . . . . . . . . 42 2.4.3. Output Using printf() -style Formatting . . . . . . . . . . . . . 43 2.4.4. Command Line Input . . . . . . . . . . . . . . . . . . . . . . . . . 44 xi | ComputerScienceOne_Page_13_Chunk1553 |
Contents 2.5. Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 2.5.1. Types of Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 2.5.2. Strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 2.6. Examples . . . . . . . . . . . . . . . . . . . . . . ... | ComputerScienceOne_Page_14_Chunk1554 |
. . . . . . . . . . . . . . . . . . . . . 83 3.6.3. Comparing Elements . . . . . . . . . . . . . . . . . . . . . . . . . 84 3.6.4. Life & Taxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 3.7. Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 4. Loops 95 4.1. While ... | ComputerScienceOne_Page_14_Chunk1555 |
Contents 4.8. Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 5. Functions 133 5.1. Defining & Using Functions . . . . . . . . . . . . . . . . . . . . . . . . . 134 5.1.1. Function Signatures . . . . . . . . . . . . . . . . . . . . . . . . . . 134 5.1.2. Calling Functions . . . . . ... | ComputerScienceOne_Page_15_Chunk1556 |
. . . . . . . . . . . . . . . . 162 7.2.1. Dynamic Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 7.2.2. Shallow vs. Deep Copies . . . . . . . . . . . . . . . . . . . . . . . 166 7.3. Multidimensional Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 7.4. Other Collections . . . . . . .... | ComputerScienceOne_Page_15_Chunk1557 |
Contents 9.1.4. Binary vs Text Files . . . . . . . . . . . . . . . . . . . . . . . . . 187 9.2. Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 10.Encapsulation & Objects 197 10.1. Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 10.1.1. Defining .... | ComputerScienceOne_Page_16_Chunk1558 |
. . . . . . . . . . . . . . . . . . . 224 12.2.3. Quick Sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 12.2.4. Merge Sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 12.2.5. Other Sorts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 12.2.6. Comparison & Summa... | ComputerScienceOne_Page_16_Chunk1559 |
Contents I. The C Programming Language 251 15.Basics 253 15.1. Getting Started: Hello World . . . . . . . . . . . . . . . . . . . . . . . . 253 15.2. Basic Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 15.2.1. Basic Syntax Rules . . . . . . . . . . . . . . . . . . . . . . . . . . 255 15.2... | ComputerScienceOne_Page_17_Chunk1560 |
283 17.1. While Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 17.2. For Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 17.3. Do-While Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 17.4. Other Issues . . . . . . . . . . . . . . ... | ComputerScienceOne_Page_17_Chunk1561 |
Contents 18.2. Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 18.2.1. Passing By Reference . . . . . . . . . . . . . . . . . . . . . . . . . 297 18.2.2. Function Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 18.3. Examples . . . . . . . . . . . . . . . . . . . ... | ComputerScienceOne_Page_18_Chunk1562 |
. . . . . . . . . . 331 21.5. Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 21.6. Tokenizing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 22.File I/O 335 22.1. Opening Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335 22.2. Rea... | ComputerScienceOne_Page_18_Chunk1563 |
Contents 23.3. Arrays of Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348 23.4. Using Structures With Functions . . . . . . . . . . . . . . . . . . . . . . 351 23.4.1. Factory Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 23.4.2. To String Functions . . . . . . . . . . . . ... | ComputerScienceOne_Page_19_Chunk1564 |
. . . . . 391 26.4. Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393 26.5. Basic I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 26.6. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396 26.6.1. Converting Units . . . . . . ... | ComputerScienceOne_Page_19_Chunk1565 |
Contents 27.3.3. Quadratic Roots Revisited . . . . . . . . . . . . . . . . . . . . . . 411 28.Loops 415 28.1. While Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415 28.2. For Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417 28.3. Do-While Loops . . . . . . . .... | ComputerScienceOne_Page_20_Chunk1566 |
. . . . . . . . . . . . . 434 30.2. Enumerated Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 30.2.1. More Tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437 31.Arrays 439 31.1. Basic Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439 31.2. Dynamic M... | ComputerScienceOne_Page_20_Chunk1567 |
Contents 33.File I/O 457 33.1. File Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457 33.2. File Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459 34.Objects 461 34.1. Data Visibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462 34.2. Met... | ComputerScienceOne_Page_21_Chunk1568 |
. . . . . . . 498 37.2. Basic Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499 37.2.1. Basic Syntax Rules . . . . . . . . . . . . . . . . . . . . . . . . . . 499 37.2.2. PHP Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500 37.2.3. Libraries . . . . . . . . . . . . . . .... | ComputerScienceOne_Page_21_Chunk1569 |
Contents 37.6. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509 37.6.1. Converting Units . . . . . . . . . . . . . . . . . . . . . . . . . . . 509 37.6.2. Computing Quadratic Roots . . . . . . . . . . . . . . . . . . . . . 512 38.Conditionals 515 38.1. Logical Operators . . . . . . . .... | ComputerScienceOne_Page_22_Chunk1570 |
. . . . . . . . . . . . . . . . 535 40.1.2. Organizing Functions . . . . . . . . . . . . . . . . . . . . . . . . . 537 40.1.3. Calling Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 537 40.1.4. Passing By Reference . . . . . . . . . . . . . . . . . . . . . . . . . 538 40.1.5. Optional & Default Paramet... | ComputerScienceOne_Page_22_Chunk1571 |
Contents 42.2. Indexing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547 42.2.1. Strings as Indices . . . . . . . . . . . . . . . . . . . . . . . . . . . 549 42.2.2. Non-Contiguous Indices . . . . . . . . . . . . . . . . . . . . . . . 549 42.2.3. Key-Value Initialization . . . . . . . . . . .... | ComputerScienceOne_Page_23_Chunk1572 |
. . . . . . . . . . . . . . . . . 568 45.2. Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568 45.2.1. Accessor & Mutator Methods . . . . . . . . . . . . . . . . . . . . 570 45.3. Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571 45.4. Usage . . . . . ... | ComputerScienceOne_Page_23_Chunk1573 |
Contents Index 610 References 613 xxii | ComputerScienceOne_Page_24_Chunk1574 |
List of Algorithms 1.1. An example of pseudocode: finding a minimum value . . . . . . . . . . . . 13 2.1. Assignment Operator Demonstration . . . . . . . . . . . . . . . . . . . . . 34 2.2. Addition and Subtraction Demonstration . . . . . . . . . . . . . . . . . . 35 2.3. Multiplication and Division Demonstration . . . ... | ComputerScienceOne_Page_25_Chunk1575 |
LIST OF ALGORITHMS 4.4. Counter-Controlled For Loop . . . . . . . . . . . . . . . . . . . . . . . . . 100 4.5. Summation of Numbers in a For Loop . . . . . . . . . . . . . . . . . . . . 100 4.6. Counter-Controlled Do-While Loop . . . . . . . . . . . . . . . . . . . . . . 101 4.7. Flag-Controlled Do-While Loop . . . . .... | ComputerScienceOne_Page_26_Chunk1576 |
. . . . . . . . . . . . . . . . . . . . . . . . 225 12.6. QuickSort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 xxiv | ComputerScienceOne_Page_26_Chunk1577 |
LIST OF ALGORITHMS 12.7. In-Place Partition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 12.8. MergeSort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 12.9. Merge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 xxv | ComputerScienceOne_Page_27_Chunk1578 |
List of Code Samples 1.1. A simple program in C . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.2. A simple program in C, compiled to assembly . . . . . . . . . . . . . . . 10 1.3. A simple program in C, resulting machine code formatted in hexadecimal (partial) . . . . . . . . . . . . . . . . . . . . . . . ... | ComputerScienceOne_Page_29_Chunk1579 |
. . . . . . . . . . . . . . . . . 288 17.8. Loan Amortization Program in C . . . . . . . . . . . . . . . . . . . . . . 290 19.1. Using the errno.h library . . . . . . . . . . . . . . . . . . . . . . . . . 307 23.1. A Student structure declaration . . . . . . . . . . . . . . . . . . . . . . 344 25.1. C Function Pointer ... | ComputerScienceOne_Page_29_Chunk1580 |
List of Code Samples 25.5. Sorting Structures via Pointers . . . . . . . . . . . . . . . . . . . . . . . 378 25.6. Handling Null Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 26.1. Hello World Program in Java . . . . . . . . . . . . . . . . . . . . . . . . 384 26.2. Basic Input/Output in Java . .... | ComputerScienceOne_Page_30_Chunk1581 |
. . . . . . . . . . . 491 37.1. Hello World Program in PHP . . . . . . . . . . . . . . . . . . . . . . . . 498 37.2. Hello World Program in PHP with HTML . . . . . . . . . . . . . . . . . 498 37.3. Type Juggling in PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506 37.4. Fahrenheit-to-Celsius Conversion Pr... | ComputerScienceOne_Page_30_Chunk1582 |
List of Code Samples 39.6. Summation of Numbers using a For Loop in PHP . . . . . . . . . . . . . 531 39.7. Nested For Loops in PHP . . . . . . . . . . . . . . . . . . . . . . . . . . 531 39.8. Loan Amortization Program in PHP . . . . . . . . . . . . . . . . . . . . 533 44.1. Processing a file line-by-line in PHP . . . ... | ComputerScienceOne_Page_31_Chunk1583 |
List of Figures 1.1. Depiction of Computer Memory . . . . . . . . . . . . . . . . . . . . . . . 6 1.2. A Compiling Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.1. Types of Flowchart Nodes . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.2. Example of a flowchart for a simple ATM process ... | ComputerScienceOne_Page_33_Chunk1584 |
. . . . . . . . 135 5.2. Program Stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 5.3. Demonstration of Pass By Value . . . . . . . . . . . . . . . . . . . . . . . 141 5.4. Demonstration of Pass By Reference . . . . . . . . . . . . . . . . . . . . 143 7.1. Example of an Array . . . . . . . . . ... | ComputerScienceOne_Page_33_Chunk1585 |
List of Figures 9.1. Linux Tree Directory Structure . . . . . . . . . . . . . . . . . . . . . . . 186 9.2. An example polygon for n = 5 . . . . . . . . . . . . . . . . . . . . . . . . 188 9.3. A Word Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 9.4. A solved Sudoku puzzle . . . . . . . . .... | ComputerScienceOne_Page_34_Chunk1586 |
of a character array (string) in C. . . . . . . . . . . . . . . . . . 325 23.1. Contiguous Structure Array . . . . . . . . . . . . . . . . . . . . . . . . . 350 23.2. Array of Structure Pointers . . . . . . . . . . . . . . . . . . . . . . . . . 350 23.3. Hybrid Array of Structures . . . . . . . . . . . . . . . . . . . ... | ComputerScienceOne_Page_34_Chunk1587 |
1. Introduction Computers are awesome. The human race has seen more advancements in the last 50 years than in the entire 10,000 years of human history. Technology has transformed the way we live our daily lives, how we interact with each other, and has changed the course of our history. Today, everyone carries smart ph... | ComputerScienceOne_Page_35_Chunk1588 |
1. Introduction 1.1. Problem Solving At its heart, Computer Science is about problem solving. That is not to say that only Computer Science is about problem solving. It would be hubris to think that Computer Science holds a monopoly on “problem solving.” Indeed, it would be hard to find any discipline in which solving p... | ComputerScienceOne_Page_36_Chunk1589 |
1.1. Problem Solving 3. Testing 4. Refinement After one has a good understanding of a problem, they can start designing a solution. A design is simply a plan on the construction of a solution. A design “on paper” allows you to see what the potential solution would look like before investing the resources in building it.... | ComputerScienceOne_Page_37_Chunk1590 |
1. Introduction entities that make up a system first. Once these have been defined and implemented, they are combined and interactions between them are defined to produce a more complex system. 1.2. Computing Basics Everyone has some level of familiarity with computers and computing devices just as everyone has familiarit... | ComputerScienceOne_Page_38_Chunk1591 |
1.3. Basic Program Structure Unit 2n Number of bytes Kilobyte (KB) 210 1,024 Megabyte (MB) 220 1,048,576 Gigabyte (GB) 230 1,073,741,824 Terabyte (TB) 240 1,099,511,627,776 Petabyte (PB) 250 1,125,899,906,842,624 Exabyte (EB) 260 1,152,921,504,606,846,976 Zettabyte (ZB) 270 1,180,591,620,717,411,303,424 Yottabyte (YB) ... | ComputerScienceOne_Page_39_Chunk1592 |
1. Introduction Address Contents ... ... 0x7fff58310b8f 0x7fff58310b8b 0x32 0x7fff58310b8a 0x3e 0x7fff58310b89 0xcf 0x7fff58310b88 0x23 0x7fff58310b87 0x01 0x7fff58310b86 0x32 0x7fff58310b85 0x7c 0x7fff58310b84 0xff 0x7fff58310b83 0x7fff58310b82 0x7fff58310b81 0x7fff58310b80 0x7fff58310b7f 0x7fff58310b7e 0x7fff58310b7d... | ComputerScienceOne_Page_40_Chunk1593 |
1.3. Basic Program Structure a plain text file that can be edited by any text editor. However, many developers and programmers utilize modern Integrated Development Environment (IDE) that provide a text editor with code highlighting: various elements are displayed in different colors to make the code more readable and el... | ComputerScienceOne_Page_41_Chunk1594 |
1. Introduction Text Editor or IDE Source File Compiler Syntax Error(s) Object File Linker Other Object Files & Libraries Executable File Results & Output success run Input Figure 1.2.: A Compiling Process 8 | ComputerScienceOne_Page_42_Chunk1595 |
1.3. Basic Program Structure 1 #include <stdlib.h> 2 #include <stdio.h> 3 #include <math.h> 4 5 int main(int argc, char **argv) { 6 7 if(argc != 2) { 8 fprintf(stderr, "Usage: %s x\n", argv[0]); 9 exit(1); 10 } 11 12 double x = atof(argv[1]); 13 double result = sqrt(x); 14 15 if(x < 0) { 16 fprintf(stderr, "Cannot hand... | ComputerScienceOne_Page_43_Chunk1596 |
1. Introduction .section __TEXT,__text,regular,pure_instructions .globl _main .align 4, 0x90 _main: ## @main .cfi_startproc ## BB#0: pushq %rbp Ltmp2: .cfi_def_cfa_offset 16 Ltmp3: .cfi_offset %rbp, -16 movq %rsp, %rbp Ltmp4: .cfi_def_cfa_register %rbp subq $48, %rsp movl $0, -4(%rbp) movl %edi, -8(%rbp) movq %rsi, -16... | ComputerScienceOne_Page_44_Chunk1597 |
1.3. Basic Program Structure 00000e40 55 48 89 e5 48 83 ec 30 c7 45 fc 00 00 00 00 89 |UH..H..0.E......| 00000e50 7d f8 48 89 75 f0 81 7d f8 02 00 00 00 0f 84 2c |}.H.u..}.......,| 00000e60 00 00 00 48 8d 35 f2 00 00 00 48 8b 05 9f 01 00 |...H.5....H.....| 00000e70 00 48 8b 38 48 8b 45 f0 48 8b 10 b0 00 e8 94 00 |.H.8H... | ComputerScienceOne_Page_45_Chunk1598 |
00002040 66 00 90 00 72 20 11 40 5f 65 78 69 74 00 90 00 |f...r .@_exit...| 00002050 72 28 11 40 5f 66 70 72 69 6e 74 66 00 90 00 72 |r(.@_fprintf...r| 00002060 30 11 40 5f 70 72 69 6e 74 66 00 90 00 00 00 00 |0.@_printf......| 00002070 00 01 5f 00 05 00 02 5f 6d 68 5f 65 78 65 63 75 |.._...._mh_execu| 00002080 74 65 5... | ComputerScienceOne_Page_45_Chunk1599 |
1. Introduction languages may still have a predefined main function, but in general, a script starts executing starting with the first instruction in the script file. Adhering to the syntax rules is still important, but since interpreted languages are not compiled, syntax errors become runtime errors. A program may run fin... | ComputerScienceOne_Page_46_Chunk1600 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.