In: Accounting
The law of cosines for a triangle states that a2 = b2 + c2 - 2bc cosA, where a is the length of the side opposite the angle A, and b and c are the lengths of the other sides.
a. Use MuPAD to solve for b.
b. Suppose that A = 60°, a = 5 m, and c = 2 m. Determine b.
(a)
The equation given is:
a2 = b2 + c2 – 2bc cost (A)
Solution for b is required.
This can be done using the MATLAB command solve.
The MATLAB code is shown below:
Input:
syms a b c A
S = a^2 - b^2 + c^2 + 2*b*c*cos(A);
sol = solve(S, b)
Output:
Solution for b is:
b = c cost(A) ± √[c2 + {a2 + c2 cos(A)}]
(b)
A = 60°, a = 5, c = 2
Substituting the values in the above equation by using the MATLAB command subs
The MATLAB code is shown below. The double command is use to convert the symbolic expression into the numeric value.
Input:
subs(sol, [a, c, A], [5, 2, 60])
double(ans)
Output:
The solution is
b = 3.8073
b = -7.6170
(a)
b = c cost(A) ± √[c2 + {a2 + c2 cos(A)}]
(b)
The solution is
b = 3.8073
b = -7.6170