Using Mathematica (continued)
Defining Functions in Mathematica
If you must perform repeated calculations in Mathematica, it is useful to
define a function. A function is an equation that can take several numbers
and calculate a result based on those numbers. In algebraic form, we
would define a function as:
f(x1,x2,x3,x4) = some function
where x1, x2, x3, and x4 are variables.
In Mathematica, we can do the same thing so that we can feed a function a
set of variables, and it will run those variables through the function and
return the result. For example, let's say that our professor has provided
us with a function RadToDeg[]which converts Radians to Degrees. If we
typeRadToDeg[PI/2], the function will return 90 degrees, since PI/2 = 90
degrees. If we typed RadToDeg[PI], the function will return 180 degrees,
since PI radians = 180 degrees. The above function is defined by using
the define function operator in Mathematica, :=. The definition of the
above function is:
RadToDeg[rads_] := rads * 360 / (2*PI);
Notice two important features of defining functions. First, you must
follow the name of the variable as it appears in the function definition
with an underscore. Also, you must follow the function name and variable
definition (theRadToDeg[rads_] part) by the := operator. Once you have
typed this command, whenever you type the RadToDeg[] function with a number
in the brackets, it will return the degree value of the radian value
entered in the bracket.
You can use as many different variables in a function definition as you
like. In this way, you can define a complex function in Mathematica once
and then never have to worry about typing the equation again-all you need
to do is give the equation the variables, and it will run the numbers
through the function and return a result.
Some important things to keep in mind about function definitions are 1)
the variable name you define in the brackets (the rads_ in the above
example) must be the exactly the same in the function definition (minus the
underscore), 2) make sure that your mathmatical expression has
parentheses, etc. in the proper place.
Integrating in Mathematica<br>
Mathematica can integrate functions both analytically and numerically. To
integrate a function f(x), use the Integrate[] command in Mathematica.
The format of the command is Integrate[f, x]. This will integrate f with
respect to x. If you give the Integrate function the following:
Integrate[f,x], the function will return the analytical (algebraic)
integral of the function f. If you give the Integrate[] function the
following: Integrate[f,{x,xmin,xmax}], Mathematica will return the
numerical integral of the function f between xmin and xmax. This will be
an important function in the lab assignment...
Computing Square Roots, Cube Roots, etc.
If you think about it, the square root of a number is the number raised to
the 1/2. Likewise, the cube root is the number raised to the 1/3. In this
way, we can represent a root of a number as an exponent. In Mathematica,
we can calculate the roots of a number by representing them as exponents
and then raising the number to a fractional exponent. For example, if we
wanted to find the cube root of 8 in Mathematica, we would type
8^(1/3).
Rock Uplift, Surface Uplift, and Exhumation
An important problem in geology is the calculation of uplift rate.
However, many methods which measure uplift rates measure the rate of uplift
of a rock relative to the earth's surface. Geomorphic processes may
change the elevation of the surface (the surface elevation is different on
the East Coast and Tibet is quite different), thus our measures of uplift
may not be the uplift we are after. For example, if the surface is moving
up at the same speed the rock is being uplifted, the uplift relative to the
surface is zero. This is not the uplift rate that we are after.
For this reason, we define three types of uplift shown in Figure 1. The
exhumation (E) is the distance between the earth's surface and the rock.
The surface uplift (SU) is the elevation of the surface is the elevation of
the earth's surface relative to a stationary datum. The rock uplift (RO)
if the elevation the rock is at relative to the stationary datum. This is
usually the uplift that we are after.
Figure 1: Diagram showing differences between Rock uplift, Exhumation, and
Surface Uplift. In the diagram, RO is Rock Uplift, E is Exhumation, and
SU is Surface Uplift.
Pages maintained by
Prof. Ramón Arrowsmith
Pages last modified on Wed Nov 26 1997.