Saturday, October 8, 2016

Present and Accumulated Values of an Annuity-Immediate

Problem 15.1
Consider an investment of $5,000 at 6% convertible semiannually. How much can be withdrawn each half−year to use up the fund exactly at the end of 20 years?

Solution.

Problem 15.2
The annual payment on a house is $18,000. If payments are made for 40
years, how much is the house worth assuming annual interest rate of 6%?

Solution.

Problem 15.3
If , calculate .

Solution.

Problem 15.4
Calculate the present value of 300 paid at the end of each year for 20 years
using an annual effective interest rate of 8%.

Solution.

Problem 15.5
If and , express as a function of and .

Solution.

Problem 15.6
(a) Given: , , . Find .
(b) You are given that and . Determine .

Solution.

Read More

Wednesday, September 28, 2016

Equations of Value and Time Diagram

Problem 12.1
In return for payments of $5,000 at the end of 3 years and $4,000 at the
end of 9 years, an investor agrees to pay $1500 immediately and to make an additional payment at the end of 2 years. Find the amount of the additional payment if .

Solution.

Problem 12.2
At a certain interest rate the present values of the following two payment
patterns are equal:
(i) 200 at the end of 5 years plus 500 at the end of 10 years;
(ii) 400.94 at the end of 5 years.
At the same interest rate 100 invested now plus 120 invested at the end of 5 years will accumulate to P at the end of 10 years. Calculate P.

Solution.

Problem 12.3
An investor makes three deposits into a fund, at the end of 1, 3, and 5 years. The amount of the deposit at time is . Find the size of the fund at the end of 7 years, if the nominal rate of discount convertible quarterly is .

Solution.

Problem 12.4
Brian and Jennifer each take out a loan of . Jennifer will repay her loan
by making one payment of 800 at the end of year 10. Brian will repay his
loan by making one payment of 1,120 at the end of year 10. The nominal
semi-annual rate being charged to Jennifer is exactly one-half the nominal
semi-annual rate being charged to Brian. Calculate .

Solution.

Problem 12.5
Fund A accumulates at 6% effective, and Fund B accumulates at 8% effective. At the end of 20 years the total of the two funds is 2,000. At the end of 10 years the amount in Fund A is half that in Fund B. What is the total of the two funds at the end of 5 years?

Solution.

Problem 12.6
Louis has an obligation to pay a sum of $3,000 in four years from now and a sum of $5,000 in six years from now. His creditor permits him to discharge these debts by paying in two years from now, $1000 in three years from now, and a final payment of in nine years from now. Assuming an annual effective rate of interest of 6%, find .

Solution.

Problem 12.7
Every Friday in February (7, 14, 21,28) Vick places a 1,000 bet, on credit,
with his off-track bookmaking service, which charges an effective weekly interest rate of 8% on all credit extended. Vick looses each bet and agrees to repay his debt in four installments to be made on March 7, 14, 21, and 28. Vick pays 1,100 on March 7, 14, and 21. How much must Vick pay on March 28 to completely repay his debt?

Solution.

Problem 12.8
A borrower is repaying a loan by making payments of 1,000 at the end of
each of the next 3 years. The interest rate on the loan is 5% compounded
annually. What payment could the borrower make at the end of the first
year in order to extinguish the loan?

Solution.

Problem 12.9
An investor purchases an investment which will pay 2,000 at the end of one year and 5,000 at the end of four years. The investor pays 1,000 now and agrees to pay at the end of the third year. If the investor uses an interest rate of 7% compounded annually, what is ?

Solution.

Read More

Tuesday, September 27, 2016

Solving for Unknown Time

Problem 14.1
The present value of a payment of $5,000 to be made in years is equal to the present value of a payment of $7,100 to be made in years. If find $t4.

Solution.

Read More

Monday, September 26, 2016

Solving for the Unknown Interest Rate

Problem 12.1
In return for payments of $5,000 at the end of 3 years and $4,000 at the
end of 9 years, an investor agrees to pay $1500 immediately and to make an additional payment at the end of 2 years. Find the amount of the additional payment if .

