24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 371  |  回复: 2

十六夜喵夜

铁虫 (初入文坛)

[求助] 为什么用曲边扇形公式编出来的求椭圆面积程式和标准答案不一样?

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include<time.h>
#include<stdlib.h>
struct coordinate
{
double aerpa1[5];
double aerpa2[5];
double aerpa;
double r[5];
double x;
double y;
double a;
double b;
double gama;
double h;
double ai[5];
double s;
int n;
};
struct coordinate cd[626];
double fu(double x, int i, int j)
{
double Bt, aerpa3, aerpa4, xd, yd, res;
res = 0;
aerpa3 = 1;
aerpa4 = 1;
xd = aerpa3*(cd.a*cos(cd.aerpa)*cos(x) + cd.b*sin(cd.aerpa)*sin(x));
yd = aerpa4*(sin(x)*cos(cd.aerpa)*cd.b - sin(cd.aerpa)*cos(x)*cd.a);
res = xd*xd + yd*yd;
res = sqrt(res);
res = pow(res, 2.0);
return res;
}
double sguess(double xiaxian, double shangxian, int r, int l)
{
double x5[8] = { 0.9602898565 ,-0.9602898565,0.7966664774,-0.7966664774,0.5255354099,-0.5255354099,0.1834346425,-0.1834346425 };
double A5[8] = { 0.1012285363,0.1012285363,0.2223810345,0.2223810345,0.3137066459,0.3137066459,0.3626837834,0.3626837834 };
double * p, *t;
double g = 0;
int i;
p = x5;
t = A5;
for (i = 0; i<8; i++)
{
g = fu((shangxian - xiaxian)*p / 2 + (xiaxian + shangxian) / 2, r, l)*t + g;
}
g = ((shangxian - xiaxian) / 2)*g;
return g;
}
double S(int i)
{
int j;
double s, sp, a, b;
s = 0;
s = sguess(0, 2 * 3.141592654, 0, 1);
s = 0.5*s;
return s;
}
void generate(int i)
{
double PI = 3.141592654;
cd.a = 5;
cd.b = 0.5;
cd.n = 3;
cd.h = PI * 2 / cd.n;
cd.aerpa = 0;
cd.s = S(i);
}
void main()
{
generate(0);
printf("wucha=%lf,Sjisuan=%lf,Szhen=%lf\n", cd[0].s - 3.141592654*cd[0].a*cd[0].b, cd[0].s, 3.141592654*cd[0].a*cd[0].b);
}
最后的运算结果是b越小误差越大,有的时候误差可以达到37(计算值)-0.7(真实值)的差距,但是圆一定不存在误差
回复此楼

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

十六夜喵夜

铁虫 (初入文坛)

如图所示
为什么用曲边扇形公式编出来的求椭圆面积程式和标准答案不一样?
(4XXWJBX}TZQ6BX_M[Z}G3F.png


为什么用曲边扇形公式编出来的求椭圆面积程式和标准答案不一样?-1
5CC1D76}Y9W]Y7U1ST@}R~A.png


为什么用曲边扇形公式编出来的求椭圆面积程式和标准答案不一样?-2
E22TNEMVTGMT6K@]D9CRJ6T.png


为什么用曲边扇形公式编出来的求椭圆面积程式和标准答案不一样?-3
OFX)]`@MD5WHY26YHB[6Y(U.png

2楼2016-02-17 18:44:01
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

十六夜喵夜

铁虫 (初入文坛)

求大触帮忙的说
3楼2016-02-17 18:49:36
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 十六夜喵夜 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 材料调剂 +3 一样YWY 2026-04-02 3/150 2026-04-02 10:37 by longlotian
[考研] 372求调剂 +3 jj涌77 2026-04-02 3/150 2026-04-02 09:57 by olim
[考研] 279求调剂 +6 学而思兮知 2026-04-01 6/300 2026-04-02 09:16 by vgtyfty
[考研] 求调剂!生物与医药专硕 +3 逆转陆先生 2026-04-01 3/150 2026-04-02 09:02 by Jaylen.
[考研] 304求调剂 +12 素年祭语 2026-03-31 15/750 2026-04-01 22:41 by peike
[考研] 材料专硕322分 +10 哈哈哈吼吼吼哈 2026-04-01 10/500 2026-04-01 22:19 by Dyhoer
[考研] 一志愿南昌大学324求调剂 +7 hanamiko 2026-03-30 7/350 2026-04-01 13:22 by JourneyLucky
[考研] 311求调剂一志愿合肥工业大学 +14 秋二十二 2026-03-30 14/700 2026-04-01 11:45 by chemdavid
[考研] 086000生物与医药298调剂求助 +4 元元青青 2026-03-31 6/300 2026-04-01 11:13 by syh9288
[考研] 考研材料工程351分调剂 +5 整个好的 2026-03-31 5/250 2026-04-01 09:36 by topgun2009
[考研] 318一志愿吉林大学生物与医药 求调剂 +6 笃行致远. 2026-03-28 6/300 2026-04-01 09:28 by oooqiao
[考研] 材料科学与工程求调剂 +13 深V宿舍吧 2026-03-29 13/650 2026-03-31 19:50 by Dyhoer
[考研] 考研调剂求助 +7 13287130938 2026-03-31 7/350 2026-03-31 16:39 by 690616278
[考研] 266分,求材料冶金能源化工等调剂 +8 哇呼哼呼哼 2026-03-27 10/500 2026-03-31 13:35 by Huaxue_Wang
[考研] 262求调剂 +7 ZZ..000 2026-03-30 8/400 2026-03-31 10:05 by cal0306
[考研] 085600,专业课化工原理,320分求调剂 +6 大馋小子 2026-03-29 6/300 2026-03-31 10:03 by 氯化亚硝酰
[考研] 283求调剂(080500) +14 A child 2026-03-27 14/700 2026-03-30 12:06 by 探123
[考研] 305求调剂 +8 RuiFairyrui 2026-03-28 8/400 2026-03-29 08:22 by fmesaito
[考研] 一志愿南京航空航天大学材料学硕求调剂 +3 @taotao 2026-03-28 3/150 2026-03-28 10:26 by JourneyLucky
[考研] 340求调剂 +5 jhx777 2026-03-27 5/250 2026-03-28 04:18 by fmesaito
信息提示
请填处理意见