In this assignment we are going to start using a second method for writing a function. We used Maple's one line notation that uses an arrow. The one line notation can be very powerful by breaking your problem into little steps and then writing a single function for each step and then composing them. The problem is that if you use an

Method 2 for creating a function:

some commands;

return value;

end;

What do the following procedures do?

> f1:=proc(x);

return x^2;

end;

> f1(5); f1(y); f1(1+a);

> f2:=proc(x);

if x mod 2=0 then

return x/2;

else

return x;

fi;

end;

> plots[pointplot]([seq([r,f2(r)],r=1..50)]);

Write a function/procedure so that you can compute the sequence define for $A_0 = 1$ and $A_1 = 1$ and for $n\geq2$, \[ A_n = A_{n-1} + 2*A_{n-2}. \] That is, I would like you to write a function/procedure

Next compute

You should open up a new worksheet and start from scratch. You will have to save your work in a file and upload that file on to the course moodle. Your solution should be a sequence of commands where it is easy to change the input string and after you execute the sequence of commands you should have the correct output string. Please add documentation to your worksheet to explain how it works. Just a few sentences is sufficient, but imagine that you were opening up the worksheet for the first time and wanted to know what it did. You will be marked down if what you write is not clear and coherent.

You should finish your assignment before class Monday, October 22 by 11:59pm. Assignments submitted after this date will be assessed a penalty of 10% per day.