5 Pages

L14cs2110fa08-6up

Course: CS 2110, Fall 2008
School: Cornell
Rating:
 
 
 
 
 

Word Count: 1886

Document Preview

Types Generic in Java 5 Generic Types and the Java Collections Framework Lecture 14 CS2110 Fall 2008 ! When using a collection (e.g., LinkedList, HashSet, HashMap), we generally have a single type T of elements that we store in it (e.g., Integer, String) ! Before Java 5, when extracting an element, had to cast it to T before we could invoke T's methods ! Compiler could not check that the cast was correct at...

Register Now

Unformatted Document Excerpt

Coursehero >> New York >> Cornell >> CS 2110

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Types Generic in Java 5 Generic Types and the Java Collections Framework Lecture 14 CS2110 Fall 2008 ! When using a collection (e.g., LinkedList, HashSet, HashMap), we generally have a single type T of elements that we store in it (e.g., Integer, String) ! Before Java 5, when extracting an element, had to cast it to T before we could invoke T's methods ! Compiler could not check that the cast was correct at compile-time, since it didn't know what T was ! Inconvenient and unsafe, could fail at runtime ! Generics in Java 5 provide a way to communicate T, the type of elements in a collection, to the compiler " Compiler can check that you have used the collection consistently " Result: safer and more-efficient code 2 Example //removes 4-letter words from c //elements must be Strings static void purge(Collection c) { Iterator i = c.iterator(); while (i.hasNext()) { if (((String)i.next()).length() == 4) i.remove(); }} Another Example Map grades = new HashMap(); grades.put("John", new Integer(67)); grades.put("Jane", new Integer(88)); grades.put("Fred", new Integer(72)); Integer x = (Integer)grades.get("John"); sum = sum + x.intValue(); old old 3 //removes 4-letter words from c static void purge(Collection<String> c) { Iterator<String> i = c.iterator(); while (i.hasNext()) { if (i.next().length() == 4) i.remove(); }} Map<String, Integer> grades = new HashMap<String, Integer>(); grades.put("John", new Integer(67)); grades.put("Jane", new Integer(88)); grades.put("Fred", new Integer(72)); Integer x = grades.get("John"); sum = sum + x.intValue(); new new 4 Type Casting ! In effect, Java inserts the correct cast automatically, based on the declared type ! In this example, grades.get("John") is automatically cast to Integer Map<String, Integer> grades = new HashMap<String, Integer>(); grades.put("John", new Integer(67)); grades.put("Jane", new Integer(88)); grades.put("Fred", new Integer(72)); Integer x = grades.get("John"); sum = sum + x.intValue(); An Aside: Autoboxing ! Java 5 also has autoboxing and auto-unboxing of primitive types, so the example can be further simplified Map<String,Integer> grades = new HashMap<String,Integer>(); grades.put("John",new Integer(67)); grades.put("Jane",new Integer(88)); grades.put("Fred",new Integer(72)); Integer x = grades.get("John"); sum = sum + x.intValue()); Map<String,Integer> grades = new HashMap<String,Integer>(); grades.put("John", 67); grades.put("Jane", 88); grades.put("Fred", 72); sum = sum + grades.get("John"); 5 6 Using Generic Types ! <T> is read, of T " For example: Stack<Integer> is read, Stack of Integer Advantage of Generics ! Declaring Collection<String> c tells us something about the variable c (i.e., c holds only Strings) " This is true wherever c is used " The compiler checks this and wont compile code that violates this ! The type annotation <T> informs the compiler that all extractions from this collection should be automatically cast to T ! Specify type in declaration, can be checked at compile time " Can eliminate explicit casts ! Without use of generic types, explicit casting must be used " A cast tells us something the programmer thinks is true at a single point in the code " The Java virtual machine checks whether the programmer is right only at runtime 7 8 Subtypes Stack<Integer> Programming with Generic Types public interface List<E> { // E is a type variable void add(E x); Iterator<E> iterator(); } public interface Iterator<E> { E next(); boolean hasNext(); void remove(); } is not a subtype of Stack<Object> Stack<Integer> s = new Stack<Integer>(); s.push(new Integer(7)); Stack<Object> t = s; // Gives compiler error t.push("bad idea"); System.out.println(s.pop().intValue()); However, Stack<Integer> is a subtype of Stack (for backward compatibility with previous Java versions) Stack<Integer> s = new Stack<Integer>(); s.push(new Integer(7)); Stack t = s; // Compiler allows this t.push("bad idea"); // Produces a warning System.out.println(s.pop().intValue()); //Runtime error! ! To use the interface List<E>, supply an actual type argument, e.g., List<Integer> ! All occurrences of the formal type parameter (E in this case) are replaced by the actual type argument (Integer in this case) 10 9 Wildcards void printCollection(Collection c) { Iterator i = c.iterator(); while (i.hasNext()) { System.out.println(i.next()); }} void printCollection(Collection<Object> c) { for (Object e : c) { System.out.println(e); }} void printCollection(Collection<?> c) { for (Object e : c) { System.out.println(e); }} Bounded Wildcards static void sort (List<? extends Comparable> c) { ... } old bad ! Note that if we declared the parameter c to be of type List<Comparable> then we could not sort an object of type List<String> (even though String is a subtype of Comparable) " Suppose Java treated List<String> and List<Integer> as a subtype of List<Comparable> " Then, for instance, a method passed an object of type List<Comparable> would be able to store Integers in our List<String> good ! Wildcards let us specify exactly what types are allowed 11 12 Generic Methods ! Adding all elements of an array to a Collection static void a2c(Object[] a, Collection<?> c) { for (Object o : a) { c.add(o); // compile time error }} Generic Classes public class Queue<T> extends AbstractBag<T> { private java.util.LinkedList<T> queue = new java.util.LinkedList<T>(); public void insert(T item) { queue.add(item); } public T extract() throws java.util.NoSuchElementException { return queue.remove(); public void clear() { queue.clear(); public int size() { return queue.size(); bad good static <T> void a2c(T[] a, Collection<T> c) { for (T o : a) { c.add(o); // ok }} } } ! See the online Java Tutorial for more information on generic types and generic methods } 13 } 14 Generic Classes public class InsertionSort<T extends Comparable<T>> { public void sort(T[] x) { for (int i = 1; i < x.length; i++) { // invariant is: x[0],...,x[i-1] are sorted // now find rightful position for x[i] T tmp = x[i]; int j; for (j = i; j > 0 && x[j-1].compareTo(tmp) > 0; j--) x[j] = x[j-1]; x[j] = tmp; } Java Collections Framework ! Collections: holders that let you store and organize in objects useful ways for efficient access ! Since Java 1.2, the package java.util includes interfaces and classes for a general collection framework ! Goal: conciseness " A few concepts that are broadly useful " Not an exhaustive set of useful concepts ! The collections framework provides " Interfaces (i.e., ADTs) " Implementations } } 15 16 JCF Interfaces and Classes ! Interfaces " " " " Collection Set (no duplicates) SortedSet List (duplicates OK) java.util.Collection<E> (an interface) public int size(); " Return number of elements in collection ! Classes " " " " HashSet TreeSet ArrayList LinkedList public boolean isEmpty(); " Return true iff collection holds no elements public boolean add(E x); " Make sure the collection includes x; returns true if collection has changed (some collections allow duplicates, some dont) " Map (i.e., Dictionary) " SortedMap " Iterator " Iterable " ListIterator " HashMap " TreeMap public boolean contains(Object x); " Returns true iff collection contains x (uses equals( ) method) public boolean remove(Object x); " Removes a single instance of x from the collection; returns true if collection has changed public Iterator<E> iterator(); " Returns an Iterator that steps through elements of collection 17 18 java.util.Iterator<E> (an interface) public boolean hasNext(); " Returns true if the iteration has more elements Additional Methods of Collection<E> public Object[] toArray() " Returns a new array containing all the elements of this collection public E next(); " Returns the next element in the iteration " Throws NoSuchElementException if no next element public <T> T[] toArray(T[] dest) " Returns an array containing all the elements of this collection; uses dest as that array if it can public void remove(); " The element most recently returned by next() is removed from the underlying collection " Throws IllegalStateException if next() not yet called or if remove() already called since last next() " Throws UnsupportedOperationException if remove() not supported 19 Bulk Operations: " " " " " public public public public public boolean containsAll(Collection<?> c); boolean addAll(Collection<? extends E> c); boolean removeAll(Collection<?> c); boolean retainAll(Collection<?> c); void clear(); 20 java.util.Set<E> (an interface) ! Set extends Collection " Set inherits all its methods from Collection Set Implementations ! java.util.HashSet<E> (a hashtable) " Constructors public public public public HashSet(); HashSet(Collection<? extends E> c); HashSet(int initialCapacity); HashSet(int initialCapacity, float loadFactor); ! Write a method that checks if a given word is within a Set of words ! Write a method that removes all words longer than 5 letters from a Set ! Write methods for the union and intersection of two Sets ! A Set contains no duplicates " If you attempt to add() an element twice then the second add() will return false (i.e., the Set has not changed) ! java.util.TreeSet<E> (a balanced BST [red-black tree]) " Constructors public TreeSet(); public TreeSet(Collection<? extends E> c); ... 21 22 java.util.SortedSet<E> (an interface) ! SortedSet extends Set ! For a SortedSet, the iterator() returns the elements in sorted order ! Methods (in addition to those inherited from Set): " public E first(); # Returns the first (lowest) object in this set java.lang.Comparable<T> (an interface) ! public int compareTo(T x); " Returns a value (< 0), (= 0), or (> 0) # (< 0) implies this is before x # (= 0) implies this.equals(x) is true # (> 0) implies this is after x " public E last(); # Returns the last (highest) object in this set ! Many classes implement Comparable " String, Double, Integer, Char, java.util.Date, " If a class implements Comparable then that is considered to be the classs natural ordering " public Comparator<? super E> comparator(); # Returns the Comparator being used by this sorted set if there is one; returns null if the natural order is being used " 23 24 java.util.Comparator<T> (an interface) ! public int compare(T x1, T x2); " Returns a value (< 0), (= 0), or (> 0) # (< 0) implies x1 is before x2 # (= 0) implies x1.equals(x2) is true # (> 0) implies x1 is after x2 SortedSet Implementations ! java.util.TreeSet<E> " constructors: public TreeSet(); public TreeSet(Collection<? extends E> c); public TreeSet(Comparator<? super E> comparator); ... ! Can often use a Comparator when a classs natural order is not the one you want " String.CASE_INSENSITIVE_ORDER is a predefined Comparator " java.util.Collections.reverseOrder() returns a Comparator that reverses the natural order ! Write a method that prints out a SortedSet of words in order ! Write a method that prints out a Set of words in order 25 26 java.util.List<E> (an interface) ! ! ! ! ! List extends Collection Items in a list can be accessed via their index (position in list) The add() method always puts an item at the end of the list The iterator() returns the elements in list-order Methods (in addition to those inherited from Collection): " public E get(int index); # Returns the item at position index in the list List Implementations ! java.util.ArrayList<E> (an array; uses array-doubling) " Constructors # public ArrayList(); # public ArrayList(int initialCapacity); # public ArrayList(Collection<? extends E> c); ! java.util.LinkedList <E> (a doubly-linked list) " Constructors # public LinkedList(); # public LinkedList(Collection<? extends E> c); " public E set(int index, E x); # Places x at position index, replacing previous item; returns the previous item " public void add(int index, E x); # Places x at position index, shifting items to make room " public E remove(int index); # Remove item at position index, shifting items to fill the space; # Returns the removed item ! Both include some additional useful methods specific to that class " public int indexOf(Object x); # Return the index of the first item in the list that equals x (x.equals()) " 27 28 Efficiency Depends on Implementation ! Object x = list.get(k); " O(1) time for ArrayList " O(k) time for LinkedList ! list.remove(0); " O(n) time for ArrayList " O(1) time for LinkedList ! if (set.contains(x)) ... " O(1) expected time for HashSet " O(log n) for TreeSet 29
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Cornell - CS - 2110
Generic Types and the Java Collections FrameworkLecture 14 CS2110 Fall 2008Generic Types in Java 5 When using a collection (e.g.,LinkedList, HashSet, HashMap), we generally have asingle type T of elements that we store in it (e.g., Integer, String) B
Cornell - CS - 2110
Designing, Coding, and DocumentingAnnouncements! A4 is up, due Sunday November 9&quot; more difficult than the previous assignments# more code # distributed client/server app # lots of concurrencyLecture 15 CS2110 Fall 20082Quiz 2 What value is printed?
Cornell - CS - 2110
Designing, Coding, and DocumentingLecture 15 CS2110 Fall 2008Announcements A4 is up, due Sunday November 9 more difficult than the previous assignments more code distributed client/server app lots of concurrency2Quiz 2 What value is printed?class
Cornell - CS - 2110
Abstract Data Types (ADTs)! A method for achieving abstraction for data structures and algorithms ! ADT = model + operations ! Describes what each operation does, but not how it does it ! An ADT is independent of its implementation ! In Java, an interfac
Cornell - CS - 2110
Standard ADTsLecture 16 CS2110 Fall 2008Abstract Data Types (ADTs) A method for achieving abstraction for data structures and algorithms ADT = model + operations Describes what each operation does, but not how it does it An ADT is independent of its im
Cornell - CS - 2110
AnnouncementsPriority Queues and Heaps Some changes to the CS major to be announced soon 2111 no longer required for new majorsLecture 17 CS2110 Fall 2008 A&amp;S and Engr students may drop 2111 until Nov 14 without transcript annotation If this affects y
Cornell - CS - 2110
Priority Queues and HeapsLecture 17 CS2110 Fall 2008Announcements Some changes to the CS major to be announced soon 2111 no longer required for new majors A&amp;S and Engr students may drop 2111 until Nov 14 without transcript annotation If this affects yo
Cornell - CS - 2110
Announcements! Prelim 2&quot; Tuesday, Nov 18, 7:30-9pm &quot; Uris Auditorium! Exam conflicts&quot; Email Kelly Patwell ASAP! Old exams are available for review on the course websiteGraphsLecture 18 CS2110 Fall 20082These are not Graphs90.00 71.88 53.75 35.63
Cornell - CS - 2110
GraphsLecture 18 CS2110 Fall 2008Announcements Prelim 2 Tuesday, Nov 18, 7:30-9pm Uris Auditorium Exam conflicts Email Kelly Patwell ASAP Old exams are available for review on the course website2These are not GraphsEast West North.not the kind
Cornell - CS - 2110
More GraphsLecture 19 CS2110 Fall 2008Representations of Graphs1 2 4 3Adjacency List1 2 3 4 2 3 2 3 4Adjacency Matrix1 1 2 3 4 0 0 0 0 2 1 0 0 1 3 0 1 0 1 4 1 0 0 0Adjacency Matrix or Adjacency List?n = number of vertices m = number of edges d(u)
Cornell - CS - 2110
Prelim 2 ReminderThreads and Concurrency! Prelim 2&quot; Tuesday 18 Nov, 7:30-9pm &quot; Uris Auditorium &quot; One week from today! &quot; Topics: all material up to and including this week's lectures &quot; Includes graphs! Prelim 2 Review Session&quot; Sunday 4/15,1:30-3pm &quot; U
Cornell - CS - 2110
Threads and ConcurrencyLecture 20 CS2110 Fall 2008Prelim 2 Reminder Prelim 2 Tuesday 18 Nov, 7:30-9pm Uris Auditorium One week from today! Topics: all material up to and including this week's lectures Includes graphs Prelim 2 Review Session Sunday 4
Cornell - CS - 2110
Announcements Course Review &amp; A Few Unanswered QuestionsLecture 25 CS2110 Fall 2008 ! Final Exam&quot; Thursday, Dec 18 &quot; 2 - 4:30pm &quot; Uris Auditorium! For exam conflicts:&quot; Notify Kelly Patwell today &quot; You must provide# Your entire exam schedule # Include
Cornell - CS - 2110
Course Review &amp; A Few Unanswered QuestionsLecture 25 CS2110 Fall 2008Announcements Final Exam Thursday, Dec 18 2 - 4:30pm Uris Auditorium For exam conflicts: Notify Kelly Patwell today You must provide Your entire exam schedule Include the course n
Cornell - ECE - 4130
ECE426Spring 2008APPLICATION OF SIGNAL PROCESSINGCOURSE ANNOUNCEMENTS Course and Title: ECE426, Applications of Signal Processing Instructor: TA: Webpage: B. Hutchins, Rm 218 Phillips, 255-4075, hutchins@ece.cornell.edu TBA http:/blackboard.cornell.edu
Cornell - ECE - 4130
1-2FundamentalConceptsChap. 14. In a medical test for a certain molecule, the concentration in the blood is reported as 123 mcg/dL. What is the concentration in proper 81 notation?Solution:123 mcg/dL = 10-3io-2 g/10-1 L = 1.23 X 10-6 g/L = 1.23 p,g/
Cornell - ECE - 4130
1-38. Show by argument that the reciprocal of Avogadro's constant is the gram equivalent of 1 atomic mass unit.Solution:By definition one gram atomic weight of 12C is 12 gfmol. Thus the mass of one atom of 12CisM r~C) = Na12g/mol = &quot;12 g/atom. atoms/m
Cornell - ECE - 4130
1-4FundamentalConceptsChap. 112. Dry air at normal temperature and pressurehas a mass density of 0.0012 gj cm3 with a mass fraction of oxygenof 0.23. What is the atom density (atomjcm3) of 180? Solution: From Eq. (1.5), the atom density of oxygen isN
Cornell - ECE - 4130
1-5 (b) The volumeV of the uraniumis V = Mu/pu = (4000 )/(19.2 g/cm3) = g 208.3 m3. Hence he atomdensities re c t a Ns = ~AsVMaNa= (791.9 )(6.022x 1023 toms/mol) = 9.740 X 1021 cm-3 g a(235 g/mol)(208.3 cm3) (3208g)(6.022 x 1023atoms/mol) = 3.896 X 10
Cornell - ECE - 4130
1-6FundamentalConceptsChap. 116. A concrete with a density of 2.35 gfcm3 has a hydrogen content of 0.0085 weight fraction. What is the atom density of hydrogen in the concrete?Solution:From Eq. (1.5), the atom density of hydrogen is (0.0085)(2.35g/c
Cornell - ECE - 4130
PROBLEMSAn acceleratorincreasesthe total energy of electronsuniformly to 10 GeV over a 3000m path. That meansthat at 30 m, 300m, and 3000m, the kinetic energy is 108,109, and 1010 V, respectively. At eachof these distances,compute the e velocity, relativ
Cornell - ECE - 4130
2-3 3. In fission reactors one deals with neutrons having kinetic energiesas high as 10 MeV. How much error is incurred in computing the speed of 10-MeV neutrons by using the classical expressionrather than the relativistic expression for kinetic energy?
Cornell - ECE - 4130
2-4Modern Physics ConceptsChap. 25. In the Relativistic Heavy Ion Collider, nuclei of gold are acceleratedto speeds of 99.95% the speed of light. These nuclei are almost spherical when at rest; however, as they move past the experimenters they appear c
Cornell - ECE - 4130
2-6Modern Physics ConceptsChap. 2A 1 MeV photon is Compton scattered at an angle of 55 degrees. Calculate (a) the energy of the scattered photon, (b) the change in wavelength, and (c) the recoil energy of the electron. Solution:(a) FromEq. (2.26)1 .1
Cornell - ECE - 4130
2-8Modern Physics ConceptsChap. 212. What are the wavelengthsof electrons with kinetic energiesof (a) 10 eV, (b) 1000eV, and (c) 107 eV? Solution: From Eq. (2.17) p = (1/c)~T2 + 2Tmoc2 and using the de Broglie relation&gt;. = hip we obtain the de Broglie
Cornell - ECE - 4130
3-3 Using the liquid drop model, tabulate the nuclear binding energy and the various contributions to the binding energy for the nuclei 40Caand 2o8Pb. Solution: A BASIC program is used to evaluate the terms in text Eq. (3.16). A program listing and result
Cornell - ECE - 4130
3-6~tomic/Nuclear ModelsChap.3In radioactive beta decay,the number of nucleonsA remains constant although the individual number of neutrons and protons change. Members of a such beta-decay chain are isobars with nearly equal masses.Using the atomic mas
Cornell - ECE - 4130
PROBLEMS1. Complete the following nuclear reactionsbasedon the conservationof nucleons:(a) 2~U+ An -+ (7) (b) l~N + An -+ (7) + lH (c) 2~Ra -+ (7) + ~He (d) (7) -+ 2~gTh + ~HeSolution: (a) 2~U An -+ 2:~U + (b) l~N + An -+ l:C + IH (c) 2~Ra-+ 2llRn + ~H
Cornell - ECE - 4130
4-3A nuclear scientist attempts to perform experiments on the stable nuclide ~Fe. Determine the energy (in Me V) the scientist will need to 1. remove a single neutron. 2. remove a single proton. 3. completely dismantle the nucleus into its individual nuc
Cornell - ECE - 4130
4-4Nuclear EnergeticsChap. 47. What is the Q-value (in MeV) for eachof the following possible nuclear reactions? Which are exothermic and which are endothermic? 19B+ 'Y 9B + 0 In 51 9 IP + 4Be -+~Be+ Ip ~Be+ ~H ~Be+ iH ~Li + ~HeSolution:Consider th
Cornell - ECE - 4130
4-59. What is the net energy released (in MeV) for each of the following fusion reactions? (a) ~H + ~H -+ ~He+ Anand (b) ~H+ iH -+ ~He+ AnSolution:(a) The energy releasedis the Q-value of the reactions.Q = cfw_2M(~H) -M(~He) -mn C2= cfw_2 x 2.0141018
Cornell - ECE - 4130
5-3 2. The radioisotope 224Ra ecaysby a emission primarily to the ground state of d 220Rn (94% probability) and to the first excited state 0.241 MeV above the ground state (5.5% probability). What are the energiesof the two associated a particles? .Solut
Cornell - ECE - 4130
5-5The averagelifetime is-1t = &quot;X= 1.86 X 10 y.9From Fig. 5.5, the probability of /3+ decayis 0.8984+ 0.00006 = 0.8990. Thus the decay constant for positron decayis&gt;'cfw_J+ = 0.8990 x&gt;. = 0.2395 y-l,From Fig. 5.5, the probability of electron captur
Cornell - ECE - 4130
5-6RadioactivityChap. 5(b) Tl/2 = In 2/&gt;&quot; = 1.18 X 106 S = 326.5 h = 13.6 d = 1.94 wk. (c) t = 1/&gt;&quot; = 1.69 X 106 S = 471 h = 19.6 d = 2.80 wk.8. The isotope 1321 ecays by /3- emissionto 132Xe ith a half-life of 2.3 h. (a) d w How long will it take for
Cornell - ECE - 4130
5-7 10. How many atoms are there in a 1.20 MBq sourceof (a) 24Naand (b) 238U?Solution:BecauseA =&gt;'N we have N(atoms) = A(Bq)j&gt;.(s-l). (a) For 24Na we find from Table A.4 that Tl/2 = 14.96 h = 5.385 X 104s. Then&gt;. = In2/TI/2 = 1.287x 10-5 s-1 Thus the nu
Cornell - ECE - 4130
5-8RadioactivityChap. 512. A 6.2 mg sample of gOSr(half-life 29.12 y) is in secular equilibrium with its daughter gOy(half-life 64.0 h). (a) How many Bq of gOSr re present? (b) How a many Bq of gOy are present? (c) What is the massof gOypresent? (d) Wh
Cornell - ECE - 4130
5-1318. The averagemass of potassium in the human body is about 140 g. From the abundance and half-life of 40K (seeTable 5.2), estimate the average activity (Bq) of 40K in the body.Solution:From Table 5.2, the atomic abundance of40K is 140= 0.000117. T
Cornell - ECE - 4130
5-14RadioactivityChap. 520. Charcoal found in a deep layer of sedimentin a caveis found to have an atomic 14Cj12Cratio only 30% that of a charcoal sample from a higher level with a known age of 1850y. What is the age of the deeperlayer? Solution: Let R
Cornell - ECE - 4130
BinaryNuclearReactionsPROBLEMS1. A 2-MeV neutron is scattered elastically by 12Cthrough an angle of 45 degrees. What is the scattered neutron's energy?Solution:From Eq. (6.25)E' = ~(A + 1)2cfw_JEcos(s + VE(A2 -1 + COS2 2 (s)2. The first nuclear
Cornell - ECE - 4130
6-2 (c) From Eq. (6.25) 1E' = (A+1)2VEcos(s + VE(A2Binary Nuclear Reactions-Chap. 6-1 + cos2 (s) + A(A + l)Q 2.j8 cos(45)+ ./8(144 -1 + cos2(45)+ 12(13)! -4.439) 2= 3.22 MeV.Derive Eq. (6.21) from Eq. (6.11). Solution: Begin with the general resul
Cornell - ECE - 4130
6-34. For each of the following possible reactions, all of which create the compound nucleus 7Li, '7Li + n 6Li + 'Y t-.) -In + 6Li -+ 7Li* -+6He+ p 5He+ d3H+acalculate (a) the Q-value, (b) the kinematic threshold energy, and (c) the minimum kinetic en
Cornell - ECE - 4130
6-5 6. Consider the following reactions caused by tritons, nuclei of 3H, interacting with 160 to produce the compound nucleus 19F 18F+ 170 + 180 + 16N + n d p 3He3H + 160 -+ 19F*-+For each of these reactions calculate (a) the Q-value, (b) the kinematic
Cornell - ECE - 4130
6-6Binary Nuclear ReactionsChap. 6The neutron threshold energy for thjs reaction is found from Eq. (6.15)8. The isotope 18Fis a radionuclide used in medical diagnosesof tumors and, although usually produced by the 180(p,n)18F reaction, it can also be
Cornell - ECE - 4130
6-9 11. How many elastic scatters, on the average,are required to slowa I-MeV neutron to below I eV in (a) 160 and in (b) 56Fe?Solution:The averagelogarithmic energy loss per elastic scatter, 1;,is given by Eq. (6.29)where a =(A -1)2j(A+ 1)2. For 160,
Cornell - ECE - 4130
6-10Binary Nuclear ReactionsChap.6In a particular neutron-induced fissionof 235U,4 prompt neutrons are produced and one fission fragment is 121 g. ( a) What is the other fission fragment? (b) A How much energy is liberated promptly (i.e., beforethe fis
Cornell - ECE - 4130
6-10Binary Nuclear ReactionsChap. 6In a particular neutron-induced fissionof 235U,4 prompt neutrons are produced and one fission fragment is 121 g. (a) What is the other fission fragment? (b) A How much energy is liberated promptly (i.e., beforethe fis
Cornell - ECE - 4130
6-11(b) The fission reaction taken to its stable endpoint fission products is An+ 2~U-+ ~gZr+ l~Ce+ 4(An). The photons produced in the fission event and in the decay of the fission products are not shown. (c) The prompt energyreleaseis the Q-value of the
Cornell - ECE - 4130
6-12Binary Nuclear ReactionsChap. 6(a) How much 235Us consumedper year (in gjy) to produce enough electricity i to continuously run a 100 W light bulb? (b) How much coal (in gjy) would be needed(coal has a heat content of about 12 GJjton)? Assume a con
Cornell - ECE - 4130
6-1318. Estimate the available D-D fusion energy in an 8 ounceglassof water. For how long could this energy provide the energy needsof a house with an average power consumption of 10 kW? Solution: (a) First find the number of deuterium atoms in the glass
Cornell - ECE - 4130
6-14Binary Nuclear ReactionsChap. 6(c) The earth is about Re = 93 X 106 mi = 1.50 X 1013cm from the sun. A sphere with this radius has a surface area of A = 47r ~ = 2.81 X 1027cm2. R The radiant power crossingthis spherical surface is P 8 or the energy
Cornell - ECE - 4130
7-2(a) Water:Radiation InteractionsChap. 7(JLjp) = 0.07066 cm2jg and p = 1.00 g cm-3. Thus,(b) Iron: (Jl,/p)=0.05951 cm2/g and p=7.874gcm-3.Thus,(c) Lead: (JLjp) = 0.06803cm2jg and p = 11.35g cm-3. Thus,Xl/2 = In 2/ (~ ) p = 0.898cm.Based on the
Cornell - ECE - 4130
7-34. A material is found to have a tenth-thickness of 2.3 cm for 1.25-MeV gamma rays. (a) What is the linear attenuation coefficient for this material? (b) What is the half-thickness? (c) What is the mean-free-path length for 1.25-MeV photons in this ma
Cornell - ECE - 4130
7-4Radiation InteractionsChap.76. Calculate the linear interaction coefficients in pure air at 20C and 1 atm pressure for a I-MeV photon and a thermal neutron (2200 m S-I). Assume that air has the composition 75.30itrogen, 23.2%oxygen, and 1.4% argon b
Cornell - ECE - 4130
7-6Radiation InteractionsChap. 7A small homogeneous ample of mass m (g) with atomic mass A is irradiated s uniformly by a constant flux density &lt;/Jcm-2 S-1). If the total atomic cross ( section for the sample material with the irradiating particles is
Cornell - ECE - 4130
1-8Radiation InteractionsChap. 7(a) 27-keV neutrons: The total interaction coefficient or macroscopiccross section is Et(27 keY) = NFea[e(27 keY) = 0.03397cm-l. Then from Eq. (P7.3), the fraction of 27-keVneutrons transmitted through the slab is Fracti
Cornell - ECE - 4130
7-9The proton energy with the same speed as a 10-MeV alpha particle is, thus, Ep = Ea/4 = 2.5 MeV. Then from rule 3 on page 196 for particles of the same speed in the same medium, we haveRa(lO MeV) Rp(2.5 MeV)ma z~ -14 ~ - ~! -2mp ZQ= 1,Thus the ran
Cornell - ECE - 4130
PROBLEMS1. Should the quenching gas in a GM tube have a higher or lower ionization potential than the major tube gas? Why?Solution:The quenchgas should have a lower ionization potential than that of the major tube gas (hereafter, simply called the tube
Cornell - ECE - 4130
8-2Radiation DetectionChap. 8increasesthe detector efficiency for charged particle detection since there is a higher chancea chargedparticle interacts in the tube gas. (c) Increasing the Z number of the wall material decreaseshe probability a t low-ene
Cornell - ECE - 4130
8. If the energy resolution of a NaI(TI) detector is 8%, what is the FWHM of the full-energy peak for a 137Cssource?Solution:NOTE: Chapter 8 does not define resolution although it is discussed requently. f Consequently, this question is somewhatbeyond t
Cornell - ECE - 4130
PROBLEMS1. In an infinite homogeneous edium containing a uniformly distributed radionum clide source emitting radiation energy at a rate of E MeV cm-3 S-1, energy must be absorbed uniformly by the medium at the same rate. Consider an infinite air medium
Cornell - ECE - 4130
9-2Radiation Doses and HazardsChap. 92. A 137Cs ource has an activity of 700jLCi. A gamma photon from 137mBa ith s w energy 0.662 MeV is emitted with a frequencyof 0.845 per decayof 137CS. t A a distance of 2 meters from the source, what is (a) the exp