标题:我用C++写的龙贝格算法无法运行,请高手们帮忙看看
只看楼主
天怒浪子
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2008-10-18
 问题点数:0 回复次数:1 
我用C++写的龙贝格算法无法运行,请高手们帮忙看看
#include<iostream>
#include<cmath>
using namespace std;
double f(double x);
double zt2(double,double,double,double);
double zs2(double,double);
double zc2(double,double);
double zr2(double,double);
const double e=0.00001;
int main()
{
    double a,b,h,t1,t2,c1,c2,s1,s2,r1,r2;
    int k;
    k=1;
    cout<<"please input a and b"<<endl;
    cin>>a>>b;
    h=b-a;
    t1=h/2*(f(a)+f(b));
    t2=zt2(t1,h,a,b);
    s2=zs2(t2,t1);
        k=k+1;
        h=h/2;
        t1=t2;
        s1=s2;
        t2=zt2(t1,h,a,b);
        s2=zs2(t2,t1);
        h=h/2;
        c2=zc2(s2,s1);
        c1=c2;
        s1=s2;
        t1=t2;
        t2=zt2(t1,h,a,b);
        s2=zs2(t2,t1);
        c2=zc2(s2,s1);
        r2=zr2(c2,c1);
        k=k+1;
        h=h/2;
        r1=r2;
        c1=c2;
        s1=s2;
        t1=t2;
        t2=zt2(t1,h,a,b);
        s2=zs2(t2,t1);
        c2=zc2(s2,s1);
        r2=zr2(c2,c1);
    for(k=4;abs(r2-r1)<e;k++)
        {
        
                    h=h/2;
                    r1=r2;
                    c1=c2;
                    s1=s2;
                    t1=t2;
                    t2=zt2(t1,h,a,b);
                    s2=zs2(t2,t1);
搜索更多相关主题的帖子: 龙贝格 算法 运行 
2008-10-18 16:58
happycplusplus
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2008-10-10
得分:0 
不完整?

[[it] 本帖最后由 happycplusplus 于 2008-10-19 00:03 编辑 [/it]]
2008-10-19 00:00



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-239052-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.389152 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved