To save content items to your account,
please confirm that you agree to abide by our usage policies.
If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account.
Find out more about saving content to .
To save content items to your Kindle, first ensure no-reply@cambridge.org
is added to your Approved Personal Document E-mail List under your Personal Document Settings
on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part
of your Kindle email address below.
Find out more about saving to your Kindle.
Note you can select to save to either the @free.kindle.com or @kindle.com variations.
‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi.
‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.
Java is a serious language suitable for demanding applications in science and engineering. Really, we promise! Java offers a lot more than just those little applets in your Web browser.
In JavaTech we focus on how Java can perform useful tasks in technical computing. These tasks might involve an animated simulation to demonstrate a scientific principle, a graphical user interface for an existing C or C++ computational engine, a distributed computing project, controlling and monitoring an experiment remotely via the Internet, or programming an embedded Java hardware processor in a device such as a remote sensor. While other Java books intended for the science and engineering audience concentrate primarily on numerical programming, we take a much broader approach and examine ways that Java can benefit programmers working on many different types of technical applications.
This project grew out of a course given by two of us (C.S.L. and Th.L.) at the Royal Institute of Technology in Stockholm, Sweden in which students of diverse backgrounds followed the class via the Internet. For this type of distance learning situation, we developed hypertext instructional material for delivery via the Web browser that allows for a high degree of self-study. This approach works especially well with Java since many of the demonstration programs run as applets within the browser.
This book provides a handy print companion to this hypertext course, which is available online at www.javatechbook.com.
CORBA is an acronym for Common Object Request Broker Architecture, a name that does not really convey to the new user the purpose of the technology. Most people just think of CORBA as the name of an important distributed object technology without really considering what the acronym stands for. For Java developers, RMI is generally the preferred distributed object architecture – especially when it is known that both client and server will be written in Java. However, CORBA has the advantage that it is language independent, meaning that non-Java clients can make CORBA calls to a CORBA server.
CORBA is a standard, so there is an official specification of that standard. The standard is maintained by the Object Management Group, a consortium of over 800 members. See the www.omg.org home page for voluminous information on CORBA and other technologies developed by the OMG. CORBA is also a very broad technology that covers much more than we introduce here. Our point is to demonstrate how CORBA technology can be used to implement straightforward distributed computing solutions analogous to the RMI example developed in Chapter 18.
A typical scientific application, such as the simulation described in Chapters 16 and 17, generally has only a few users. The developer writes both the client and server and, if developing in Java, probably uses RMI.
The term Java refers to more than just a computer language like C or Pascal. Java encompasses several distinct components:
A high-level language – Java is an object-oriented language whose source code at a glance looks very similar to C and C++ but is unique in many ways.
Java bytecode – A compiler transforms the Java language source code to files of binary instructions and data called bytecode that run in the Java Virtual Machine.
Java Virtual Machine (JVM) – A JVM program takes bytecode as input and interprets the instructions just as if it were a physical processor executing machine code. (We discuss actual hardware implementations of the Java interpreter in Chapter 24.)
Sun Microsystems owns the Java trademark (see the next section on the history of Java) and provides a set of programming tools and class libraries in bundles called Java Software Development Kits (SDKs). The tools include javac, which compiles Java source code into bytecode, and java, the executable program that creates a JVM that executes the bytecode. Sun provides SDKs for Windows, Linux, and Solaris. Other vendors provide SDKs for their own platforms (IBM AIX and Apple Mac OS X, for example). Sun also provides a runtime bundle with just the JVM and a few tools for users who want to run Java programs on their machines but have no intention of creating Java programs. This runtime bundle is called the Java Runtime Environment (JRE).
This book is targeted primarily toward engineers and engineering students of advanced standing (sophomores, seniors and graduate students). Familiarity with a computer language is required; knowledge of basic engineering subjects is useful, but not essential.
The text attempts to place emphasis on numerical methods, not programming. Most engineers are not programmers, but problem solvers. They want to know what methods can be applied to a given problem, what are their strengths and pitfalls and how to implement them. Engineers are not expected to write computer code for basic tasks from scratch; they are more likely to utilize functions and subroutines that have been already written and tested. Thus programming by engineers is largely confined to assembling existing pieces of code into a coherent package that solves the problem at hand.
The “piece” of code is usually a function that implements a specific task. For the user the details of the code are unimportant. What matters is the interface (what goes in and what comes out) and an understanding of the method on which the algorithm is based. Since no numerical algorithm is infallible, the importance of understanding the underlying method cannot be overemphasized; it is, in fact, the rationale behind learning numerical methods.
This book attempts to conform to the views outlined above. Each numerical method is explained in detail and its shortcomings are pointed out. The examples that follow individual topics fall into two categories: hand computations that illustrate the inner workings of the method, and small programs that show how the computer code is utilized in solving a problem.
This chapter is not intended to be a comprehensive manual of MATLAB®. Our sole aim is to provide sufficient information to give you a good start. If you are familiar with another computer language, and we assume that you are, it is not difficult to pick up the rest as you go.
MATLAB is a high-level computer language for scientific computing and data visualization built around an interactive programming environment. It is becoming the premiere platform for scientific computing at educational institutions and research establishments. The great advantage of an interactive system is that programs can be tested and debugged quickly, allowing the user to concentrate more on the principles behind the program and less on programming itself. Since there is no need to compile, link and execute after each correction, MATLAB programs can be developed in much shorter time than equivalent FORTRAN or C programs. On the negative side, MATLAB does not produce stand-alone applications—the programs can be run only on computers that have MATLAB installed.
MATLAB has other advantages over mainstream languages that contribute to rapid program development:
MATLAB contains a large number of functions that access proven numerical libraries, such as LINPACK and EISPACK. This means that many common tasks (e.g., solution of simultaneous equations) can be accomplished with a single function call.
There is extensive graphics support that allows the results of computations to be plotted with a few statements.
All numerical objects are treated as double-precision arrays. Thus there is no need to declare data types and carry out type conversions.