CS310 Team Lab #1
Intro to Symbolic Computing in Maple
Unit 1: Symbolic Computation in Maple

PROBLEMS

Getting Started in Maple

  1. Open a new worksheet in Maple:
    If you are on the Start page, select the New Worksheet icon; otherwise do
    File → New → Worksheet Mode
  2. Increase the font size (to make it easier for all team members to see):
    View → Zoom Factor → 125%
  3. Start the worksheet with a restart command:
    Type restart and hit Enter (to reset all variable names before the problem)

Engineering Cost Analysis

A general principle that applies to all financial transactions is called the time value of money. A dollar that you have today is worth more in the future because you don't hide it under your mattress. You invest it in a savings account, certificate of deposit, stock or bond, or some other "financial instrument" and your money earns interest. This works because the institution that takes your money immediately loans it to someone else for their use and charges them interest. The time value of money (also called the future value of money) is computed using the formula:

F= P(1+a)n

where

Thus, if you have $10,000 and put it in a bank account paying 4% interest per year, then after 5 years your money is worth F=$10,000(1+0.04)5 = $12,166. The time value of money complicates financial planning and cost comparisons because money earned or spent in the future is different than money that is earned or spent today.

Problem 1: Future value of money invested at a given interest rate and what it means to solve symbolically first!

  1. Enter the time value of money formula as a symbolic equation and give the equation the name TVOM (which you can use to refer to it later):

    TVOM := F = P*(1+a)^n

    (Make sure you actually type this command into Maple - don't copy-paste it from this write-up! You'll get much more out of the lab by typing the commands.) Once this equation is entered in Maple, you can manipulate it by solving for any of the variables in the equation.

  2. Suppose you have $15,000 saved and want to buy a car for $25,000. How many more years will you have to save in order to save the $25,000 at an interest rate of 5.5%?

    Solve the formula for the value of n using the solve command. Next, substitute values using the subs command into the solution formula for the variables in the formula to find the value of n. Finally, use the evalf command to get a decimal (floating point) approximation.

  3. Type Ctrl-Shift-K to add comments before the current execution group calculation. Add a comment that states how many years it will take to save $25,000.

    Use this technique to label your questions and answers on homework problems.

    Note: you can use Ctrl-K to add a new execution group before the one the cursor is currently on (i.e., if you want to insert a line in which to put a command above the line the cursor is on) and Ctrl-J to add a new execution group after the one the cursor is currently on.

Show a Lab Leader that you have successfully solved this equation, substituted values, and inserted comments.

Problem 2: Comparing investment options

You can compute the future value of your money substituting in numeric values for any of the variables in the original equation. Suppose you have $1,500 and have the following two options:

  1. If the rate after the first three years falls to 5.20%, how much will you have at the end of 6 years for each option?

    Caution: Do not reenter or enter new formulas into Maple to do these calculations. Use Maple to refer to the existing equations and formulas by name or create new formulas and assign them to names. Do not retype amounts that you have computed; assign the result to a name and use that named value. You can use FVOM := rhs(TVOM) to get an expression for computing the future value of money and then use subs command to complete calculations for each option.

  2. Which investment option would have been better if you could have predicted the drop in interest rate?

Problem 3: Present value of money payed out over n periods of time

To compare money spent today with money spent over a period of time in a sequence of equal payments, you need to compare these on an equivalent basis taking into account the time value of money. You can do this by comparing based on the up-front value of money (or the so-called present value). This is done with this formula for the present value of money:

P=A((1+a)^n-)/(a(1+a)^n)

where

Instead of saving for the car, you choose to borrow $10,000 to purchase the car now. You get a loan for $10,000 at a rate of 6.9% annual interest and a payment period of 4 years.

  1. What will your monthly payment be?

  2. What if the interest rate were 5.9% instead?

Hint: enter the equation, solve it symbolically for the monthly payment amount, and then substitute in values to find the amount of the monthly payment. Remember to assign any intermediate results to descriptive names for reuse later.

Show a Lab Leader your results, including the added comments answering the questions.

Problem 4: Shop for a better deal (attempt to solve symbolically with solve and allvalues)

