Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R中函数的图反导数_R_Plot - Fatal编程技术网

R中函数的图反导数

R中函数的图反导数,r,plot,R,Plot,在我的家庭作业中,我必须画出一个函数的反导数。 职能: newF <- function(x) {0.75 - 0.75*x^2} newFVectorize(newF)是冗余的。您的函数已矢量化。“曲线中的错误(expr=x…:'expr'未计算为长度为'n'的对象”。这是现在出现的。它不适合我。你正在做其他不同的事情。我的意思是,你显示的代码没有使用你的newFVec。对不起,你完全正确。我以为你的意思是`FVec原语应该定义为F newFVec <- Vectorize(ne

在我的家庭作业中,我必须画出一个函数的反导数。 职能:

newF <- function(x) {0.75 - 0.75*x^2}

newF
Vectorize(newF)
是冗余的。您的函数已矢量化。“曲线中的错误(expr=x…:'expr'未计算为长度为'n'的对象”。这是现在出现的。它不适合我。你正在做其他不同的事情。我的意思是,你显示的代码没有使用你的
newFVec
。对不起,你完全正确。我以为你的意思是`FVec原语应该定义为
F
newFVec <- Vectorize(newF) #Vectorize F to get a valid input for plot method
F <- function(t) {integrate(newF, lower = -2, upper = 2)$value} # get integral between -2 and 2

FVec <- Vectorize(F) #Vectorize the antiderivative


plot(FVec, type="b", from = -2, to = 2, lty = 1, col = "blue") #try to plot FVec