Basics Mathcad
Basics Mathcad
The Basics
This chapter describes everything you need to get started working with
Mathcad. The following sections make up this chapter:
First principles
Mathcad's design and interface.
What you can do with Mathcad
Starting Mathcad.
Working with windows
How to scroll a window, how to move and resize windows, and how to open
several worksheets at once.
A simple calculation
Calculating with Mathcad.
Definitions and variables
Creating simple Mathcad equations.
Entering text
Adding notes and labels to a worksheet.
Regions and menus
How equations, text, and plots make up a worksheet; Mathcad's menu com-
mands.
Iterative calculations
Using range variables to repeat an equation for several values.
Graphs
Building a simple two-dimensional plot.
Saving, printing, and quitting
The Save, Print, and Exit commands from the File menu.
17
First principles
Mathcad looks simple, and it is. It was created according to basic design principles to
make it powerful, flexible, and easy to use. In Mathcad:
■ Everything appears in familiar math notation. If there's a standard mathematical
way to show an equation, operation, or graph, Mathcad uses it.
■ What you see is what you get. There is no hidden information; everything appears
on the screen. When you print, the output looks just like the screen display.
■ To create simple expressions, just type them. Mathcad uses the standard keys for
standard mathematical operations.
■ Typing aids make equations easier to enter. There are palettes for most mathe-
matical operators and symbols.
■ Fill in the blanks. Mathcad guides you through the creation of plots, integrals, and
other mathematical expressions by laying down the framework and letting you fill
in the blanks.
■ Calculation features are modular. If you don't want to use a feature—like
complex numbers, units, or matrices—you can just pretend it isn't there.
■ The numerical algorithms are robust, standard, and predictable. Mathcad's
numerical algorithms for features like integrals, matrix inversion, and equation
solving are reliable, standard methods.
■ OLE support. Mathcad is an OLE2 application, providing drag and drop support
of Mathcad objects into applications like Microsoft Word, in-place activation of
Mathcad objects in client applications, and enhanced support for embedded OLE
objects in Mathcad worksheets.
■ Exchange data with other applications. Mathcad gives you easy-to-use tools to
exchange data with spreadsheets, graphing packages, and other calculation appli-
cations.
■ On-line help. Pressing [F1] brings up an extensive on-line help system. Click on
error messages, operators and functions and press [F1] to display the relevant help
screen. There's no need to search for the topic you're interested in. The User's Guide
includes more detail on all the features, with step-by-step instructions and illustra-
tive examples. At the back of the User's Guide is a complete cross-referenced index.
■ Collaboration features. If you’re connected to an electronic mail system compat-
ible with Microsoft Mail, mail worksheets to colleagues from right within Mathcad.
And you have access to MathSoft’s Collaboratory server, a unique Web-based
resource where you can exchange text messages, upload and download Mathcad
files, and connect to a community of Mathcad users.
■ Resource Center. A collection of Mathcad worksheets in an interactive, searchable
Electronic Book, with links to resources on the World Wide Web. The Resource
18 Chapter 1 The Basics
Center includes an Overview, Tutorial, Reference Tables, QuickSheets—prefab
working templates for completing common mathematical tasks, ready for custom-
ization and dragging into your own worksheets—and Practical Statistics, an over-
view of hypothesis testing and data analysis in Mathcad. Mathcad Professional
includes in-depth sections on Solving and Programming drawn from The Mathcad
Treasury, our best-selling Electronic Book. Visit MathSoft’s home page
(www.mathsoft.com) directly from the Resource Center, or browse to any other
resources on the World Wide Web.
This chapter provides a quick introduction to Mathcad and demonstrates a few more
advanced features like iterative calculation and plotting. After you read this chapter,
you'll have enough information to begin to solve your own problems in Mathcad. The
rest of this User's Guide describes all the features in detail, so you can learn more about
any selected topic. For more information about on-line resources like the Collaboratory,
Resource Center, and on-line Help system, see Chapter 2, “On-line Resources.”
Starting Mathcad
For information on system requirements and how to install Mathcad on your computer,
see the instructions that accompanied your installation media.
When you start Mathcad, you'll see the window shown in Figure 1-1. You can view or
hide the Math Palette, the Toolbar, and the Format Bar by choosing corresponding
commands from the View menu.
You can place equations anywhere in the Mathcad worksheet. To get to places not
visible in the window, use the scroll bars as you would in any Windows application.
Each button in the Math Palette opens a palette of operators or symbols. You can insert
many operators, Greek letters, and plot regions by clicking on the buttons found on
these palettes. From left to right, these palettes are:
Greek letters.
Symbolic keywords.
■ Choose Zoom from the View menu and choose a number smaller than 100%.
Mathcad windows work very much like those of most Windows applications. If you've
worked with Windows applications before, much of the material in this section will
already be familiar to you.
There are several ways to move the window from one part of a worksheet to another:
■ Move the mouse pointer and click the mouse button. The cursor jumps from
wherever it was to wherever you clicked.
■ Use the arrow keys [↑], [↓], [→], and [←] to move the crosshair up, down, right and
left respectively. Mathcad scrolls the window whenever necessary.
■ Click in the scroll bar to position the scroll box.
The position of the scroll box within the scroll bar serves as a rough guide to the position
of the window relative to the rest of the worksheet. If the top of the window is a third
of the way down from the top of the worksheet, the scroll box will be about a third of
the way down the vertical scroll bar. The page number for whatever page is visible in
the window is shown on the message line at the bottom of the window.
Multiple windows
You can have as many windows open as your available system resources will allow.
This allows you to work on several worksheets at once by simply clicking the mouse
in whatever document window you want to work in. If the worksheet you want to work
in is buried behind many other windows, pull down the Window menu and choose its
name.
To open a new document window, choose New from the File menu. To open a window
into a previously saved worksheet, choose Open from the File menu. For more
information about opening new worksheets and templates, see Chapter 4, “Worksheet
Management.”
A simple calculation 23
Definitions and variables
Mathcad's power and versatility quickly become apparent once you begin to use
variables and functions. By defining variables and functions, you can link equations
together and use intermediate results in further calculations.
The following examples show how to define and use several variables.
Defining variables
To clear the previous equation and define a variable t, follow these steps:
■ Click in the equation you just typed and
press [Space] until the entire expression
is held between the two editing lines. Then
choose Cut from the Edit menu.
If you make a mistake, click on the equation and press [Space] until the entire
expression is between the two editing lines, just as you did earlier. Then delete it by
choosing Cut from the Edit menu.
These steps show the form for typing any definition:
■ Type the variable name to be defined.
■ Type the value to be assigned to the variable. The value can be a single number, as
in the example shown here, or a more complicated combination of numbers and
previously defined variables.
Mathcad worksheets read from top to bottom and left to right. Once you have defined
a variable like t, you can compute with it anywhere below and to the right of the equation
that defines it.
Now enter another definition.
■ Press [↵]. This moves the crosshair below the first equation.
Calculating results
Now that the variables acc and t are defined, you can use them in other expressions.
■ Click the mouse a few lines below the two definitions (see Figure 1-2).
This equation calculates the distance traveled by a falling body in time t with acceler-
ation acc. When you enter the equation, Mathcad returns the result as shown in Figure
1-3. The window now contains two definitions, which define variables, and one
evaluation, which computes a result.
Mathcad updates results as soon as you make changes. For example, If you click on
the 10 on your screen and change it to some other number, Mathcad changes the result
as soon as you press [↵] or click outside of the equation.
Entering text
Mathcad handles text as easily as it does equations, so you can make notes about the
calculations you are doing. To begin typing text, click in an empty space and do any
one of the following: choose Text Region from the Insert menu, press the double-
quote key ("), or click on the text region button on the toolbar.
Here's how to enter some text:
■ Click in the blank space to the right of the equations you entered. You'll see a small
crosshair.
■ Press " to tell Mathcad that you're about to enter some text. Mathcad changes the
crosshair into a vertical line called the insertion point. Characters you type appear
behind this line. A box surrounds the insertion point, indicating you are now in a
text region. This box is called a text box. It will grow as you enter text.
■ Type Equations of motion
Mathcad shows the text in the worksheet, next to the equations (Figure 1-4).
26 Chapter 1 The Basics
Figure 1-4: Entering text. Notice the text box surrounding it.
To enter a second line of text, just press [↵] and continue typing:
■ Press [↵].
■ Click in a different spot in the worksheet or press [Shift][↵] to move out of the
text region. The text box will disappear once you have done this. Don't use the [↵]
key. If you press [↵], Mathcad will insert a line break in the text instead of leaving
the text region.
Figure 1-5 shows the worksheet with two lines of text and the cursor outside the text
region. Since you are outside the text region, the cursor appears as a small cross, and
the text box is no longer visible.
Entering text 27
Figure 1-5: After clicking outside of a text region.
You can set the width of a text region and change the font, size, and style of the text in
it. For more information on how to do these things, see Chapter 5, “Text.”
Iterative calculations 29
Figure 1-6: Generating a table of answers with a range variable.
Defining a function
You can gain additional flexibility by defining functions. Here's how to add a function
definition to your worksheet:
■ First delete the table. To do so, click any-
where in the table press [Space] until
you've enclosed everything between the
two editing lines.
The definition you just typed defines a function. The function name is d, and the
argument of the function is t. You can use this function to evaluate the above expression
for different values of t. To do so, simply replace t with an appropriate number. For
example:
Mathcad shows a table of values (Figure 1-7). The first two values, 1.11 ⋅ 10 3 and
1.007 ⋅ 10 3 , are in exponential (powers of 10) notation.
Formatting a result
You can set the display format for any number Mathcad calculates and displays. This
means changing the number of decimal places shown, changing exponential notation
to ordinary decimal notation, and so on.
For example, here's how to change the table in Figure 1-7 so that none of the numbers
in it are displayed in exponential notation:
■ Click on the table with the mouse.
Iterative calculations 31
■ Choose Number from the Format menu. You see the Format Number dialog box.
This box contains settings that affect how results are displayed, including the
number of decimal places, the use of exponential notation, and whether the number
is shown in decimal, octal, or hexadecimal. The option button beside “Set for current
region only” should be filled in. This indicates that whatever you do in this dialog
box affects only the result you've selected.
■ The default setting for Exponential Threshold is 3. This means that only numbers
greater than or equal to 10 3 are displayed in exponential notation. Click to the right
of the 3, press [BkSp] and type 6.
■ Click the “OK” button. The equation
changes to reflect the new result format—
1110 is no longer shown in exponential
notation.
When you format a result, only the display of the result is affected. Mathcad maintains
full precision internally.
Graphs
Mathcad can show both two-dimensional Cartesian and polar graphs, contour plots,
surface plots, and a variety of other three-dimensional plots. These are all examples of
plot regions.
This section describes how to create a simple two-dimensional graph showing the points
calculated in the previous section.
Creating a graph
To create a graph in Mathcad, click in blank space where you want the graph to appear
and choose Graph⇒X-Y Plot from the Insert menu. An empty graph appears with
placeholders on the x-axis and y-axis for the expressions to be graphed. X-Y and polar
plots are ordinarily driven by range variables you define: Mathcad graphs one point for
each value of the range variable used in the graph. In most cases you will enter the
range variable, or an expression depending on the range variable, on the x-axis of the
plot. But the QuickPlot feature in Mathcad lets you plot expressions even when you
don’t specify the range variable directly in the plot.
For example, here's how to create a QuickPlot of the function d(t) defined in the
previous section:
■ Click anywhere outside the graph. Mathcad calculates and graphs the points as
shown in Figure 1-8. A sample line appears under the “d(t).” This helps you identify
the different curves when you plot more than one function. Unless you specify
otherwise, Mathcad draws straight lines between the points and fills in the missing
axis limits.
For detailed information on creating and formatting graphs, see Chapter 20, “Graphs.”
Resizing a graph
The graph shown in Figure 1-8 is the default size. It's easy to make a graph in Mathcad
any size you want: just select the graph and stretch it to the desired size.
Graphs 33
To resize a graph, follow these steps:
■ Click the mouse just outside the graphics region. This anchors one corner of the
selection rectangle.
■ Press and hold down the mouse button. With the button still held, drag the mouse
toward the plot region. A dashed selection rectangle emerges from the anchor point.
■ When the selection rectangle just enclos-
es the graphics region, let go of the mouse
button. The dashed rectangle will turn
into a solid rectangle with handles.
■ Move the mouse pointer to any of the
handles. It will change to a double-headed
arrow.
■ Press and hold down the mouse button.
With the mouse button still pressed, move
the mouse. The graphics region will be stretched in the direction of motion.
■ Once the graphics region is the right size, let go of the mouse button.
■ Click on “trace 1” in the scrolling list under “Legend Label.” Mathcad places the
current settings for trace 1 in the boxes under the corresponding columns of the
scrolling list.
■ Click on the arrow under the “Type” column to see a drop-down list of trace types.
■ Click on the “OK” button to show the result of changing the setting. Mathcad shows
the graph as a bar chart instead of connecting the points with lines (Figure 1-10).
Note that the sample line under the d(t) now has a bar on top of it.
■ Click outside the graph to deselect it.
Graphs 35
Figure 1-10: Graph formatted as a bar chart.
Saving a worksheet
To save the file,
■ Choose Save from the File menu or click on the disk icon in the toolbar. If the file
has never been saved before, the Save As dialog box appears. Otherwise, Mathcad
saves the file with no further prompting.
■ Type the name of the file in the text box provided. By default, Mathcad saves the
file either in the folder in which Mathcad is installed or in the folder from which
you most recently opened a worksheet during the current session. To save to another
folder, locate the folder using the Save As dialog box.
By default Mathcad saves the file in Mathcad (MCD) format, but you have the option
of saving in RTF format to be able to open the file in a word processor. You may also
save the file as a template for future Mathcad worksheets, or in a format compatible
with earlier Mathcad versions. For more information on saving and opening files, see
Chapter 4, “Worksheet Management.”
Quitting Mathcad
When you're done using Mathcad, choose Exit from the File menu. Mathcad closes
down all its windows and returns you to the Desktop. If you've made any changes in
your worksheets since the last time you saved, a dialog box appears asking if you want
to discard or save your changes. If you have moved the toolbar, font bar, or math
palettes, Mathcad remembers their locations for the next time you open the application.