Skip to content

Commit

Permalink
More typos
Browse files Browse the repository at this point in the history
  • Loading branch information
rdpeng committed Apr 22, 2014
1 parent 873d883 commit 7f657dd
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
### Introduction

This comment has been minimized.

Copy link
@NimblePeeledWolf

NimblePeeledWolf Jan 31, 2024

Function to create a special "matrix" object that can cache its inverse

makeCacheMatrix <- function(matrix = matrix()) {

create an empty cache

cache <- NULL

Define a list to set and get the matrix

matrixObj <- list(
set = function(newMatrix) {
matrix <<- newMatrix
# Invalidate the cache when matrix is updated
cache <<- NULL
},
get = function() matrix,
# Function to set the inverse of the matrix in the cache
setInverse = function(inverse) cache$inverse <<- inverse,
# Function to get the inverse of the matrix from the cache
getInverse = function() cache$inverse
)

return(matrixObj)
}

Function to compute the inverse of the special "matrix" object

cacheSolve <- function(matrixObj, ...) {

return the matrix from the cache object

matrix <- matrixObj$get()

Check if the inverse is already in the cache

if (!is.null(matrixObj$getInverse())) {
cat("Getting cached inverse:\n")
return(matrixObj$getInverse())
} else {
# If not in cache, get the inverse using solve
inverse <- solve(matrix, ...)
# Cache the computed inverse
matrixObj$setInverse(inverse)
cat("Computing inverse and caching:\n")
return(inverse)
}
}

This comment has been minimized.

Copy link
@NitishKumar2529

NitishKumar2529 May 5, 2024

good

This second programming assignment will require you to write an R
function that is able to cache potentially time-consuming computations. For
example, taking the mean of a numeric vector is typically a fast
function that is able to cache potentially time-consuming computations.

This comment has been minimized.

Copy link
@lfbecerra

lfbecerra Feb 2, 2021

#Luis Fernando Becerra Gallardo
#Coursera
#Week 3

#Creamos la función para que haga la mtriz

makeCacheMatrix <- function(x=matrix()){
inv=NULL
set <- function(y){
x<<-y
inv<<-NULL
}
get <- function(){x}
setInverse <- function(inverse){inv <<- inverse}
getInverse <- function(){inv}
list(set=set,get=get,setInverse=setInverse, getInverse=getInverse)
}

cacheSolve <- function(x, ...){
inv <- x$getInverse()
if(!is.null(inv)){
message("Regresa a cache data")
return(inv)
}
mat <- x$get()
inv <- solve(mat, ...)
x$setInverse(inv)
inv
}

datos <- makeCacheMatrix(matrix(1:4,nrow =2,ncol = 2))
datos$get()
datos$getInverse()
cacheSolve(datos)

This comment has been minimized.

Copy link
@YoshanX

YoshanX Sep 8, 2021

nice

This comment has been minimized.

Copy link
@FFFFFionaLu

FFFFFionaLu Sep 17, 2021

cool. I think you are right

This comment has been minimized.

Copy link
@Megadata88

Megadata88 Sep 20, 2023

nice!

This comment has been minimized.

Copy link
@Utkarsh1075

Utkarsh1075 Nov 15, 2023

nice!

This comment has been minimized.

Copy link
@NitishKumar2529

NitishKumar2529 May 5, 2024

good

For example, taking the mean of a numeric vector is typically a fast
operation. However, for a very long vector, it may take too long to
compute the mean, especially if it has to be computed repeatedly (e.g.
in a loop). If the contents of a vector are not changing, it may make
sense to cache the value of the mean so that when we need it again, it
can be looked up in the cache rather than recomputed. In this
Programming Assignment you will take advantage of the scoping rules of the R
language and how they can be manipulated to preserve state inside of an
R object.
Programming Assignment you will take advantage of the scoping rules of
the R language and how they can be manipulated to preserve state inside
of an R object.

### Example: Caching the Mean of a Vector

Expand Down Expand Up @@ -76,8 +76,8 @@ Write the following functions:
that can cache its inverse.

This comment has been minimized.

Copy link
@HisraelPassarelli

HisraelPassarelli Mar 26, 2020

Nice job! 👍

This comment has been minimized.

Copy link
@Brandon780

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Copy link
@YoshanX

YoshanX Sep 8, 2021

nice

This comment has been minimized.

Copy link
@FFFFFionaLu

FFFFFionaLu Sep 17, 2021

nice

This comment has been minimized.

