EG31 MATHCAD NOTES
SESSION 2
Symbolic Calculations

Mathcad can perform a number of operations which are found in the Symbolics pull-down menu. The results of these operations are generally another expression. Here are examples of some of these operations:


Evaluate

To evaluate a derivative symbolically

1. Select the differential operator by selecting the d/dx operator from the Math palette or typing a ?



2. Type the differential expression into the placeholders
3. Select it by pressing the space bar or the arrow keys until the editing lines are across the complete bottom and right sides or drawing the mouse diagonally over the expression.

4. Choose E valuate => Symbolically from the Symbolics menu.

Mathcad returns the answer:
Mathcad places the evaluated expression into the worksheet. The location of the evaluated expression can be changed by selecting its math region and dragging it to the desire location. The location can also be pre-selected based on the Evaluation Style selected. This will not be covered in these notes.
To evaluate a definite integral symbolically

1. Select the definite integral operator from the Math palette and fill in the placeholders with numerical limits and the expression. Hint: either type the sin(x) or select the sin function from the Arithmetic palette.
2. Select the complete expression and choose Evaluate => Symbolically from the Symbolics menu.

Mathcad returns the answer:
An alternate method for the solution to a definite integral is to type the " = " sign after the expression and press the Enter key to complete the operation:
To evaluate an integral with symbolic limits, symbolically

1. Select the definite integral operator from the Math palette and fill in the placeholders with variables for the limits of integration and the expression to be integrated
2. Select the complete expression and choose Evaluate => Symbolically from the Symbolics menu.

Mathcad returns the answer:
To evaluate an indefinite integral symbolically

1. Select the indefinite integral operator from the Math palette or press and hold the Ctrl key and type " i ". Fill in the placeholders with the expressionto be integrated.
2. Select the complete expression and choose Evaluate => Symbolically from the Symbolics menu.

Mathcad returns the answer:
Simplify

By using the keyword simplify, Mathcad can carry out the simplification of algebraic and trigonometric expressions.

1. Enter the expression to be simplified. Hint: use captial X rather than lower case to avoid having Mathcad plug in any previously used definintion of x.
2. Press and hold the Ctrl and Shift keys and type " . " key. Mathcad displays a placeholder to the left of the arrow. Type " simplify " into the placeholder and either click outside the math region or press the Enter key.

Mathcad returns the simplified expression to the right of the arrow
A more direct method is to select the expression to be simplified and then choose S implify from the S ymbolics menu.
To simplify a trigonometric expression by having Mathcad apply the following two identities:

sin 2(x) + cos2 (x) = 1 and cosh2(x) -sinh2 (x) = 1

1. Enter the trigonometric expression to be simplified.
2. Press and hold the Ctrl and Shift keys and type " . " key. Mathcad displays a placeholder to the left of the arrow. Type " simplify, trig " into the placeholder and either click outside the math region or press the Enter key.
Expand

To expand all powers and products of sums in an expression, the keyword expand is used.

1. Enter the expression to be expanded
2. Press and hold the Ctrl and Shift keys and press the " . " key. Mathcad displays a placeholder to the left of the arrow. Type expand into the placeholder and either click outside the math region or press the Enter key.

Mathcad returns the expanded expression to the right of the arrow
A more direct method is to select the expression to be simplified and then choose Expand from the Symbolics menu.
Factor

To factor an expression using Mathcad, the keyword factor is used.

1. Enter the expression to be factored
2. Press and hold the Ctrl and Shift keys and press the " . " key. Mathcad displays a placeholder to the left of the arrow. Type factor, then the " square root sign " from the Arithmetic palette and then 2 into the placeholder and then either click outside the math region or press the Enter key.

Mathcad returns the expression factored with respect to the square root of two to the right of the arrow
C ollect

To simplify an expression by collecting terms containing like powers of a variable, the keyword collect is used.

1. Enter the expression.
2. Press and hold the Ctrl and Shift keys and press the " . " key. Mathcad displays a placeholder to the left of the arrow. Type collect,X into the placeholder and theneither click outside the math region or press the Enter key.

