This chapter lists and describes many of Mathcad’s built-in functions. Functions associated with Mathcad’s statistical and data analysis features are described in Chapter 14, “Statistical Functions.” Functions used for working with vectors are described in Chapter 10, “Vectors and Matrices.” And for functions to solve differential equations, see Chapter 16, “Solving Differential Equations.”
The following sections make up this chapter:
Inserting built-in functions
Using the Insert Function dialog box to see all available functions and get help on what they do.
Basic trigonometric, exponential, hyperbolic, and Bessel functions.
truncation and round-off functions
Functions which extract something from a number, including the real or imaginary part, the mantissa, or the modulo function.
Discrete transform functions
Functions for discrete complex Fourier transforms and wavelet transforms.
Functions to sort elements of vectors and matrices.
Piecewise continuous functions Usingpiecewise continuous functions to perform conditional branching and iteration.
Functions for manipulating strings, converting strings to and from numbers and vectors, and creating customized error messages.
Inserting built-in functions
This section describes how to see a list of all functions available to you together with a brief description of each function. Mathcad’s set of built-in functions can change depending on whether you’ve installed additional function packs or whether you’ve written your own built-in functions. These functions can come from four sources:
Built-in Mathcad functions
This is the core set of functions that come with Mathcad. These functions are all documented here and in other chapters of this User’s Guide.
Mathcad Function Packs and Electronic Books
A Function Pack consists of a collection of advanced functions geared to a particular area of application. Documentation for these functions comes with the Function Pack itself. In addition, orne but not all Electronic Books come with additional functions. Documentation for any of these functions is in the Electronic Book itself. The list of available Function Packs and Electronic Books is constantly expanding and includes collections for image processing, numerical analysis and advanced statistical analysis. To find out more about these products, contact MathSoft or your local distributor.
Built-in functions you write yourself
If you have Mathcad Professional and a supported 32-bit C compiler, you can write .” your own built-in functions. For details see Appendix C, “Creating a User DLL.
To see the list of built-in functions available with your copy of Mathcad, choose Function from the Insert menu. Although built-in function names are not font sensitive, they are case sensitive. You must type the names of built-in functions exactly as shown in the following tables: uppercase, lowercase, or mixed, as indicated. Alternatively, you can use the Insert Function dialog box to insert a function together with placeholders for its arguments. To do so:
• Click in a blank area of your document or on a placeholder.
• Choose Function from the Insert menu. Mathcad opens the Insert Function dialog box shown on the following page.
• Double-click on the function you want to insert from the left-hand scrolling list, or click the “Insert” button.
• Close the dialog box if you no longer need it by clicking the “Cancel” button.
The scrolling list at the top of the Insert Function dialog box shows all of Mathcad’s built-in functions along with their arguments. The box below gives a brief description of the currently selected function.
To apply a function to an expression you have already entered, place the expression between the two editing lines and follow the steps given on the preceding page.
Tps section describes Mathcad’s trigonometric, hyperbolic, and exponential functions together with all their inverses. It also describes Mathcad’s built-in cylindrical Bessel functions.
Trigonometric functions and their inverses
Mathcad’s trig functions and their inverses accept any scalar argument: real, complex, or imaginary. They also return complex numbers wherever appropriate. Complex arguments and results are computed using the following identities
If you want to apply one of these functions to every element of a vector or matrix, use the vectorize operator as described in the section “Doing calculations in parallel” in
Note that all of these trig functions expect their arguments in radians. To pass degrees, use the built-in unit deg. For example, to evaluate the sine of 45 degrees, type sin (45*deg).
Keep in mind that because of round-off errors inherent in a computer, Mathcad may return a very large number where you would ordinarily expect a singularity. In general, you should be cautious whenever you encounter any such singularity.
The inverse trigonometric functions below all return an angle in radians between 0 and 2 . n . To convert this result into degrees, you can either divide the result by the builtin unit deg or type deg in the units placeholder as described in the section “Displaying units of results”
Because of round off error inherent in computers, you may find that and of a very large number returns .As a general rule, it’s best to avoid numerical computations near such singularities
The hyperbolic functions sinh and cosh are given by:
Both these functions will accept and return complex arguments. As the above identities indicate, when you use complex arguments, the hyperbolic functions behave very much like trigonometric functions. In fact:
Log and exponential functions
Mathcad’s exponential and logarithmic functions will accept and return complex arguments. Complex arguments to the exponential are given by: .
In general, a complex argument to the natural log function returns:
Mathcad’s In function returns the value corresponding to n = O. Namely:
This is called the principal branch of the natural log function. Figure 13-1 illustrates some of the basic properties of log functions.
These functions typically arise as solutions to the wave equation subject to cylindrical boundary conditions.
Bessel functions of the first kind and second kind, J n(x) and Yn(x) , are solutions to the following differential equation:
The following functions arise in a wide variety of problems
Returns the value of the Euler gamma function at z. For real z, the values of this function coincide with the following integral
The error function arises frequently in statistics. You can also use it to define the complementary error function as: