数值分析实验报告--龙贝格求积算法
数值分析实验报告
专业 信息与计算科学 班级 信计101 姓名 学号 协作队员 实验日期 2013 年 1 月 5 日 星期 六
成绩评定 教师签名 批改日期 题目
一、 问题提出
教材136页12题用龙贝格求积算法计算其近似值(加速3次) 地球卫星轨道是一个椭圆,椭圆周长的计算公式是
π
S =a ⎰2
0⎛c ⎫- ⎪sin 2θd θ ⎝a ⎭2
这里a 是椭圆的半长轴,c 是地球中心与轨道中心(椭圆中心)的距离,记h 为近地点距离,H 为远地点距离,R=6371(km )为地球半径,则a =(2R +H +h ) /2,c =(H -h ) /2
我国第一颗人造地球卫星近地点距离h=439(km ),远地点距离H=2384(km ),试求卫星轨道的周长。
二、 模型建立
T (k )
m 4m h 1(k +1) (k ) = m T m () -T m , 2, -1-1(h ) , k =1m 4-124-1
称为龙贝格求积算法
当加速3次时,龙贝格求积算法如下:
641m =3, 龙贝格积分公式: R n =C 2n -C n . 6363
三、 求解方法
#ifndef A
#define A
1
#include "math.h"
class T
{
public:
};
template
class Rombeg{
public :
void Solve(double a,double b,int MAX_N,int DengFenShu,double e); double operator()(const double& x)const { } return (double)sin(x)/(1+x);
private :
};
#endif
/*方法实现*/
#include "iostream"
#include "LongBeiGe.h"
#include "math.h"
#define MAX_SIZE 255
using namespace std;
template
void Rombeg::Solve(double a,double b,int MAX_XunHuan,int DengFenShu,double e) {
T R; double t[MAX_SIZE][MAX_SIZE]; int n=DengFenShu; double h=(b-a)/n; 2
int flag=0; int i; for(i=1;i
/*主函数*/
#include "iostream"
#include "LongBeiGe.h"
#include "LongBeiGe.cpp"
int main()
{
Rombeg r; double a,b,e; int DengFenShu; int Max_XunHuan; cout>b; cout>a; cout>DengFenShu; cout>Max_XunHuan;
cout
cin>>e; r.Solve(a,b,Max_XunHuan,DengFenShu,e); return 0;
四、 输出结果
由以上程序求出了卫星轨道的周长S=48708km
五、 结果分析
运用龙贝格求积算法计算出近似值的方法,简单,操作性强,且计算结果比较精确。
4