繁体   English   中英

R 中的错误:在外推表中检测到舍入错误

[英]Error in R: roundoff error is detected in the extrapolation table

我正在尝试通过在 R 中集成 function 来计算消费者剩余。

PID = 2040;
integrand <- function(x) {320000*x^(-0.1)} 
integrate(integrand, lower = PID, upper = Inf,  
          rel.tol=.Machine$double.eps^.05 )$value

然后错误显示“在外推表中检测到舍入错误”。 如果我将指数更改为 -1,则不会显示错误并且它会发出一个值。 如何通过保持指数值 -0.1 来修复错误?

非常感谢您提前提供的帮助。

尝试这个,

PID = 2040;
integrand <- function(x) {320000*x^(-0.1)} 
integrate(integrand, lower = PID, upper = .Machine$double.xmax, rel.tol=.Machine$double.eps^.05 )$value

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM