如何解决如何在R中使用simple方法来解决错误?
这是我第一次尝试使用R计算表达式的导数。我尝试了以下代码:
library(Ryacas) # open the Ryacas package.
f <- expression(asin(2*x/(1 + x^2))) # insert the expression.
d <- D(f,'x') # find the expression's derivative.
print(d) # print the derivative of f.
simple_d <- simplify(d) # make the mathematical expression of the derivative simpler.
print(simple_d) # print the simply expressed derivative of f.
Error in UseMethod("simplify") :
no applicable method for 'simplify' applied to an object of class "call"
对此有何想法?我应该如何在simplify()
之类的表达式上正确使用d
方法?
谢谢!
解决方法
使用Ryacas0,如下所示:
library(Ryacas0)
x <- Sym("x")
f <- asin(2*x/(1 + x^2))
d <- deriv(f,x)
d
Simplify(d)
或像这样的Ryacas:
library(Ryacas)
x <- ysym("x")
f <- asin(2*x/(1 + x^2))
d <- deriv(f,x)
d
simplify(d)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。