Professional Documents
Culture Documents
Introducing Mathematica: Click To Edit Master Subtitle Style
Introducing Mathematica: Click To Edit Master Subtitle Style
Functional Programming & Data Structures Click to edit Master subtitle style
5/18/12
Required Tools
Next few weeks, we will use Mathematica as an example of a functional programming language. Along the way, we shall be introduced to exact computations and Symbolic Algebra. We will also be able to use the numerical and graphical capabilities to do engineering computations. Its rich compendium of mathematical functions and algorithms will be demonstrated. 5/18/12
The following will be needed A fully licensed copy of Mathematica 7 or 8. A pdf copy of the Mathematica Book, version 5. A copy of the Mathematica Cookbook With these, it should be a straightforward matter to practice the required examples before coming to class. That way, you will be able to ask more useful questions and gain more for the time we spend together in class. Acquaint yourself with the Mathematica Documentation system installed with your 5/18/12 copy of the software. In most cases, you can
Notational Conventions
5/18/12
List Processing
Lists are created using braces and nested braces. They can be indexed into via double brackets. For example: We create a double list here and call it M. We then ask Mathematica to display it in MatrixForm. We can pick the second element in this case also a list. We look at the first element of this sub-list and we obtain 3. Finally, we ask for the determinant of the 5/18/12 matrix.
Simultaneous Equations
As you can see in the above equations, they may be linear or nonlinear, Mathematica will solve them if their solutions can be found. 5/18/12 Note the (==)
Built-In functions
The list of built-in functions is quite impressive. They contain ALL elementary functions and most special functions. It is difficult to imagine an important mathematical function that is left out. Even if this happens, it is possible to connect Mathematica to your C-Sharp code and define new functions. More about that later.
5/18/12
Numerical Types
The following numerical types are supported in Mathematica: Integers, Real, Rational and Complex. The Mathematica function Head[] can tell you the underlying structure of the result of any expression as you can see here. Exact results are displayed in their entirety when possible or symbolically when full display would be impossible due to the infinity of the exact representation. 5/18/12
Limits Example
You always knew this didnt you? That both sine as well as the tangent of x tend to x as x approaches zero. You can use a simple Mathematica plot to settle this matter for any doubter as shown!
5/18/12
5/18/12
Notational Variety
There can be a variety in the ways you can supply a computation request to Mathematica. Some of these are shown with simple examples. The infix is the way of most operators but not limited to them. o Functional notation: Divide [Sin[x],x], N[Sqrt[2]] o Infix notation: Sin[x]/x o Postfix notation: Sqrt[2]//N 5/18/12
Interval Arithmetic
5/18/12
Infix Apply
The equivalency of the two types of interval calculation above can be further explained as follows: Apply replaces the head of a list with a new head in this case, the Subtract. In the above form, the Apply command was used in its prefix format.
5/18/12
I can seek assistance by using the double question mark: ??Integrate prompts the system to give assistance on the Integrate[] function. I can also ask Mathematica to show me how to use the Sin[] function in the Prefix format by
5/18/12
Graphics Project
Conclude this introductory class with a simple graphical project by a student three years ago. Let this stimulate your mind to what you can do in your course project. Mathematica can be used to create useful products by students who are smart enough to go beyond the requirements of the simple examples and class practice.
5/18/12