PTC Mathcad (PTC 2018) is a powerful software computational tool. It allows the user to create, solve and analyze a variety of mathematical problems. Here we introduce some of the basic capabilities of Mathcad and then apply them to calculate some real accelerator parameters.

## Exercise 1 - Basic equation editing, calculations, and graphing

1. Type ctrl-shift p*7^2 space space /13 =

Mathcad should respond with an equation and solution like this

$\frac{\pi\cdot 7^2}{13} = 11.841$

1. Let’s create two variables and solve the same equation. Copy the equation you just created to another location in the worksheet. You can do this by clicking anywhere in the equation field, press the space bar until the entire equation is within the blue editing lines, and then use the copy and paste functions. Replace the ‘7’ with a variable, say ‘a’, and ‘13’ with another such as ‘$$\beta$$’ in the equation by typing over them. One way to insert the greek character beta is to select Toolbars from the View menu, hold down the mouse button and release it when the cursor is on Greek, then select the character you wish. Next, somewhere above the equation, type a := 7 and p := 13. The ensuing result should look something like this:

$a := 7$ $\beta := 13$ $\frac{\pi\cdot a^2}{\beta} = 11.841$ Try typing in different values for a and $$\beta$$.

1. Mathcad does iterative calculations using Range Variables. Whenever Mathcad encounters a Range Varíable it calculates the equation for every value of this special variable.

Copy our existing equation and variable ‘$$\beta$$’ and paste them into another area. Now turn ‘a’ into a range variable by typing a:7,14;70. Matchcad should respond with

$a := 7,14..70$

Mathcad has now defined ‘a’ to have the values 7, 14, 21, … 70. Our equation is now calculated for each value of ‘a’ and the results are listed below. Double clicking in the table of answers opens a window of display options. Experiment with these to see what Mathcad can do. 1. With Mathcad you can define a function and solve for it. Once again let’s use our expression from above. Start by defining a function A(a):. A placeholder appears to the right of what has been typed. Either type or paste in the equation we have been using. We also need to select some values for ‘a’, so we could again type a: 7, 14; 70. Finally we need to calculate some solutions to our function so type A(a)=. You should see something like: Another way to solve for this function is simply to place the value for ‘a’ that you wish to solve for within the parenthesis:

$A(84) = 1.705\times 10^3$

1. Matchad has graphing capabilities as well. Let’s graph the value of A(a) as a function of ‘a’. Select Graph from the Insert menu and choose X-Y Plot. Placeholders are displayed for the X and Y axes. Type or copy/paste a for the X one and A(a) for the Y axis. A plot such as the one below should result: Double clicking in the field of the graph opens a window of customizing options. Check them out. Experiment with other features of the plot field.

## Exercise 2 – Matrices

1. Click on View > Toolbars > Matrix to open the Matrix Toolbar. To create a matrix either click on the matrix icon in the toolbar (upper left corner) or type Ctrl-M. Create the following 2X2 matrix: 1. Mathcad can do a variety of operations on a matrix. Open the Matrix and Symbolic toolbars. To Transpose a matrix use the space bar to enclose the entire matrix within the editing bars. Select the Symbolic Matrix Transpose icon (lower left corner) from the Symbolic Toolbar then click Enter. You should get: 1. To lnvert the matrix, follow the same procedure once more. This time select the Symbolic Matríx lnverse icon (lower right corner) from the Symbolic toolbar. Mathcad should produce: 1. To find the Determinant, follow the same procedure but select the Symbolic Matrix Determinant icon (lower right corner) from the Symbolic toolbar. Mathcad should produce: 1. Create another matrix, M, and perform arithmetic operations on the two. For example: 1. Finally, Mathcad also allows one to create and perform math functions on vectors. To create a vector, simply make a single column matrix: Set up Mathcad to do the following: • To change a parameter, simply click on it until a cursor appears to its right, and then delete or alter it to how you want it. When you hit RETURN, Mathcad will update the entire worksheet.
• If you wish to recalculate the worksheet without moving the cursor, just hit Control-=.
• Mathcad has a Help feature which can be obtained by selecting HELP TOPICS under the ? icon in the upper right hand corner of the screen. There is also a ? icon in one of the tool palettes.
• An expression like y := x is a definition of $$y$$ in terms of $$x$$. An expression like y = 0.56 is the result of a calculation of $$y$$.
• To terminate a calculation, press Control-. (Control-period) to abort the process. One can also hit the Escape key.