Mathematica for Scientists and Engineers

Bahder T.B.

A casual look at the history of science and engineering reveals an increasing trend toward mathematical analysis and numerical computation, the latter being accelerated by the advent of computers. Computers initially provided only the capability to do arithmetic quickly, using machine-level language. As computers became faster, more sophisticated compiled languages were developed (e.g., FORTRAN, C, and C++). However, these languages are best suited for numerical calculations and development of large software programs and do not directly support mathematical calculations as carried out by scientists and engineers. This book is about Mathematica, a modern computer language specifically designed for the needs of scientists and engineers. Mathematica is designed to handle mathematical calculations as well as those numerical calculations traditionally carried out in FORTRAN. Most special functions of mathematical physics and matrix functions are built into Mathematica. In addition, Mathematica has an extensive graphics capability for visualizing results of calculations. In fact, MathematicaÕs popularity over other symbolic languages rests in its excellent graphics capability. This book represents my Mathematica experience as a physicist and as a teacher. As a physicist, I was initially drawn to Mathematica because I was unable to carry out certain calculations in the field of solid state physics, due to the magnitude of the algebra involved. Since then, I discovered that Mathematica can be profitably used in most research problems and will significantly increase productivity by decreasing the time needed for analytical calculations, computer programming, and data analysis. As a teacher, I taught Mathematica to scientists and engineers in a workshop setting at George Mason University and the U.S. Army Research Laboratory. Mathematica as a language is different from FORTRAN or C, in part because of MathematicaÕs ability to handle mathematical expressions as well as numbers, and also because Mathematica is an interpretative language. The biggest challenge to users is understanding the subtleties associated with evaluation of Mathematica expressions. For example, new users often have problems with understanding why a certain Mathematica evaluation seems to Òrun forever.Ó This is often a result of the evaluation process and the code can be rewritten to run in a reasonable time. Another important point is that Mathematica is an interpretive language. As a consequence, a calculation takes longer to run in Mathematica than in a compiled language such as FORTRAN. The tradeoff is that writing the program in Mathematica requires a small fraction of the time needed to write the same program in FORTRAN or C. In this book, practical alternatives that are available to deal with long running times, including connecting to external FORTRAN or C programs using MathLink are discussed. Another common problem inevitably confronting users is the finite memory of their computer. While no book currently available discusses these practical issues, getting a grasp of these issues is absolutely essential for using Mathematica effectively in scientific and engineering applications. In this book I address evaluation and memory issues in the context of significant examples that are of interest to scientists and engineers. Studying the solution of significant problems is the best way to learn Mathematica. Each of the examples in this book consists of many different commands. Mathematica is a large software system. (Executing the command Length[ Names[ ÒSystemÕ*] ] reveals that there are 1133 built-in commands.) This book explains a large subset of commands needed to develop a conceptual understanding of the Mathematica system. When a command is used without explanation, the definition can be found in the manual, Mathematica: A System for Doing Mathematics by Computer, by Stephen Wolfram, which is the fundamental reference for Mathematica.

Contents:

  1. The Basic Building Blocks

    Starting Mathematica, Arithmetic Operations, Assigning Values to Symbols, Internal Representation, Functional Programming, Patterns, Replacement Rules, Getting Information on Commands and Variables

  2. Working With Lists

    The Listable Attribute of Built-In Functions, Accessing Parts of Lists, Creating Lists

  3. Graphics

    Graphics Overview, Plotting Data, Graphics Programming, Animating Graphics: Mathematica Movies, Sound

  4. Scoping Constructs

    Local Variables, Performance Considerations,

  5. Functions

    Defining Functions, Evaluation of Function Arguments, Functions that Call Other Functions, Delayed vs. Immediate Assignment, Splicing-in Function Arguments, Functions That Remember Their Values, Pure Functions, Attributes, Values Associated with Symbols, Scope in Function Definitions, Complex Variables, Compiled Functions, Piecewise Continuous Functions

  6. Symbolic Calculation

    Operations with Polynomials, Rational Expressions, Differentiation, Integration, Power Series, Equations, Simplifying Algebraic Expressions Using Patterns, Working with Units

  7. Numerical Calculations

    Types of Numbers, Precision and Accuracy, Numerical Functions, Assigning Numerical Values to Symbols, Protecting Function Arguments From N()

  8. Vector, Matrices And Tensors

    Linear Algebra, Vector Field Theory, Cartesian Tensors and Spinors, General Tensors: Math Tensor

  9. Differential Equations

    Automatic Symbolic Solution, Variation of Parameters, Solution by Laplace Transforms, Numerical Solution, Perturbations Solution

  10. Boundary Value Problems

    Analytic Solution, Shooting Methods, Finite Difference Method

  11. Input And Output

    Output Formats, Input and Output of Expressions: Path and Current Directory, Input and Output of Graphics and Large Expressions, Reading and Writing Files, Formatting Numbers, Writing Numbers to a File in "e" Format, Writing Lists to a File as Arrays, Working with Binary Files, Working with Files and Directories, Strings as Streams, Input from the Keyboard, Defining Print Formats

  12. Running Mathematica

    Various Ways to Run Mathematica, Running from a Command Line, Reading Expressions from a File, Running Mathematica in Background, Logging Your Session

  13. Mathematica Packages

    Using Packages, Contexts and Content Search Path, Motivation for Packages, Writing a Package, A Context Scratch Pad, Practical Programming

  14. Introduction To Mathlink Communication

    Calling C from Mathematica, Calling FORTRAN from Mathematica,


Goto
Books
CAIN Home page

webmaster@can.nl
Last Update: July 8, 1997.