Computers in Physics

5 downloads 763 Views 2MB Size Report
Jan 4, 2016 - language and give some programming examples ... been developing programs for physics instruction ... learn, C, C++ before reading this book.
Computers in Physics Java in a Nutshell; Exploring JAVA David Flanagan, Patrick Niemeyer, Joshua Peck, Roger Sipson, Susan McKay, and Wolfgang Christian Citation: Computers in Physics 11, 46 (1997); doi: 10.1063/1.4822513 View online: http://dx.doi.org/10.1063/1.4822513 View Table of Contents: http://scitation.aip.org/content/aip/journal/cip/11/1?ver=pdfcov Published by the AIP Publishing Articles you may be interested in Elementary Particle Physics in a Nutshell. Am. J. Phys. 80, 355 (2012); 10.1119/1.3683255 Quantum Mechanics in a Nutshell Am. J. Phys. 77, 959 (2009); 10.1119/1.3147682 Planetary nebulae dynamics in a nutshell AIP Conf. Proc. 804, 68 (2005); 10.1063/1.2146234 That was LEAP 05! or Antiproton Physics in a Nutshell AIP Conf. Proc. 796, 441 (2005); 10.1063/1.2130208 Quantum Field Theory in a Nutshell Phys. Today 57, 88 (2004); 10.1063/1.1752429

This article is copyrighted as indicated in the article. Reuse of AIP content is subject to the terms at: http://scitationnew.aip.org/termsconditions. Downloaded to IP: 54.210.20.124 On: Mon, 04 Jan 2016 15:06:03

:BR

Roy Nicolaides and Nocl Walkin!:,rton, Cambridge University Press, ew York , 1996; ISB 0-52156230-9; 446 pp., cloth, 39.95 .

Fortran 9S

rithm. For a particular example, Acton shows how successive refinements of the problem statement can reduce a multidimensional root-finding to a one-dimensional problem. While most problems are not likely to be this compliant, the demonstration reminds readers of the value in searching for opportunities for simplification. Acton's book is a valuable adjunct to a text on numerical analysis. It fills in the important gaps between the mere "how-to" and the art of elegant and dependable numerical results .•

Wi lhelm Gehrke, Springer, New York, 1996; ISBN 3-540-76062-8; 360 pp., paper 44.95.

Java in a Nutshell

Would-Be Worlds

Object Technology for Scientific Computing

Books Received Annual Reviews of Computational Physics IV Dietrich Stauffer, ed., World Scientific, Singapore, 1996; JSBN 98J-022728-0; 395 pp., cloth, $84.00; also ISBN 981-02-2753-1; paper, $48.00.

Maple: AComprehensive Introduction

Modeling Nature: Cellular Automata Simulations with Mathematica Richard J. Gaylord and Kazume Nishidate, Springer, New York, 1996; ISBN 0-387-94620-9; 260 pp., paper and diskette, $39.95.

John L. Casti , Wiley, ew York, 1996; ISB 0-471-J2308-0; 242 pp. , cloth, $24.95.

Paul F. Dubois, Prentice Hall, Upper Saddle River, NJ , 1996; ISBN 0-13 267808-X; 280 pp., paper, $30.00.

Interactive Mechanics

Numerical Algorithms with Fortran

Al ejandro L. Garcia, Prentice Hall, Upper Saddle River, NJ , 1996; ISBN 0-13-l92477-X; 100 pp., paper and di kette, $22.33.

Understanding Molecular Simulation: From Algorithms to Applications Daan Frenkel and Berend Smit, Academic Press, San Diego, CA, 1996; ISB 0-12-267370-0; 443 pp., cloth, $65.00.

High Performance Computing in Fluid Dynamics P. Wc eling, ed., Kluwer Academic Publisher , Dordrecht, The Netherlands, 1996; ISBN 0-79-234063-9 ; 278 pp., cloth, 124.00.

significant digits in numerical computation. Acton suggests that when you find yourself wondering how to get q~ad:u­ pie precision, you should be rethmkmg the formulation of your problem. Indeed, he adds, "Equally important, the search for these troubles usually leads directly to weak places in your algorithm." Acton points out that while there are no simple cookbook procedures to follow, a sensitivity to cases of close

Gisela Engln-Mi.illges and Frank Uhlig, Springer, New York, 1996; ISBN 3-540-60529-0; 602 pp., cloth and CD-ROM, $49.95.

Programming Perl, Second Edition Larry Wall, Tom Christiansen, and Randal L. Schwartz, O'Reilly & Asociatcs, Sebasapol, CA, 1996; ISBN 1-56592-149-6; 646 pp., paper, $39.95.

JavaScript: The Definitive Guide David Flanagan, O'Reilly & Associ ates, Sebastapol, CA, 1996; ISBN 156592-193-3; 454 pp., paper, $29.95.

roots and nearly tangent functions is often a warning to be careful. Again, the use of a sketch can help to alert the analyst to potential problems. The first of the remaining three chapters focuses on problems with quadrature and how to deal with integrations in which the integrand may have a vertical asymptote. The second considers the use of recurrence relations. The book concludes with a short discussion about how to choose and tune an algo-

David Flanagan O'Reilly & Associates, Sebastopol, CA, 1996; ISBN 1-56592-183-6; 438 pp., paper, $14.95.

Exploring JA VA Patrick Niemeyer and Joshua Peck O'Reilly & Associates, Sebastopol, CA, 1996; ISBN 1-56592-184-4; 407 pp., paper, $24.95.

