cos函數(shù)的輸入值為弧度,也就是將cos函數(shù)后加上弧度,然后就可以得到想要的結(jié)果。我們需要把度化為弧度:
十載的岢嵐網(wǎng)站建設(shè)經(jīng)驗,針對設(shè)計、前端、開發(fā)、售后、文案、推廣等六對一服務(wù),響應(yīng)快,48小時及時工作處理。全網(wǎng)整合營銷推廣的優(yōu)勢是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動調(diào)整岢嵐建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計,從而大程度地提升瀏覽體驗。創(chuàng)新互聯(lián)建站從事“岢嵐網(wǎng)站設(shè)計”,“岢嵐網(wǎng)站推廣”以來,每個客戶項目都認(rèn)真落實執(zhí)行。
假設(shè)度數(shù)為d,則對應(yīng)的弧度為:d * pi / 180
cosx函數(shù)
#includestdio.h
#includemath.h
int main()
{
int n=0;
double x,sum=0;
printf("please enter x:");
scanf("%lf",x);//
double cosx(double x,int n);
do
{
sum=sum+cosx(x,n);
n=n+1;
}
while(fabs(cosx(x,n))1e-8);
printf("%9.8f\n",sum);
return 0;
}
double cosx(double x,int n)
{
double p,q;//
p=pow(x,2*n);
double fact(int n);//
q=fact(2*n);
if(n%2)
return(-p/q);
else
return(p/q);
}
double fact(int n)//
{
double ans=1; int i;
if(n=1)
return 1;
for(i=1;i=n; ++i)
ans*=i;
return ans;
}
cosx函數(shù)即反余弦函數(shù)
函數(shù)y=cosx(x∈[0,π])的反函數(shù)叫做反余弦函數(shù),
記作y=arccosx(x∈[-1,1]).
double cos1(double e)
{
double cos_x=0;
double temp=1;
for (int i=0;i5;)
{
cos_x += pow(-1,i)*pow(x,2*i)/temp;
i++;
temp *= 2*i*(2*i-1);
}
return cos_x;
}
C語言里sin函數(shù)和cos函數(shù)是C標(biāo)準(zhǔn)數(shù)學(xué)函數(shù)庫中的函數(shù),調(diào)用需要引入math.h頭文件。
一、sin()?函數(shù)描述:
C 庫函數(shù) double sin(double x) 返回弧度角 x 的正弦。sin() 函數(shù)的聲明:double sin(double x)。
參數(shù):x -- 浮點值,代表了一個以弧度表示的角度。
返回值:該函數(shù)返回 x 的正弦。
二、cos() 函數(shù)描述:
cos() 函數(shù)的功能是求某個角的余弦值。cos()?函數(shù)的聲明:double cos(double x)。
參數(shù):x -- 浮點值,代表了一個以弧度表示的角度。
返回值:該函數(shù)返回 x 的余弦。
擴(kuò)展資料:
相關(guān)的三角函數(shù):
double asin (double); 結(jié)果介于[-PI/2,PI/2]
double acos (double); 結(jié)果介于[0,PI]
double atan (double); 反正切(主值),結(jié)果介于[-PI/2,PI/2]
double atan2 (double,double); 反正切(整圓值),結(jié)果介于[-PI,PI]
參考資料來源:百度百科-math.h
//#include?"stdafx.h"http://If?the?vc++6.0,?with?this?line.
#include?"stdio.h"
int?main(void){
int?i;
double?tmp,cosx,x,t;
printf("Input?x(double?Angle)...\nx=");
scanf("%lf",x);
t=x/180*3.1415926535897932;
for(t*=t,cosx=tmp=i=1;tmp1.0E-6;i++){
tmp*=t/(i+i)/(i+i-1);
cosx?+=?i1???-tmp?:?tmp;
}
printf("cos%g°≈?%g\n",x,cosx);
return?0;
}
分享標(biāo)題:c語言數(shù)學(xué)函數(shù)cox c語言math函數(shù)庫階乘
文章網(wǎng)址:http://chinadenli.net/article26/dodigjg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供建站公司、網(wǎng)站收錄、全網(wǎng)營銷推廣、做網(wǎng)站、App開發(fā)、標(biāo)簽優(yōu)化
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)