Getting Started with Mathcad
by Brent Maxfield
|
This article is written for those who have never used Mathcad. There are thousands of PTC customers who have never tried Mathcad and are missing out on the benefits of using this powerful easy-to-learn software. Download the free 30 day trial version at Mathcad 30-Day Free Trial.
You can also purchase the book Essential Mathcad, which includes a full non-commercial version of Mathcad. |
|
Much of the material below is from Chapter 1 "An Introduction to Mathcad" of the book Essential Mathcad, ©2009, Elsevier Inc. |
|
Think of Mathcad as a blank MS Excel spreadsheet just waiting for you to input data and establish relationships between the data. You can liken this worksheet to a clean sheet of calculation paper waiting for you to put information on it. |
|
Let’s begin by quickly performing a simple math problem and learning how to assign variables. |
|
Let's assign variable names to these equations.To assign a value to a variable, type the variable name and then type the colon : key. For example, type "a1:5+3". |
|
Now type a1=". This evaluates and displays the value of variable a1. |
|
Let’s assign another variable. Type "b1:(2+3)*2". |
|
Now type "b1=". This evaluates and displays the value of variable a1. |
|
Now that values are assigned to variables a1 and b1, you can use these variables in equations. Type "c1:a1+b1". |
|
Rather than using cells to store numbers, Mathcad uses variable names. You can see how easy it is to create relationships between variables. Mathcad does not require any programming languate to perform simple operations. You simply type the equations as you would write them on paper. |
|
As you begin using variables, it is important to understand the following Mathcad protocol. In order to use a previously defined variable, the variable must be defined above or to the left of where it is being used. In other words, Mathcad calculates from left to right, top to bottom. |
|
Creating Simple Math Expressions |
|
Click on the Calculator toolbar to find and insert many common math operators. If the Calculator tool bar is not visilbe, turn on the Math toolbar. |
|
You can also insert functions and units by clicking the Insert menu and locating the function or unit you desire to use. |
|
Creating more complex math expressions is very easy once you learn the concept of the editing lines. These are similar to a two-dimensional cursor with a vertical and a horizontal component. There is a vertical editing line and a horizontal editing line. As an expression gets larger, the editing lines can grow larger to contain the expanding expression. Notice how in the previous examples the editing lines just contained a single operand. Pressing the spacebar will cause the editing lines to grow to hold more of the expression. |
|
For example, if you type "2+5 spacebar", you get the following: |
|
Whatever is held between the editing lines becomes the operand for the next operator. So, if you type 2+5 spacebar^3, you get the following: |
|
In this case (2+5) is the x operand for the operator x to the power of y. Notice how the editing lines now contain only the number 3. This means that if you type any operator, the number 3 is the operand for the operator. Thus, if you type + 4, you get the following: |
|
But, if you press the spacebar first, the editing lines expand to enclose the whole expression. This expression becomes the operand for the next operator. Thus, if you now type + 4, you get the following: |
|
The whole expression became the operand for the addition operator. |
|
It is very important to understand this concept of using the editing lines to determine what the operand is of your next operator. You can also use parentheses to set the operand for operators. Pressing the single quote (’ ) adds a pair of opposing parentheses.
The following example will help reinforce these concepts. Let’s create the following expression: |
|
To create this expression, use the following steps: |
|
1. Type "1/2 spacebar". The editing lines now hold the fraction 1/2. This becomes the operand for the subtraction operator. |
|
2. Type "- 1 / 3 spacebar spacebar". The editing lines should now hold both fractions. This becomes the operand for the power operator. |
|
3. Type "^2 spacebar". The editing lines should now hold the entire numerator. This becomes the operand for the division operator. |
|
4. Type "/" then "\" (or use the square root icon on the calculator toolbar) 4/5 spacebar spacebar". This makes everything under the radical the operand for the addition operator. |
|
5. Type "+ 2 / 7".
This completes the example. |
|
Notice how during each step, the spacebar was used to enlarge the editing lines to include the operand for the following operator. |
|
Another important concept to know is how to edit existing expressions. In order to understand this concept, it is important to understand how to move the vertical editing line. This vertical editing line can be moved left and right using the left and right arrow keys. You can also toggle the vertical editing line from the right side to the left side and back by pressing the INSERT key. For expressions that are more complex you can also use the up and down arrows to move both editing lines. |
|
If you click anywhere in an expression and then press the spacebar, the editing lines expand to include more and more of the expression. How the editing lines expand depend on where you begin and on what side the vertical editing line is on. |
|
The general rule is that as the editing lines expand and cross an operator, the operand for that operator is then included within the lines. |
|
You can delete characters in your expressions by moving the vertical editing line adjacent to the character. If the vertical editing line is to the left of the character, press the DELETE key. If the vertical editing line is to the right of the character, press the BACKSPACE key. |
|
Deleting and Replacing Operators |
|
To replace an operator, place the editing lines so that the vertical editing line is just to the left of the operator. Next, press the DELETE key. This will delete the operator, usually leaving a hollow box symbol where the operator used to be. Now, type a new operator, and it will replace the box symbol. |
|
You may also have the vertical editing line to the right of the operator and use the BACKSPACE key to delete and replace the operator. |
|
Learning to master these simple techniques of creating and editing mathcad expressions will greatly enhance your Mathcad abilities.
|
[PRINTER FRIENDLY VERSION]
|