R type conversion [removed]) function()

前端 未结 3 1565
谎友^
谎友^ 2021-02-15 03:26

I\'ve been trying to write a program in R that implements Newton\'s method. I\'ve been mostly successful, but there are two little snags that have been bothering me. Here\'s m

3条回答
  •  再見小時候
    2021-02-15 03:44

    Josh has answered your question

    For part 2 you could have used

    g <- expression( sin(x) )
    
    g[[1]]
    # sin(x)
    
    f <- function(x){ eval( g[[1]] ) }
    
    f(0)
    # [1] 0
    f(pi/6)
    # [1] 0.5
    

提交回复
热议问题