You decide that the 6.9% amount in problem 3 is too much for a monthly payment and you can't find 5.9%, so you shop around for a better loan deal.

  1. Assuming you would be willing to pay $230 per month for 48 months, what annual interest rate will you have to find?

    Hint: solve the present value equation for the monthly interest rate and save the results with the name monthlyInterestRate.  What does Maple return?

  2. If Maple is unable to symbolically solve an equation, it may return a RootOf result.  When the solve command returns a RootOf result, the next step is to try the allvalues command. The input to the allvalues function is the RootOf result that solve returned. The allvalues command tries additional symbolic solving methods. 

Unfortunately in this case, Maple can not symbolically solve our problem even with allvalues.  In the next problem, we show you how to tell Maple to use numeric approximation techniqes to find a numeric solution instead of a symbolic solution.

Show a Lab Leader your results of trying solve and allvalues. In problem 5, solve it numerically instead.

Problem 5: Shop for a better deal (solve numerically with fsolve)

Because we were unable to symbolically solve for the desired interest rate using the solve command, we will graph the formula for various interest rates and estimate the interest rate to see if a solution exists.  To solve this problem numerically, follow these steps:

  1. Symbolically solve the present value equation for the monthly payment amount, A.
  2. Substitute numeric values for P=$10,000 and n=48 into your monthly payment amount formula.
  3. Plot your solution expression over an appropriate range to confirm the existence of an interest rate that corresponds to a monthly payment of $230.
  4. Create an equation with the expression equal to the value you seek.
  5. Use fsolve(eqn,x=range) to find a numeric solution to this problem.

What is the monthly interest rate approximation found when you use the fsolve command?  What is the annual interest rate?

ADDITIONAL PROBLEMS or FURTHER READING

The effects of inflation, or To invest or not to invest ... that is the question.

You have learned that the time value of money is determined by the interest you pay for borrowing someone else's money or the interest you receive by loaning your money. An additional complication is the effect of inflation. Inflation decreases the buying power or the value of money in the future. Thus, if you have $10,000 and hide it under your pillow, in one year it will be worth less because it will buy less than it does now because the price of goods and services has increased.

  1. Suppose you have the opportunity to invest $100,000 in a new business venture with a plan that doubles your investment in 5 years. (Sounds good, right?) Let's first consider what happens if we ignore inflation. What is the yearly rate of return on your investment?

Now let's factor in inflation. The effect of inflation is included using the following quantities and formulas:

The previous formulas can still be used, with the replacement of the interest rate a with the combined interest minus inflation rate c. The three different rates are related by the equation:

(1 + c) = (1 + i)(1 + r)

You can see that if c=i, then r=0. Thus, if the bank pays you 3% interest on your savings account and the inflation rate is 3%, then your money is earning 0% real interest. Its value is remaining constant with time. To actually gain value, you must get a non-zero real rate of return.

  1. Now let's investigate the situation when we take inflation into consideration. Use Maple's subs command to substitute the variable c for the interest rate a in each of the previous formulas for future value (of an investment) and present value (of money borrowed over time).

  2. We now return to the opportunity to double an initial investment of $100,000 in 5 years. If the inflation rate is 2.8%, what is the real yearly rate of return on your investment?

    Hint: solve the new future value of money formula for c to find a formula for the combined interest-inflation rate c. Then solve the equation that relates c, i, and r to find an expression for c in terms of i and r. Set the two expressions equal to each other and solve this equation for r.

  3. Now suppose the inflation rate is 5%. What is your real rate of return? Can you see why high rates of inflation discourage business investment?

What if there are complications?

Suppose that after you invest your $100,000 in this business venture and get started, there are a few "activists" who don’t like your business venture, who intervene, file a lawsuit, and slow down your development. You still have confidence that you will succeed but it becomes clear that it will take 9 years to double your money and not 5 as you originally planned.

What real rate of return will you now receive if the inflation rate is 2.8%?

Suppose that instead of this business venture you could have originally invested your money in a bank CD at a guaranteed interest rate of 5.5% for 5 years.

What decision would you make about investing your money in the first place? Would you take the risk to double your rate of return or would you take the safe path and invest your money in a CD? While the calculations are straightforward, assessing the potential risks is not.