Question

Problem 1.3 In this example we will compare how the return to saving depends on how frequently interest is compounded. We say

in julia
0 0
Add a comment Improve this question Transcribed image text
Answer #1

ANSWER;

function R(r, n)
return (1+r/n)^n
end

r = 0.10

# using loop
loopAns = Float64[] # empty vector
for i = 1:100 # for-loop
push!(loopAns, R(r,i)) # push return value
end
println("Calcuated return using for-loop\n",loopAns)

# using vectorization
n = collect(1:100) # vector containing values from 1 to 100
vectorAns = R.(r,n)
println("Calcuated return using vectorization\n",vectorAns)

Output:

1.li Result $julia main.jl Calcuated return using for-loop (1.1, 1.1025, 1.10337, 1.10381, 1.10408, 1.10426, 1.10439, 1.10449

Add a comment
Know the answer?
Add Answer to:
in julia Problem 1.3 In this example we will compare how the return to saving depends...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • please follow the instruction ( very important ) 1912275-dt content-rid 43901523 1/courses/CSct A31. (25 pts) You...

    please follow the instruction ( very important ) 1912275-dt content-rid 43901523 1/courses/CSct A31. (25 pts) You must use a tor loop in the following program Write, compile, debug, and run a program that will use a for loop to do the following Some investments compound interest. This means that the interest is added onto the balance periodically during the year, and the next interest is calculated on this larger balance. This makes the actual return on investment actually greater than...

  • The good news - saving $10 per month We continue with the same example: you deposit $10 per month into a savings account with an annual interest rate of 30%, compounded monthly. Use your formula f(r)...

    The good news - saving $10 per month We continue with the same example: you deposit $10 per month into a savings account with an annual interest rate of 30%, compounded monthly. Use your formula f(r) to answer the following questions. (a) Determine the amount in the account after 1 year. How much is interest? (b) Determine the amount in the account after 10 years. How much is interest? (c) Determine the amount in the account after 45 years. How...

  • What would a compound interest formula look like coded in PHP? The Compound Interest Formula is:...

    What would a compound interest formula look like coded in PHP? The Compound Interest Formula is: ? = ? (1 + ? ? ) ?? Where P = principal amount (the initial amount you borrow or deposit) r = annual rate of interest (as a decimal) t = number of years the amount is deposited or borrowed for. A = amount of money accumulated after n years, including interest. n = number of times the interest is compounded per year...

  • For this lab, modify the python code below so it will continuously be asking user for...

    For this lab, modify the python code below so it will continuously be asking user for inputs to calculate the interest earned until the user enters number 0 (zero) in principle. Once the user enters any number less or equal to 0 in principle, the program will end. here is my code: # Programming Exercise 3-14 # Local variables p = 0.0 r = 0.0 n = 0.0 t = 0.0 loop = True while loop: p = float(input('\nEnter the...

  • 14.Compound Interest hank account pays compound interest, it pays interest not only on the principal amount...

    14.Compound Interest hank account pays compound interest, it pays interest not only on the principal amount that was deposited into the account, but also on the interest that has accumulated over time. Suppose you want to deposit some money into a savings account, and let the account earn compound interest for a certain number of years. The formula for calculating the balance of the account afer a specified namber of years is The terms in the formula are A is...

  • Time Value of Money Spreadsheet Example 4 Module IV Name: Date: 6 7 8 Question 1 9 Question 2 10 Question 3 11 Question...

    Time Value of Money Spreadsheet Example 4 Module IV Name: Date: 6 7 8 Question 1 9 Question 2 10 Question 3 11 Question 4 12 Question 5 13 Question 6 14 Question 7 15 Question 8 16 Question 9 17 Question 10 18 19 20 Single Amount or Annuity 21 Periodic Interest Rate 22 Number of Periods 23 24 25 Present Value of Single Amount 26 27 Future Value of Single Amount 28 29 Future Value of An Annuity...

  • SOLVE USING C!!! Project objective: Conditional statements, loops, reading from file, user defined functions. **Submit source...

    SOLVE USING C!!! Project objective: Conditional statements, loops, reading from file, user defined functions. **Submit source code (LargeProg1.c) through Canvas One source code file(unformatted text) will be submitted Here is INCOMPLETE code to get started: LargeProg1.c The file name must match the assignment The code should be tested and run on a Microsoft compiler before it is uploaded onto Canvas The code must be submitted on time in order to receive credit (11:59PM on the due date) Late submissions will...

  • In lecture, Professor Gruber explained discrete compounding interest. Interest can also be compounded continuously. Here we...

    In lecture, Professor Gruber explained discrete compounding interest. Interest can also be compounded continuously. Here we explain the difference. Professor Gruber calculated future value as FV = P(1+r)", where P is the principal, r is the interest rate, and t is the term of the contract (often in years). This formula can be generalized to FV = P(1+r/m)mt, where m is the number of compounding periods per year (in lecture, this was 1). That is, after every compounding period, more...

  • I need help on question 2. MODULE IV: TIME VALUE OF MONEY INTRODUCTION The time value...

    I need help on question 2. MODULE IV: TIME VALUE OF MONEY INTRODUCTION The time value of money analysis has many a lysis has many applications, ranging from setting hedules for paying off loans to decisions about whether to invest in a partie financial instrument. First, let's define the following notations: I = the interest rate per period Na the total number of payment periods in an annuity PMT = the annuity payment made each period PV = present value...

  • Number 16. Chapter 3 Problem Comes from "Starting out with >>> C++ From Control Structures through...

    Number 16. Chapter 3 Problem Comes from "Starting out with >>> C++ From Control Structures through Objects" Ninth Edition. Checking work Programming Challenges 147 16. Senior Citizen Property Tax Madison County provides a $5,000 homeowner exemption for its senior citizens. For example, if a senior's house is valued at $158,000, its assessed value would be $94,800, as explained above. However, he would only pay tax on $89,800. At last year's tax rate of $2.64 for cach $100 of assessed value,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT