Using Mathcad to Perform Mathematics Charles Nippert These notes are designed to be an introduction to Mathcad. They all are a quick tour of the principal features of the Mathcad program. To prepare these notes I have used my version (Mathcad 2001). The graphical user interface (GUI) of Mathcad has remained pretty much unchanged through several versions, but I do not know for certain that these notes will be applicable for all versions that you may find. Mathcad is a full-featured package that allows you to perform a variety of mathematical operations easily and quickly. It has the capability of performing operations with units, doing symbolic manipulation (doing algebra, performing integral calculus, solving differential care equations, et cetera.), and other powerful math operations. It is therefore advantageous for engineers and scientists to use this tool to speed up the mathematical aspect of their work. Getting Started-Ordinary Calculations with Units In this exercise we will calculate the force, in pound force, to accelerate at 10 ft/s 2 a mass of 1 ton. 1. Open Mathcad on your computer. After closing the "Tip of the Day" the screen will appear as a blank field with a small red cross that locates the current cursor position. 2. Move the red cross to about any inch below the menu bar by pressing the down arrow key or by moving the mouse cursor to that location and clicking the left mouse button. The red cross should move to that spot. 3. Define a variable "a" that will contain the value of the acceleration with units (10 ft/s 2 ). This kind of statement is called an "arithmetic assignment statement". It looks very much like a mathematical equation. However, its function is quite different. This kind of statement defines a variable and places information in that variable. Type" a". The Red Cross disappears and a lowercase letter a appears in a box. The box indicates that this function is being edited. 4. There are two ways to make the arithmetic assignment symbol (:=) appear on the screen. Choose "View/Toolbars/Evaluation" from the menu. A small window with the name "Evaluation" will appear. This window is called the evaluation toolbar and contains several buttons. Click the button on the Evaluation toolbar. Alternatively, press the Shift" and the ":" key simultaneously. Your screen should now look somewhat like Figure 1.
Figure 1 Entering an Arithmetic Assignment Statement (An Equation) This box indicates that this equation is being edited. The evaluation toolbar contains the most common operators. The cursor has become a blue inverted L. Note the black box which indicates where you can insert information. 5. A small solid black box will appear to the immediate right of the: =. The cursor will turn into a blue inverted "L". 6. You are now ready to enter the numerical value of the acceleration. Type "10". The number 10 should appear on the screen after the ":=" symbol. If you make a mistake, press the backspace key to undo your typing. 7. Units and dimensions are treated much like variables. Therefore, when we enter "10 ft/s2" we treat the value as if it were 10 times ft divided by s 2 ". Therefore we need to enter the multiplication symbol, "*", to separate the numerical value of a from its units. Press the * key now. 8. Now add the units. Mathcad knows most common abbreviations for most units. Type the keys "ft/s^2". Your window should now look somewhat similar to Figure 2. If you make a mistake, hit the backspace key to undo your typing.
Figure 2 Completed Definition of Acceleration The value of acceleration with associated units. This box indicates that this equation is being edited. Superscripts are are entered using the "^" key. 9. Now enter the mass (1 ton). Move the mouse to an area just below the statement you just entered and press the left mouse button. The box around the statement disappears and a red cross will appear under the mouse cursor. Now enter another arithmetic definition statement to do fine a variable named mass with the value of 1 ton. Use the same procedure you used to create the variable "a. Remember to type a ":" to create a ":=" symbol on the screen. If you make a mistake, hit the backspace key to undo your typing. We will name this variable "mass" because the symbol m" is already used by Mathcad as the symbol for meter. If we define a new variable with the same name we will override the pre-programmed definition, 1 m. It is important, therefore, that we avoid using symbols that already have meanings that we may use in our program such as; e, g (the acceleration due to gravity), A (ampere), V (voltage) and π. A full list of built-in units can be found by clicking "Help". When you have completed this step your screen should appear as shown in figure 3.
Figure 3 Screenshot After Entering though Mass 10. Now, enter Newton's law of motion (F=ma). This equation must be below and/or to the right of the last equation you entered. Mathcad performs arithmetic assignment statements sequentially from left to right and top to bottom. Therefore this last equation must be performed by the program after the two equations defining a" and "mass". Once again, remember to hit the ":" key to create the ":=" symbol. Also remember to insert a "*" between "mass" and "a". Your screen should now show three equations. Note that Mathcad uses the symbol "F" for the unit Faraday. This does not create any problems for us in this example because we are not using any electrical units. 11. Move the cursor to just below your last equation. If the cursor is still all on Newton's first law of motion, you can do this by simply pressing "Enter". Now, have Mathcad display the value in the variable named "Ave.". Type the keys "F=". As soon issue have finished typing, the value of F will appear. Your screen should now let appear as shown in Figure 4.
Figure 4 Showing the Value of Force in Newtons 12. Mathcad uses the "=" symbol to display values of a variable. When it first displays those values, the program uses its default unit system; typically the SI system. Will of the inverted L cursor to the black box by repeatedly pressing the right arrow key until the cursor reaches the box. With the cursor owned a black box, type "lbf (the name for "pound force"). Hit enter. The program should now display the value of Force in pounds force as shown below in the figure below.
Figure 5 Displaying Variables in User Specified Units 13. Mathcad allows you to define new units in terms of existing units. You will now define a new unit kn (standing for kilonewton) as 1000 times a Newton. Move the mouse cursor a little below the last statement and click the left mouse button. The red cross cursor will appear. Type the letters kn, the new unit you wish to define. The definition of units requires a new symbol. You can find this symbol on the Evaluation toolbar. If it is not visible, select View/Toolbars/Evaluation from the menu. Click the button on the evaluation toolbar. You can also use the ~ key on your keyboard to create the same symbol in the workspace. Your screen should now look like Figure 6 Figure 6 Defining units 14. Finish the definition by defining kn in terms of units the program already knows. Type 1000*N. Remember that the keyboard symbol * is used for multiplication. If you are using an older version of Mathcad, you may have to type Newton. Your definition should look like figure 7.
Figure 7 The Complete Definition of kn 15. Unlike arithmetic assignment statements, unit definitions apply on the entire worksheet. You will now demonstrate this. Move the mouse cursor above your definition and slightly to the right of the answer in pound force. Type F= as you did before and the answer will appear in the default units. In the black place holder box type kn. Mathcad will then display the answer in kilonewtons, using the units you provided. Your worksheet should look like Figure 8 Figure 8 The Force Displayed in lbf and kn The kn unit is available on the entire worksheet The ability to define new units from existing ones is one of the powerful features of Mathcad the allows you to tailor the package to meet your needs. You can use this to define kmole and lbmole in terms of mole and add any units to a worksheet that you need. I have even reassigned dimensions (charge, for instance) that I don t use in a calculation to a different dimension (dollars, for example) in some calculations. Great care should be exercised when doing this because all units are related to the fundamental dimensions programmed into Mathcad.