SOLUTIONS
1. A Friendly Martian
There is no ‘correct’ answer to this question.
2.
Towers
Of Hanoi
Move
A to C
Move A to B
Move C to B
Move A to C
Move B to A
Move B to C
Move A to C
Move A to B
Move C to B
Move C to A
Move B to A
Move C to B
Move A to C
Move A to B
Move C to B
Note that the
minimum number of moves is 15 = 24 – 1 moves. In general, for N rings, the minimum number of
moves is 2n – 1. According to the original legend, there were 64 golden rings. One
ring was moved each day. The monks
believed the world would end when they finished the puzzle. Were they crazy to believe that?
3.
Hyperbolic
Cosine
%Name:
John Q. Public
%CUID: 555555
%Date: 01 July 2002
%HW1Q3.m
x = input('Enter a value for x: ');
c = (exp(x) + exp(-x))/2;
disp(['The value of cosh( ' num2str(x) ' ) is ' num2str(c)]);
%Sample Output
%>>hw1q3
%Enter a value for x: 3.0
%The value of cosh( 3 ) is 10.0677
%MATLAB's built-in function cosh returns for input argument 3.0,
% 10.06766199577777