博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
变步长梯形求积公式 c语言实现 数值积分
阅读量:4157 次
发布时间:2019-05-26

本文共 577 字,大约阅读时间需要 1 分钟。

变步长梯形求积公式 c语言实现 数值积分

标签:计算方法实验


/*    本实验用变步长梯形求积公式求x / (4 + x^2)在[0, 1]的定积分。*/#include 
#include
double f(double x){ return x / (4 + x * x);}int main(){ double a = 0, b = 1, eps = 0.00001; //上下限,精度 double s, x, h = b - a, t1, t2 = h * (f(a) + f(b)) / 2, temp; do{ s = 0, x = a + h / 2; do{ s += f(x); x += h; }while(x < b); t2 = (t1 + h * s) / 2; temp = t1, t1 = t2, h /= 2; }while(fabs(t1 - temp) >= eps); //即fabs(t2 - t1) >= eps printf("answer = %f\n", t2); return 0;}

实验结果

output

你可能感兴趣的文章
Groupwise Tracking of Crowded Similar-Appearance Targets from Low-Continuity Image Sequences
查看>>
CDTS: Collaborative Detection, Tracking, and Segmentation for Online Multiple Object Segmentation
查看>>
Deep Network Flow for Multi-Object Tracking
查看>>
Multiple People Tracking by Lifted Multicut and Person Re-identification
查看>>
Multi-Object Tracking with Quadruplet Convolutional Neural Networks
查看>>
关于多目标跟踪的一点理解
查看>>
Learning by tracking:Siamese CNN for robust target association
查看>>
MUSTer:Multi-Store Tracker:A Cognitive Psychology Inspired Approach to Object Tracking
查看>>
Understanding and Diagnosing Visual Tracking Systems
查看>>
Multiple People Tracking by Lifted Multicut and Person Re-identification
查看>>
Visual Tracking Using Attention-Modulated Disintegration and Integration
查看>>
Action-Decision Networks for Visual Tracking with Deep Reinforcement Learning
查看>>
Multiple Object Tracking with High Performance Detection and Appearance Feature
查看>>
深度学习入门(上)-第一章 必备基础知识点
查看>>
ubuntu unzip解压时提示错误 解决方法
查看>>
sprintf函数的说明
查看>>
BOOST_TYPEOF和BOOST_AUTO 作用
查看>>
随机森林概述
查看>>
2011十大战略技术
查看>>
大学应该学的软件知识
查看>>