请在 R 中放入以下结构:
g <- c(0.00125277273229879, 0.00126154615176554, 0.0012703959424814,
0.00127932294600281, 0.00128832795839672, 0.00129741176435766,
0.00130657513720778, 0.00131581896967928, 0.00132514399529097,
0.00133455111246124, 0.00134404117411893, 0.0013536149592724,
0.00136327342888814, 0.00137301739609167, 0.00138284774792897,
0.00139276542262179, 0.00140277127309897, 0.00141286625464083,
0.00142305128272433, 0.0508421359805228, 0.00186998245686827,
0.00188362983020243, 0.00189739567535365, 0.00191128104995371,
0.00192528723908206, 0.00193941540840815, 0.00195366674065997,
0.00196804251523079, 0.00198254393190719, 0.0019971722359653,
0.00201192874091554, 0.00202681464654449, 0.0020418313232245,
0.00205698005034884, 0.00207226214711413, 0.002087678932717,
0.00210323179458836, 0.00211892205192484, 0.00213475116039167,
-0.114451596942742, 0.00120694924932032, 0.00121602907494663,
0.00122519601872553, 0.00123445103025114, 0.00124379508186234,
0.00125322929373903, 0.00126275455292721, 0.00127237205352726,
0.00128208273376092, 0.00129188771380808)
gx <- c(122.05, 122.1, 122.15, 122.2, 122.25, 122.3, 122.35, 122.4,
122.45, 122.5, 122.55, 122.6, 122.65, 122.7, 122.75, 122.8, 122.85,
122.9, 122.95, 123, 123.05, 123.1, 123.15, 123.2, 123.25, 123.3,
123.35, 123.4, 123.45, 123.5, 123.55, 123.6, 123.65, 123.7, 123.75,
123.8, 123.85, 123.9, 123.95, 124, 124.05, 124.1, 124.15, 124.2,
124.25, 124.3, 124.35, 124.4, 124.45, 124.5)
我想找到一个 interpolate 的函数g ~ gx
,但它应该有一些特殊的功能:
- 它应该以函数形式表示,例如,如果它是一个多项式,它应该返回我的多度和系数(如果它是渐近正常的,那就太好了!)。
- 我需要整合函数形式,如果有人能告诉我R是否可以解决非数值积分,我将不胜感激。
作为第二个特征的一个例子,考虑
y <- function(x) {
x ^ 2
}
有没有办法y
与 R 积分可以返回我(x ^ 3) / 3
而不是在积分极值之间评估的数值?
谢谢,