Copy link
@Utkarsh1075
2. `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 the
`cachesolve` should retrieve the inverse from the cache.
already been calculated (and the matrix has not changed), then
`cacheSolve` should retrieve the inverse from the cache.

Computing the inverse of a square matrix can be done with the `solve`
function in R. For example, if `X` is a square invertible matrix, then
Expand Down

66 comments on commit 7f657dd

@PGirdhar
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I edited the code online on GitHub webpage. Now I do not understand how to do the next step.
Commit your completed R file into YOUR git repository and push your git branch to the GitHub repository under your account.

@2051289v
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

I am stuck with the same problem. I have an R file but no idea what I need to do with it to make it go to where it is supposed to go... is "MY" git repository the one I cloned? Different one? How do I push and where? Thanks...

@ebehrouz
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whole story is very confusing!

@Ashleshadk
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am very confused . I dont know how add code into this. From where to start. and I am stuck. though I am following instructions but still confused

@angadgrover91
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this thing is pretty darm confusing

@soumikchaudhuri
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simply cannot submit the assignment, the whole process is so confusing. So much time is already wasted, is not there a simpler way to achieve "submission"?

@web4zn
Copy link

@web4zn web4zn commented on 7f657dd Dec 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R programing(chinese version) for this month can't Evaluate because the Evaluation time is wrong.
i hope you will read this and fix the problem before the course close.

_skuzov ik 8 wy_psgrfm

@savithriDevaraj
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe I commited my R program to github, but I am not sure.
After clicking a few things I see
"commit ca5f5bcba2631beb764c7a084gg91f8be9bc173a"
Is that it?

I didn't use any git tools - just went on the browser...
Any help appreciated

@bjimmykim
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bjimmykim
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, let me know how you make the submitted homework. And check the unconfirmed error.

@web4zn
Copy link

@web4zn web4zn commented on 7f657dd Jan 28, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fcerda
Copy link

@fcerda fcerda commented on 7f657dd Feb 13, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very confusing. I need help

@yangfantrinity
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this, hope it is correct and can help those confused classmates:
1: create an account in GitHub
2: create the exactly two same files as the two given under account "rdpeng". They are README.md, and cachematrix.R.
3: in the instruction, we are asked to clone GitHub repository to my computer. But unfortunately my MacOS is too old to clone it. So I skipped this step. What I will do is I will just create the functions in my RStudio
4: Submit my assignment to my repository under my account. I will just copy the functions from RStudio into the file "cachematrix.R" under my account
5: Copy the URL link of my R functions to Coursera.

@amitnene
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Prof. Just submitted the assignment.

@reactor2006
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ellynguyen
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks freemansugar , your information has cleared my confuse

@andrelmfsantos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried put my project but i didn't get. My url project is https://github.com/andrelmfsantos/ProgrammingAssignment2/blob/master/cachematrix.R

@AnaIngstrom
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it is because you need to follow the instructions from the course Data Scientist's Toolbox?

@ro4495
Copy link

@ro4495 ro4495 commented on 7f657dd Jun 3, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code submission is very confused. Not sure why do they made so complex ?

@yangfantrinity
Copy link

@yangfantrinity yangfantrinity commented on 7f657dd Jun 3, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sujitseth
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assignment submission is very confusing
https://github.com/sujitseth/ProgrammingAssignment2
73d917c

@mespinosat
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have my homework on my computer but I could not raise it , they could tell me the steps to upload the task.

@DiegoBravoDiaz
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't upload the task nether, I don't understand the process of.

@Ashwaqalsufyani
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am really confused!!
I know the answer but I can not upload the task !!!!!!!

@sarabatash
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chacin
Copy link

@chacin chacin commented on 7f657dd Apr 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am confused by the whole GitHub process also. Just in case this is allowed, this is my submission

https://github.com/chacin/ProgrammingAssignment2.git

@z1y1p1
Copy link

@z1y1p1 z1y1p1 commented on 7f657dd May 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been struggling with the assignment submission too - every time I push, it was the old R file instead of my updated R scripts - though I have made changes to it. I do not know what happened.

@inertalan
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyone who is confuse about how to submit your assignment to Github, I really suggest you check out the course of _Data Scientists ToolBox_on Coursera, which is also taught by Prof Roger D. Peng.

@Caro593
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Its really good

@flora03222
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how to submit my assignment.

@GaoYa11235
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, Peng. I have submitted my work but when I review others work I found that they have two contributors including you, while I only have one. Does this can be a problem?

@NidaBat
Copy link

@NidaBat NidaBat commented on 7f657dd Apr 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wangJoan
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ZXXzhaoxiaoxiang
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DATASCIENTIST59
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ProgrammingAssignment2-master-DATASCIENTIST59/cachematrix.R
3450aef954a7ee7eee4409c94c1977a37b55035f

@Eonixyn
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yeiraptor
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mstfait
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mstfait
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you please review my assignment
https://github.com/Mstfait/ProgrammingAssignment2
18abc3d

@erlcssont29i
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thoughtful01
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/thoughtful01/ProgrammingAssignment2
Could anybody please review my assignment? Thank you!

@emarucot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just committed it.

@aniket1911
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aniket1911
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/aniket1911/ProgrammingAssignment2.git
29bde57
c719adb

please review mine, I have spent 2 weeks to learn to push it here. Million thanks in advance.

@Laxmikanth-p
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi. This is my assignment please review and advise.

Laxmikanth-p@1c44496#diff-64adb242cae0ccf656a2d32f63413754

@Yalda78
Copy link

@Yalda78 Yalda78 commented on 7f657dd Apr 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just committed it.

@abushleakh3432-tech951

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caching the Inverse of a Matrix
Caching the Inverse of a Matrix.docx

@abushleakh3432-tech951

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A step forward.

@HisraelPassarelli
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

@ShwethaNS
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sir by mistake I have linked my branch with the original. Sir please delete it as I am not able to do it. I tried a lot. Sir please do it as soon as possible.
Sorry for the trouble. Please help me with this.

@pamithmindula
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PU19971997
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Eli-24
Copy link

@Eli-24 Eli-24 commented on 7f657dd Sep 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put comments here that give an overall description of what your

functions do

Caching the Inverse of a Matrix

Write a short comment describing this function

makeCacheMatrix <- function(x = matrix()) {

}

This function creates a special "matrix" object that can cache its inverse.

Write a short comment describing this function

cacheSolve <- function(x, ...) {
## Return a matrix that is the inverse of 'x'
}

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.

makeVector <- function(x = numeric()) {
m <- NULL
set <- function(y) {
x <<- y
m <<- NULL
}
get <- function() x
setmean <- function(mean) m <<- mean
getmean <- function() m
list(set = set, get = get,
setmean = setmean,
getmean = getmean)
}
cachemean <- function(x, ...) {
m <- x$getmean()
if(!is.null(m)) {
message("getting cached data")
return(m)
}
data <- x$get()
m <- mean(data, ...)
x$setmean(m)
m
}
makeCacheMatrix <- function( m = matrix() ) {
i <- NULL
set <- function( matrix ) {
m <<- matrix
i <<- NULL
}
get <- function() {
m
}
setInverse <- function(inverse) {
i <<- inverse
}
getInverse <- function() {
i
}
list(set = set, get = get,
setInverse = setInverse,
getInverse = getInverse)
}
cacheSolve <- function(x, ...) {
m <- x$getInverse()
if( !is.null(m) ) {
message("getting cached data")
return(m)
}
data <- x$get()
m <- solve(data) %*% data
x$setInverse(m)
m
}

@Sandra-Vera
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AngieAponte
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FFFFFionaLu
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have confused about the last part. You can add # to explain it.

@natymiranda90
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assignment was confused for me. i dont know where can i see the SHA-1 hash that i need to submit my assignment.
Can all of you go to my assignment and give me a review. Thanks in advance

https://github.com/natymiranda90/ProgrammingAssignment2/blob/main/README.md

@ValeriaMonB
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mehdifera
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so confusing!! I have this code but I really don't know where should I publish it for this assignment!:
makeCacheMatrix <- function(x) {
inv <- NULL

set <- function(y) {
x <<- y
inv <<- NULL # Clear the cached inverse
}

get <- function() {
x
}

setInverse <- function(inverse) {
inv <<- inverse
}

getInverse <- function() {
inv
}

list(set = set, get = get, setInverse = setInverse, getInverse = getInverse)
}

cacheSolve <- function(x) {
inv <- x$getInverse()

if (!is.null(inv)) {
message("Fetching inverse from cache...")
return(inv)
}

matrix <- x$get()
inv <- solve(matrix)
x$setInverse(inv)

inv
}

The makeCacheMatrix function creates a special "matrix" object that can cache its inverse. It takes a matrix x as an argument and returns a list of functions. The functions in the list are used to manipulate and access the matrix object.

The cacheSolve function computes the inverse of the matrix object created by makeCacheMatrix. It checks if the inverse has already been calculated and cached. If the inverse is found in the cache, it is retrieved. Otherwise, it calculates the inverse using solve and caches it for future use.

@AnuskhaSachan
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this, hope it is correct and can help those confused classmates: 1: create an account in GitHub 2: create the exactly two same files as the two given under account "rdpeng". They are README.md, and cachematrix.R. 3: in the instruction, we are asked to clone GitHub repository to my computer. But unfortunately my MacOS is too old to clone it. So I skipped this step. What I will do is I will just create the functions in my RStudio 4: Submit my assignment to my repository under my account. I will just copy the functions from RStudio into the file "cachematrix.R" under my account 5: Copy the URL link of my R functions to Coursera.
good work !

Please sign in to comment.