R-Programming - Assignment 2

April 18, 2015


Report Abuse
This is assignment 2 for "Introduction to R Programming" course
This experiment implements a function that is able to cache potentially time-consuming computations. Matrix inversion is usually a costly computation and there may be some benefit to caching the inverse of a matrix rather than computing it repeatedly. This experiment implements the following functions: 1. makeCacheMatrix : This function creates a special "matrix" object that can cache its inverse. 1. cacheSolve : This function computes the inverse of the special "matrix" returned by makeCacheMatrix above. If the inverse has already been calculated (and the matrix has not changed), then cacheSolve should retrieve the inverse from the cache. This is part of [Introduction to R programming course](https://www.coursera.org/course/rprog) The experiment graph for this assignment is shown below. For this experiment, we find the matrix order, create special matrix using scoping rules of R, and finally wrote the function to retrieve the matrix from cache where applicable as a script in **Execute-R** module. ![](http://neerajkh.blob.core.windows.net/images/ass2part1_1.PNG) The following figure shows the output of cache matrix. The first retrieval actually performs inverse of matrix and returns the inverse. The second retrieval is from cache without computing the matrix inverse. ![](http://neerajkh.blob.core.windows.net/images/ass2part1_2.PNG)