29::196 Computational Physics: Assignments  for week 10

GN: N. Giordano and H. Nakanishi, Computational Physics,  second edition, Pearson Prentice Hall, 2006
DY: D. Yang, C++ and Object Oriented Numeric Computing,  Springer, 2001
ZO: R. Zimmerman and F. Olness, Mathematica for Physics, Springer,  Second Edition 2001.
NR: W. Press, S. Teukolsky, W. Vetterling and B. Flannery, Numerical Recipes in C++,  Cambridge,  2003.



Readings: GN chapter 7; DY chapter 5.

Tasks:

1)  Display "lines" in RGB and CMY going from black to white (with Mathematica)
2)  Calculate  ((L+s)^2-L^2-s^2)/(2L) with L large and s small for various types; mix types; use implicit and explicit conversions
3)  Write a function ran(....) that returns integers as in NR p. 278 but with long long integers, which passes the argument by values, pointers and references


Problem set 7 (due 4/23):

1) Using NR 15.2,  write a C++ code that inputs the file suscept08.d
with x: first column, y: 4th column, sigma: 5th column and outputs:

Ignoring standard deviations
      a  =   -7.622239       uncertainty:  0.517549
      b  =    3.508846       uncertainty:  0.224039
      chi-squared:        0.000703
      goodness-of-fit:    1.000000

Including standard deviations
      a  =   -7.369780       uncertainty:  0.560741
      b  =    3.401514       uncertainty:  0.242614
      chi-squared:        4.493386
      goodness-of-fit:    0.480769

Discuss the quality of the fit.
The first part  can be tested with linfit.nb

2)  Write a MC code for the the 1 dimensional Ising model and check the susceptibility and average
energy with exact results (see notes). The Metroplolis method will be discussed next week.

3) GN 8.3

4)  DY 5.10.2



Final projects:


Proposals due 4/16 (revtex format http://authors.aps.org/revtex4/  ;  Template:  project.tex    uses  clover.eps)

Codes due 4/28    

Presentations may start 4/29

Summary due 5/15