Solution.

Problem 12.2
At a certain interest rate the present values of the following two payment
patterns are equal:
(i) 200 at the end of 5 years plus 500 at the end of 10 years;
(ii) 400.94 at the end of 5 years.
At the same interest rate 100 invested now plus 120 invested at the end of 5 years will accumulate to P at the end of 10 years. Calculate P.

Solution.

Problem 12.3
An investor makes three deposits into a fund, at the end of 1, 3, and 5 years. The amount of the deposit at time is . Find the size of the fund at the end of 7 years, if the nominal rate of discount convertible quarterly is .

Solution.

Problem 12.4
Brian and Jennifer each take out a loan of . Jennifer will repay her loan
by making one payment of 800 at the end of year 10. Brian will repay his
loan by making one payment of 1,120 at the end of year 10. The nominal
semi-annual rate being charged to Jennifer is exactly one-half the nominal
semi-annual rate being charged to Brian. Calculate .

Solution.

Problem 12.5
Fund A accumulates at 6% effective, and Fund B accumulates at 8% effective. At the end of 20 years the total of the two funds is 2,000. At the end of 10 years the amount in Fund A is half that in Fund B. What is the total of the two funds at the end of 5 years?

Solution.

Problem 12.6
Louis has an obligation to pay a sum of $3,000 in four years from now and a sum of $5,000 in six years from now. His creditor permits him to discharge these debts by paying in two years from now, $1000 in three years from now, and a final payment of in nine years from now. Assuming an annual effective rate of interest of 6%, find .

Solution.

Problem 12.7
Every Friday in February (7, 14, 21,28) Vick places a 1,000 bet, on credit,
with his off-track bookmaking service, which charges an effective weekly interest rate of 8% on all credit extended. Vick looses each bet and agrees to repay his debt in four installments to be made on March 7, 14, 21, and 28. Vick pays 1,100 on March 7, 14, and 21. How much must Vick pay on March 28 to completely repay his debt?

Solution.

Problem 12.8
A borrower is repaying a loan by making payments of 1,000 at the end of
each of the next 3 years. The interest rate on the loan is 5% compounded
annually. What payment could the borrower make at the end of the first
year in order to extinguish the loan?

Solution.

Problem 12.9
An investor purchases an investment which will pay 2,000 at the end of one year and 5,000 at the end of four years. The investor pays 1,000 now and agrees to pay at the end of the third year. If the investor uses an interest rate of 7% compounded annually, what is ?

Solution.

Read More

Thursday, July 28, 2016

HTML, CSS - Center Vertically (SLIDE MENU)

HTML:
CSS:
div.container {
    position: relative ;
    width: 250px;
    height: 250px;
    background-color: green;

 }
 
div.left {
    margin: 0;
    background: black;
    opacity: 0.65;
    position: absolute;
    top: 50%;
    transform: translate(-0%, -50%);
   height: 61px;
   width: 38px;
   left: 0px;
}
   
 div.right {
    margin: 0;
    background: black;
    opacity: 0.65;
    position: absolute;
    top: 50%;
    transform: translate(-0%, -50%);
   height: 61px;
   width: 38px;
   right: 0px;
}
   
(jsFiddle demo here)
Credit:
* Centering Things
Read More

Tuesday, July 26, 2016

Swift Request for Authorization

* Photos
func requestForAccessPhotos(view : UIViewController, completionHandler: (accessGranted: Bool) -> Void){
        let authorizationStatus = PHPhotoLibrary.authorizationStatus()
        
        switch authorizationStatus {
        case .Authorized:
            completionHandler(accessGranted: true)
        case .Denied, .NotDetermined:
            PHPhotoLibrary.requestAuthorization() {(status) -> Void in
                switch status {
                case .Authorized:
                    completionHandler(accessGranted: true)
                case .Denied, .Restricted:
                    dispatch_async(dispatch_get_main_queue(), { () -> Void in
                        Handler().permissionAlert(view, title: "Access Denied", message: "Please allow the app to access your photos through the Settings.")
                    })
                default:
                    completionHandler(accessGranted: false)
                }
            }
        default:
            completionHandler(accessGranted: false)
        }
    }


