MTH517 Wk 3 MATLAB
Special Variables and Constants
• ans - Default variable which stores the most recent answer.
√
• i, j - The imaginary unit −1.
• Inf - Infinity symbol.
• NaN - Undefined numerical result (not a number).
• pi - Mathematical constant π = 3.14125...
• exp(1) - Mathematical constant e = 2.718...
• ; - Semi-colon after code suppresses screen printing.
Commands for Manipulating Symbolic Expressions
• Collect - Collects coefficients of like powers in an expression.
• Expand - Expands an expression in its full form.
• Factor - Factors an expression.
• Simplify - Simplifies an expression.
• Subs - Substitutes variables or expressions.
• Pretty - Displays an expression in a form that resembles typeset mathematics.
1
In-class exercises on Basic Operations
1. Evaluate: 3ab − 2bc + abc when a = 1, b = 3 and c = 5.
1
2. Find the value of 4p2 qr3 , given that p = 2, q = 2
and r = 1 12 .
3. Find the value of 2xy + 3yz − xyz, when x = 2, y = −2 and z = 4.
4. Evaluate 3pq 3 r3 when p = 32 , q = −2 and r = −1.
5. Find the sum of: 4a, 3b, c, −2a, −5b and 6c.
6. Find the sum of 5a − 2b, 2a + c, 4b − 5d and b − a + 3d − 4c.
7. Subtract 2x + 3y − 4z from x − 2y + 5z.
8. Multiply 2a + 3b by a + b.
9. Multiply 3x − 2y 2 + 4xy by 2x − 5y.
10. Simplify: 2p ÷ 8pq.
Practice exercises on Basic Operations
1. Find the sum of: 3x, 2x, −x and −7x.
2. Find the sum of: 3a, −2a, −6a, 5a and 4a.
3. Add together 2a + 3b + 4c, −5a − 2b + c, 4a − 5b − 6c.
4. Add together 3d + 4e, −2e + f , 2d − 3f , 4d − e + 2f − 3e.
5. From 4x − 3y + 2z, subtract x + 2y − 3z.
6. Subtract 23 a − 3b + c from b
2
− 4a − 3c.
7. Multiply 3x + 2y by x − y.
8. Multiply 2a − 5b by 3a + b.
9. Simplify 3a ÷ 9ab.
10. Simplify 4a2 b ÷ 2a.
2
In-class exercises on Brackets and Factorization
1. Remove the brackets and simplify the expression: (3a + b) + 2(b + c) − 4(c + d).
2. Expand and simplify: a2 − (2a − ab) − a(3b + a).
3. Expand and simplify: (a + b)(a − b).
4. Simplify: (3x − 3y)2 .
5. Remove the brackets from the expression: 2 [p2 − 3(q + r) + q 2 ].
6. Remove the brackets and simplify the expression: 2a − [3 {2(4a − b) − 5(a + 2b)} + 4a].
7. Simplify: x(2x − 4y) − 2x(4x + y).
8. Factorise:
(a) xy − 3xz.
(b) 4a2 + 16ab3 .
(c) 3a2 b − 6ab2 + 15ab.
9. Factorise: ax − ay + bx − by.
10. Factorise: 2ax − 3ay + 2bx − 3by.
11. Factorise: x3 + 3x2 − x − 3.
Practice exercises on Brackets and Factorization
1. Remove the brackets and simplify where possible:
(a) (x + 2y) + (2x − y).
(b) 2(x − y) − 3(y − x).
(c) 2(p + 3q − r) − 4(r − q + 2p) + p.
(d) (a + b)(a + 2b).
(e) (p + q)(3p − 2q).
(f) (x − 2y)2 .
(g) (3a − b)2 .
(h) 3a + 2 [a − (3a − 2)].
(i) 2 − 5 [a(a − 2b) − (a − b)2 ].
(j) 24p − [2 {3(5p − q) − 2(p + 2q)} + 3q].
2. Factorise:
(a) pb + 2pc.
(b) 2q 2 + 8qn.
(c) 21a2 b2 − 28ab.
(d) 2xy 2 + 6x2 y + 8x3 y.
(e) ay + by + a + b.
(f) px + qx + py + qy.
(g) 2ax + 3ay − 4bx − 6by.