zoukankan      html  css  js  c++  java
  • integration computation in R,computing the accumulation,derivatives,partial derivatives of various higher order function

    求二元二次方程的偏导数:
    > fun=expression(x^2+y^2+x*y)
    > D(fun,"x")
    2 * x + y
    > D(fun,"y")
    2 * y + x
    > D(D(fun,"x"),"x")
    [1] 2
    > D(D(fun,"x"),"y")
    [1] 1

    继续:要求函数x 2 +y 2 +x?y 在(2,3)处的关于x 的一阶偏导数

    > x=2;y=3
    > eval(D(expression(x^2+y^2+x*y),"x"))
    [1] 7

    trig.exp <- expression(sin(cos(x + y^2)))
    D.sc <- D(trig.exp, "x")
    all.equal(D(trig.exp[[1]], "x"), D.sc)


    ## Higher derivatives
    deriv3(y ~ b0 + b1 * 2^(-x/th), c("b0", "b1", "th"), c("b0", "b1", "th", "x") )

    ## Higher derivatives(更高维的导数)
    DD <- function(expr,name, order = 1) {
    if(order < 1) stop("'order' must be >= 1")
    if(order == 1) D(expr,name)
    else DD(D(expr, name), name, order - 1)
    }
    DD(expression(sin(x^2)), "x", 3)

     矩阵的求导法则:

     两个常用的两个矩阵的求导法则公式:

  • 相关阅读:
    Freemarker与Springmvc
    Freemarker与普通java
    Freemarker与Servlet
    跳舞的时间插件
    video标签播放视频
    字符串反转
    菲波拉契数列
    求所有子数组的和的最大值
    Spring AOP 5种通知与java动态代理
    线程维护日志队列
  • 原文地址:https://www.cnblogs.com/beckygogogo/p/9224360.html
Copyright © 2011-2022 走看看