1007.Numerical Summation of a Series
来源:互联网 发布:ibatis 打印sql语句 编辑:程序博客网 时间:2024/06/12 01:37
原题大意就是当x取某个值的时候,求这个公式的值。
其实题目下面那个提示已经很明确了,直接求是肯定不行的,可以通过f(x)-f(1)来求f(x) ,因为已知f(1)=1.
那么根据公式可以算出 f(x) - f(1) = (1-x) / ( k* (k+1) * (k+x) ) ,
这时分母为k的三次方,原题要求的0.5e-12可以只求到10000,减少了运算量。
再根据第三个公式求的最后的余项。
将公式看做为 (1-x)/k^3 = (1-x)*积分(1/k^3) = (1-x) / ( 2 * 10000 * 10000 )
代码如下:
#include <stdio.h>int main ( ){ int k ; double x , fx ; for ( x = 0.000 ; x < 2.000 ; x += 0.001 ) { fx = 0 ; for ( k = 1 ; k < 10000 ; k++ ) { fx += ( 1.0 - x ) / ( ( k + 1 ) * k * ( k + x ) ) ; } fx += ( 1.0 - x ) / ( 2 * 10000 * 10000 ) + 1.0 ; printf("%5.3f %16.12f\n" , x , fx ) ; } return 0;}感谢各位网上的大神的代码指导。
阅读全文
0 0
- 1007.Numerical Summation of a Series
- Numerical Summation of a Series
- Numerical Summation of a Series
- zoj 1007 Numerical Summation of a Series
- ZOJ1007 Numerical Summation of a Series
- ZOJ1007.Numerical Summation of a Series
- zoj1007-Numerical Summation of a Series
- zoj 1007 Numerical Summation of a Series
- ZOJ 1007 Numerical Summation of a Series
- zoj1007 Numerical Summation of a Series
- ZOJ 1007 Numerical Summation of a Series
- ZOJ 1007 Numerical Summation of a Series
- ZOJ 1007Numerical Summation of a Series
- ZOJ--1007:Numerical Summation of a Series
- ZOJ Problem Set - 1007Numerical Summation of a Series
- zoj 1007 Numerical Summation of a Series 纯数学题
- ZOJ 1007 Numerical Summation of a Series (数学)
- ZOJ Problem Set - 1007 Numerical Summation of a Series
- 【SQL Server学习笔记】6:更新/删除/导出/导入数据
- 使用moment.js轻松管理日期和时间
- HDU 1698 Just a Hook(线段树:区间更新,区间查询)
- 可变参数
- LinkedHashMap及其源码分析
- 1007.Numerical Summation of a Series
- Cookie和Session的区别
- 步态识别问题简介
- How to skip “Loose Object” popup when running 'git gui'
- 1.1.5 memcached
- QT原子操作QAtomic API和锁QMutex
- 基本数据类型常见问题
- UVA1218[Perfect Service] 树上动态规划模型
- 用循环链表解决报数淘汰问题