Reviewed by Roger Sipson ava in a Nutshell by David Flanagan was one of the first books available J on Java and was thus especially eagerly received. (See sidebar, "What is Java?") At $14.95 it is clearly a bargain. The book is divided into five parts. The first two parts, which constitute a little less than half the book, introduce the Java language and give some programming examples. The last three parts are a reference for the Java language and its Application Programming Interface (API). While Java is not a subset of C++, its syntax and object-oriented concepts are drawn in large measure from that language. This means that an assumption of familiarity with C++ makes a much more compact introduction to Roger Sipson is professor ofphysics at Moorhead State University, Moorhead, MN 56563. He has been developing programs for physics instruction for the last 16 years and is currently working on a 32-bit Windows version of his modelingprogram Dynamic Analyzer (published by Physics Academic Software). E-mail: [email protected]. msus.edu; World Wide Web: http://physweb. moorhead. msus. edu.

This article is copyrighted as indicated in the article. Reuse of AIP content is subject to the terms at: http://scitationnew.aip.org/termsconditions. Downloaded to IP: 54.210.20.124 On: Mon, 04 Jan 2016 15:06:03

,'",,,,,!,',WI/il/ll

" ..,.tI1o!/IIIt

",~,~

Java possible. The author himself suggests that this book is not a good choice for those people who are not familiar with C++ and suggests that they seek another book to get started. This is good advice. Given this assumed audience, the author starts by introducing the major features of Java and the design philosophy behind it. He then discusses the differences between C or C++ and Java. This is valuable preparation for the rest of the book since it allows C++ programmers to leverage their knowledge where it works and be forewarned when syntactically similar constructs in Java have different consequences. The next section describes the features of objects in Java. Emphasis is on the Java features that are different or not in C++, like finalizers, garbage collection, and interfaces. The section on programming with Java starts with the usual "Hello World" application, moves through the Java Abstract Windowing Toolkit, and ends with examples showing how to do synchronized, multithreaded programming. It does all this in fewer than 100 pages. Even though Java is simpler than C++, it is a rich language, and this section could be longer. Nonetheless, the examples that are included are interesting and do illustrate many aspects of Java programming, up to developing your own (very simple) TCP/IP client and server. The language-reference section of the book will be of interest to those who want to peruse the Java API "off-line." Such readers include those who want to learn about the language but are not currently using it. There is little here that is not available from the World Wide Web. An even more important consideration is that powerful Java development environments like Cafe from Symantec and Visual J++ from Microsoft now provide built-in hyperlinked documentation on the Java API. If you have or intend to acquire a Java development environment, you may find this section of little value. Exploring JAVA by Patrick Niemeyer and Joshua Peck includes no API reference section. It does gives a much more detailed discussion ofthe Java language and includes more programming examples. It is somewhat more appro-

What is Java? Java i a new programming language developed by Sun Microsy 'tem . It i currently a "hot topic," because it ha features that make it wel l uited to the World Wide Web. The 'e feature include platform independence and database connectivity. Java applications assume a lowest-common-denominator user interface, but they run on Unix, Windows, and Apple computers. Java applet are even more restrictive and cannot access local resources such as the hard drive or printer. Applets are designed to be downloaded from an Internet server and run inside a client computer's Web browser computer, not on the server. Interest in Java is so intense that many lines of Java code were written by people using beta versions of the compi ler and downloadable documentation before these, or any other, books on Java appeared.

priate for readers who are not familiar with C++, but the author himself recommends that the reader either know, or learn, C, C++ before reading this book. Someone who is inexperienced with at least C programming would find the book very difficult. The book begins with a brief overview of the Java language. This is followed with a hands-on introduction to Java programming, which only requires that you have a Java-enabled browser and the compiler available from Sun. It starts with a simple "Hello Web" and goes through four iterations of this program, adding and explaining language features. This section is a useful orientation to Java programming. The rest of the book is dedicated to a description of the Java language in bottom-to-top order. The treatment is quite complete. The discussion of Exceptions is helpful and provides good reading for C++ programmers who do not use this feature of their own language. Language features that are not in C++ do get special attention. Threads get extensive treatment, with example code. There is detailed discussion of Internet-related topics such as using sockets to get and send data and writing custom servers, content handlers, and protocol handlers. These sections are clearly written, have good examples, and show how well the Java language is adapted for Internet programming. The graphical-user-interface (GUI) section appropriately comes near the

end of the book, following a thorough introduction to the language. The examples show how easy it is to use GUI components like buttons and scrollbars in Java. The author does explain how Java limits access to properties of the peer GUI objects that may be available in the native operating system. These books are good reading not only for those interested in Java programming but also for C++ programmers. Threads, for example, are not a part of C++, but they are a part of many operating systems. Native support for threads in Java helps to make the concept clearer. The fact that the Java GUI is much simpler than the native GUIs available under, for example, Windows may help someone getting started with Microsoft Foundation Class programming to see what features are really basic. Both the above books contain working example code, which can be compiled using free development tools available from http://java.sun.com. Unless you already have one of the fancy Java development environments that are now available, you should download these tools and at least compile some of the examples. Professional programmers should investigate the Java Series of books published by SunSoft Press. Core Java by Gary Cornell and Cay S. Horstmann is an authoritative introduction to Java for C programmers and includes a CD with sample code, the complete Sun Java Development Kit, and Symantec Cafe Lite .•

IN PHYSICS, VOL. II , NO. I, JAN/FEB 1997 47 This article is copyrighted as indicated in the article. Reuse of AIP content is subject to the terms at:COMPUTERS http://scitationnew.aip.org/termsconditions. Downloaded to IP: 54.210.20.124 On: Mon, 04 Jan 2016 15:06:03