12.07.2015 Views

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

object-oriented programs: impedance & batons 79ComplexDyn. What is unusual about this nonstatic method is that it is supposedto add two complex numbers together, yet there is only one argument given to themethod and no object is returned! Indeed, the assumption is that since the methodis nonstatic, it will be used to modify only the object to which it will be attached.Hence it literally goes without saying that there is an object around for this methodto modify, and the this reference is used to refer to “this” calling object. In fact, thereason the argument to the method is conventionally called other is to distinguish itfrom the this object that the method will modify. (We are being verbose for clarity’ssake: The word “this” may be left out of these statements without changing theiractions.) Consequently, when the object addition is done in line 11 withthis.re = this.re + other.re; // Addition of re parts of this and other 11it is understood that re refers to the current object being modified (this), whileother refers to the “other” object being used to make the modifications.4.5 Complex Currents (Solution)1. Extend the class Complex.java or ComplexDyn.java by adding new methodsto subtract, take the modulus, take the complex conjugate, and determine thephase of complex numbers.2. Test your methods by checking that the following identities hold for a varietyof complex numbers:z + z =2z, z + z∗ =2Re zz − z =0, z− z∗ =2Im z (4.17)zz∗ = |z| 2 , zz∗ = r 2 (which is real)Hint: Compare your output to some cases of pure real, pure imaginary, andsimple complex numbers that you are able to evaluate by hand.3. Equation (4.14) gives the magnitude and phase of the current in a single RLCcircuit. Modify the given complex arithmetic program so that it performs therequired complex arithmetic.4. Compute and then make a plot of the magnitude and phase of the current inthe circuit as a function of frequency 0 ≤ ω ≤ 2.5. Construct a z(x, y) surface plot of the magnitude and phase of the current asfunctions of both the frequency of the external voltage ω and of the resistanceR. Observe how the magnitude has a maximum when the external frequencyω =1/ √ LC . This is the resonance frequency.6. Another approach is to make a 3-D visualization of the complex Z as a functionof a complex argument (Figure 4.3). Do this by treating the frequency ω = x +iy as a complex number. You should find a sharp peak at x = Re(ω)=1. Adjustthe plot so that you tell where Im(1/Z) changes sign. If you look closely at thegraph, you should also see that there is a maximum for a negative imaginaryvalue of ω. This is related to the length of the lifetime of the resonance.−101<strong>COPYRIGHT</strong> <strong>2008</strong>, PRINCET O N UNIVE R S I T Y P R E S SEVALUATION COPY ONLY. NOT FOR USE IN COURSES.ALLpup_06.04 — <strong>2008</strong>/2/15 — Page 79

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!