Mathcad returns the expression with the like powers of X collected to the right of the arrow
An alternate method for collecting terms of an expression is to click on a variable in the expression and choose Collect from the Symbolics menu.
Finding the solutions to equations:

To solve a single equation in a single unknown,the root function can be used. This Mathcad function uses an expression and one of the variables from the expression. It varies the variable until the expression is equal to zero. It then returns the value that makes the expression equal zero. The root function has the form:

root ( f(z) , z ) where f(z) is the function, and the value of z which makes the function equal to zero is returned as the solution. The function can be a function which is defined elsewhere in the worksheet or an expression.

To find the solution to the equation x 3 - e x

1. First define a guess for the value of the variable. This guess value must be placed before the root function in the Mathcad worksheet. Define the guess value of x as 3:



2. Arrange the function in a form that is equal to zero. Select a variable name for the scalar which will be used to define the root of the equation. Using the variable a for this:



3. To have Mathcad show the root of the equation simply type a=

Mathcad returns the answer:



4. If the equation has more than one root, the guess value will determine the root which is closest to the guess value. An alternate way to find multiple roots is to use the polyroot function.

The polyroot function does not require a guess value. However, it returns all of the roots of an equation at once, whether they are real or complex. In order to use the polyroot function, the equation must be expressed as a vector. This will not be covered in this material.

Systems of equations:

Mathcad allows you to solve a system of up to fifty simultaneous equations in fifty unknowns.

There are four steps to solving a system of simultaneous equations. These are:

1. Provide an initial guess for all of the unknowns that are desired. The initial guesses give Mathcad a place to start searching for solutions.





2. Type the word Given . This tells Mathcad that what follows is a system of equations. It can be typed in any combination of upper and lower case letters and in any font. Be sure that it is not typed in a text region or paragraph



3. Type the equations and inequalities in any order below the word Given . Make sure to use the symbol "=" to separate the left and right sides of each equation. To get the correct = sign, press and hold the Ctrl key and then press the = key. The left and right sides of an inequality can be seperated with any of the symbols <, >, <, or >.




4. Type an equation that invloves the Find function. It can be in any combination of upper and lower case letters in any font, size or style.




The answer is expressed as a vector.

If Find has one argument, it returns the value of that variable that solves the equation between it and the Given.

If Find has more than one argument, it returns a vector of answers.



Mathcad is very specific about the types of expressions that can appear between the Given and the Find . The table below lists all the expressions that can be placed in a solve block between these two functions. These expressions are often called constraints. In the table below, x and y represent real-valued scalar expressions, z and w represent arbitrary scalar expression.

Condition Keystroke Description

z=w [Ctrl]= Constrained to be equal

x>y > Greater than

x<y < Less than

x> y [Ctrl]0 Greater than or equal to

x< y [Ctrl]9 Less than or equal to


Mathcad does not allow contraints with the equals sign with a slash through it to indicate not equal to, range variable or expressions involving range variables of any kind, and inequalities of the form a<b<c

Solve blocks cannot be nested inside each other. Therefore, each solve block can have only one Given and one Find. a function like f( x ) :=Find( x ) cna be defined at the end of one solve block and the same function used in another solve block.

Never use assignment statements such as initial guesses ( x := 1 ) inside a solve block. Mathcad marks them with an appropriate error message.
EG31 MATHCAD EXERCISES
SESSION 2
Exercise 1: Taking a Derivative

a. Find the first derivative of the expression
b. Find the second derivative of the same expression.

c. Find the third derivative of the same expression.
Exercise 2: Integrating

a. Find the indefinite integral of the following expression
b. Find the definite integral for the same expression between 0 and 5

c. Find the definite integral for the same expression between the symbolic limits of a to c
Exercise 3: Expanding

Expand the following expressions
a.
b.
Exercise 4: Factoring

Factor the following expression
Exercise 5: Collecting

In the following expression:



a. First collect x

b. Then collect y

c. Collect x and y at the same time
This is not functioning correctly
Exercise 6: Solving and equation

Solve the following equation for its roots