Go hokies分享 http://blog.sciencenet.cn/u/cobra22

博文

A Numerical Integration Problem

已有 3859 次阅读 2010-4-20 07:35 |个人分类:科研笔记|系统分类:科研笔记

Compute w_i and x_i (i=0,1,2) such that the formula

is exact is f is a polynomial of degree equal or less than 5. Give w_i and x_i to 12 significant digits.

In Mathematica, we can solve this problem by the following steps:

1) get the orthgonal polynomials

Orthogonalize[{1,x,x^2,x^3},Integrate[Cos[x*Pi/2]#1 #2,{x,-1,1}]&]

2) find roots for the 4th polynomial you got, which are x_i's

NumberForm[NRoots[-(((384-48 [Pi]^2+[Pi]^4) x)/([Pi]^2 (-8+[Pi]^2)))+x^3==0,x],12]

3) compute w_i with integration of cos(x*pi/2)*L_i(x) in the interval (-1,1), L_i(x) is the ith lagrange polynomial with respect to the nodes you found in step 2.

Results FYI,

x_0=-0.644641970907

x_1=0

x_2=0.644641970907

w_0=0.290197016802

w_1=0.692845511132

w_2=0.290197016802

 

Is it possible to solve the problem by introducing a polynomial system of equations? It is essential to recognize it as a gaussian quadrature problem and derive a gaussian quadrature formula. In general, the nonlinear system consists of those equations cannot be guarranteed to be solved in closed form in Mathematica.



https://blog.sciencenet.cn/blog-398465-313948.html

上一篇:Mac上Fortran编程
下一篇:自适应步长Runge-Kutta-Fehlberg method for solving ODE system的matlab实现
收藏 IP: .*| 热度|

0

发表评论 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-11-25 12:32

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部