* Contacts
func requestForAccessContacts(view : UIViewController, completionHandler: (accessGranted: Bool) -> Void) {
        let authorizationStatus = CNContactStore.authorizationStatusForEntityType(CNEntityType.Contacts)
        
        switch authorizationStatus {
        case .Authorized:
            completionHandler(accessGranted: true)
            
        case .Denied, .NotDetermined:
             contactStore.requestAccessForEntityType(CNEntityType.Contacts, completionHandler: { (access, accessError) -> Void in
                if access {
                    completionHandler(accessGranted: access)
                }
                else {
                    if authorizationStatus == CNAuthorizationStatus.Denied {
                        dispatch_async(dispatch_get_main_queue(), { () -> Void in
                            Handler().permissionAlert(view, title: "Access Denied", message: "Please allow the app to access your contacts through the Settings.")
                        })
                    }
                }
            })
            
        default:
            completionHandler(accessGranted: false)
        }
    }


* Photos
func requestForAccessCalendar(view : UIViewController, send : UISwitch, completionHandler : (accessGranted : Bool) -> Void){
        let authorizationStatus = EKEventStore.authorizationStatusForEntityType(EKEntityType.Event)
        
        switch authorizationStatus {
        case .Authorized:
            completionHandler(accessGranted: true)
        case .Denied, .NotDetermined:
            let eventStore = EKEventStore()
            eventStore.requestAccessToEntityType(EKEntityType.Event, completion: { (access, accessError) -> Void in
                if access {
                    completionHandler(accessGranted: access)
                }
                else {
                    if authorizationStatus == EKAuthorizationStatus.Denied {
                        dispatch_async(dispatch_get_main_queue(), { () -> Void in
                             Handler().permissionAlert(view, title: "Access Denied", message: "Please allow the app to access your calendar through the Settings.")
                            send.setOn(false, animated:true)
                        })
                    }
                }
            })
            
        default:
             completionHandler(accessGranted: false)
        }
        
    }


* Camera
func requestForAVCature(view : UIViewController, completionHandler : (accessGranted : Bool) -> Void){
        let authorizationStatus = AVCaptureDevice.authorizationStatusForMediaType(AVMediaTypeVideo)
      
        switch authorizationStatus {
        case .Authorized:
            completionHandler(accessGranted: true)
        case .Denied, .NotDetermined:
            AVCaptureDevice.requestAccessForMediaType(AVMediaTypeVideo, completionHandler: { (granted : Bool) -> Void in
                if(granted){ // Access has been granted ..do something
                    completionHandler(accessGranted: true)
                } else { // Access denied ..do something
                    if authorizationStatus == AVAuthorizationStatus.Denied {
                        dispatch_async(dispatch_get_main_queue(), { () -> Void in
                            Handler().permissionAlert(view, title: "Access Denied", message: "Please allow the app to access your calendar through the Settings.")
                        })
                    }
                }
            })

        default:
            completionHandler(accessGranted: false)
        }
        
    }


* Inside the 'Handler' class
func permissionAlert(view: UIViewController, title : String?, message : String?){
        let alertController = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.Alert)
        alertController.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: nil))
        
        view.presentViewController(alertController, animated: true, completion: nil)
    }
Read More

Monday, July 25, 2016

Swift Infix Custom Threading

Code:
func ~> (task: ()->Void, update: ()-> Void)
{
    let priority = DISPATCH_QUEUE_PRIORITY_DEFAULT
    dispatch_async(dispatch_get_global_queue(priority, 0)) {
        // do some task
        task()
        dispatch_async(dispatch_get_main_queue()) {
            // update some UI
            update()
        }
    }
}

Usage:
 ({
     for i in 0..<100000{
            print("count: \(i)")
         }
     })~>({
         print("Finished counting")
 })

CREDITS:
* Background Threads
* Custom Operators in Swift

Read More