All variables and functions are to be typed (declared). Hint: option explicit. SIN and COS are the Excel functions and are for comparison.
1. A cosine can be approximated by the following infinite series:
cos??x=1- (x^2/2!)?+ (x^4/4!)- (x^6/6!)+ . . . Write a function that will calculate this for any x and y number of terms. If y > 85 or y is not a positive integer, return an error.
X
|
Y
|
Cos( x)
|
MyCosine (x,y)
|
Approximation error
|
0.31831
|
9
|
|
|
|
0.95493
|
9.5
|
|
|
|
1.27324
|
37
|
|
|
|
1.591549
|
65
|
|
|
|
2.228169
|
88
|
|
|
|
2. An index linked note is an instrument that provides investors fixed income-like principal protection together with equity market upside exposure. It is structured by combining the economics of a long call option on equitywith a long discount bond position.The investment pays the greater of the par value, $1,000, or the price times the percentage increase in the S&P 500.
Write 2 functions (elnPayoff, elnReturn). The first, elnPayoff, calculates the security payoff at maturity. The second, elnReturn, calculates the annualized return assuming continuous compounding. The function elnReturn should call the payoff function.
Price
|
Years
|
SP5000
|
SP5001
|
Payoff
|
Return
|
961
|
1
|
1783
|
1995
|
|
|
923
|
2
|
1298
|
1498
|
|
|
819
|
5
|
1288
|
1568
|
|
|
727
|
8
|
1335
|
1270
|
|
|