C语言求sin(x)的近似值sin(X)=x-(x^3/3!)+(x^5/5!)-(x^7/7!)+.+(-1)^n[x^(2n+1)/(2n+1)!]求用C语言写代码,精度为10的-5次方.我写的代码如下:#include <stdio.h>#include <math.h>void main(){ int a,b,n,A,temp; float

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/11 04:55:55

C语言求sin(x)的近似值sin(X)=x-(x^3/3!)+(x^5/5!)-(x^7/7!)+.+(-1)^n[x^(2n+1)/(2n+1)!]求用C语言写代码,精度为10的-5次方.我写的代码如下:#include <stdio.h>#include <math.h>void main(){ int a,b,n,A,temp; float
C语言求sin(x)的近似值
sin(X)=x-(x^3/3!)+(x^5/5!)-(x^7/7!)+.+(-1)^n[x^(2n+1)/(2n+1)!]求用C语言写代码,精度为10的-5次方.我写的代码如下:#include <stdio.h>#include <math.h>void main(){    int a,b,n,A,temp;    float eps,c,d,sin;    temp=-1;    sin=0.0; c=1.0;    n=0;    eps=10e-6;    scanf("%f",&d);    do    {        n++;        b=2*n-1;  A=1;     for(a=1;a<=b;a++)     {      A=A*a;     }     temp=-temp;        c=pow(d,b);        sin=sin+temp*c/A;    }while( fabs(c/A)>=eps);    printf("%f\n",sin);    }用Debug检查发现在a=17之后就会出现数据溢出现象,也就是大概在|x|>3时结果就会出错,请问该如何改进算法?或者该怎样写代码?呵呵,命名上有些不足,读代码有些累,

C语言求sin(x)的近似值sin(X)=x-(x^3/3!)+(x^5/5!)-(x^7/7!)+.+(-1)^n[x^(2n+1)/(2n+1)!]求用C语言写代码,精度为10的-5次方.我写的代码如下:#include <stdio.h>#include <math.h>void main(){ int a,b,n,A,temp; float
把A换成double 或者 float 都行

c语言编程 求sin(x)的近似值 描述:利用公式求sin(x)的近似值(精度为10e-6).sin(x)=x-x^3/3!+x^5/5!- C语言编程求正弦 sin(x) 的近似值如题 已知求正弦 sin(x) 的近似值的多项式公式为:sin(x) = x - x 3 /3!+ x 5 /5!- x 7 /7!+ …… + (-1) n x 2n+1 /(2n+1)!+ … 编写程序,要求输入 x (单位是弧度)和ε,按上述 C语言编程求正弦,、已知求正弦 sin(x) 的近似值的多项式公式为:sin(x) = x - x3/3!+ x5/5!- x7/7!+ …… + (-1)n x2n+1/(2n+1)!+ …编写程序,要求输入 x (单位是弧度)和ε,按上述公式计算 sin(x) 的近似值, C语言大神请进小弟新手求教已知求正弦 sin(x) 的近似值的多项式公式为: sin(x) = x - x3/3! + x5/5! - x7/7!+ …… + (-1)n x2n+1/(2n+1)! + …编写程序,要求输入 x (单位是弧度)和ε,按上述公式计算 sin(x c语言 sin(x)+cos(x)编程 c语言求sin(x)近似值的问题!以下我写的,具体是想实现输入弧度x,误差u后,当误差小于u时,输出近似值.近似值是利用泰勒公式的,这样写一运行不管什么值都是溢出(-1.#INDOO),请问该怎么改, 请老师为我修改指正这段C代码,利用公式求sin(x)的 近似值,#include#include#include/*利用公式求sin(x)的近似值(精度为10e-6).sin(x)= x-x^3/3!+x^5/5!-x^7/7!+...(-1)^n*x^(2n+1)/(2n+1)!+...*/ int main() { float sinx,x,x1; C语言求三角函数f(x,y,z)=sin(x)/(sin(x-y)*sin(x-z))+sin(y)/(sin(y-x)*sin(y-z))+sin(z)/(sin(z-x)*sin(z-y))代码#include #include double fun(double x,double y,double z){double a,b,c,sum;a=sin(x)/(sin(x-y)*sin(x-z));b=sin(y)/(sin(y-x)*sin(y-z));c C语言求sin(x)的近似值sin(X)=x-(x^3/3!)+(x^5/5!)-(x^7/7!)+.+(-1)^n[x^(2n+1)/(2n+1)!]求用C语言写代码,精度为10的-5次方.我写的代码如下:#include <stdio.h>#include <math.h>void main(){ int a,b,n,A,temp; float 已知求sin(x)的近似值的多项式公式为:sin(x)=x-x3/3!+x5/5!-x7/7!+已知求sin(x)的近似值的多项式公式为:sin(x)=x-x3/3!+x5/5!-x7/7!+……+(-1)nx2n+1/(2n+1)!+……编程并计算sin(x)的值,要求最后一项的绝对值小 求sinx的近似值利用公式求sin(x)的近似值(精度为10e-6).sinx=x-x3/3!+. sin(sin(x))的奇偶性 求sin^4x和sin^6x的不定积分. 求当x趋近于a时,(sin x - sin a) /sin (x - a)的极限 求x/(sin x)^2的积分 已知求正弦 sin(x) 的近似值的多项式公式为:sin(x) = x - x3/3!+ x5/5!- x7/7!+ …… + (-1)n x2n+1/(2n+1)!+ … 编写程序,要求输入 x (单位是弧度)和ε,按上述公式计算 sin(x) 的近似值,要求计算的误差小 用以下公式求sin(x)的近似值,当最后一项的绝对值小于10-7时停止计算,x的值为弧度. 求y=sin[sin(x^2)]的导数