请教一下各位大佬,在不使用现存函数的前提下,如何自动生成高斯
mathematica吧
全部回复
仅看楼主
level 3
OOO1OOO1OO 楼主
请教一下各位大佬,在不使用现存函数的前提下,如何自动生成高斯积分的积分坐标和权重
2020年06月27日 13点06分 1
吧务
level 12
按照定义用正交多项式构造就行,代码很简单,比如这是我之前写过的高斯勒让德积分点的求法,两行完事
getGaussPoint[n_] := Module[{pts, weight},
pts = List @@ NRoots[LegendreP[n, x] == 0, x][[All, -1]];
weight = LinearSolve[Table[pts^i, {i, 0, n - 1}],
Table[(1 + (-1)^i)/(1 + i), {i, 0, n - 1}]];
{pts, weight}
]
其他的也类似,公式可以参考这里:https://wenku.baidu.com/view/f6e8c7cf8762caaedd33d4af.html
2020年06月27日 14点06分 2
好的 谢谢您
2020年06月28日 01点06分
这帖有好几个方法:mathematica.stackexchange.com/a/6966/1871
2020年07月04日 03点07分
1