?? d5r7.cpp
字號:
#include "iostream.h"
#include "math.h"
double fder(double x)
{
//derivative of func
double aaa;
aaa = 4.0 * x * ((x * x) - 1.0) * sin(x);
return aaa + pow(x , 2) * ((x * x) - 2.0) * cos(x);
}
double func(double x)
{
return (x * x) * (x * x - 2.0) * sin(x);
}
void main()
{
//program d5r7
//driver for routine chder
int nval = 40;
double a,b,x,aaa,pio2 = 1.5707963;
double c[41], cder[41];
a = -pio2;
b = pio2;
chebft(a, b, c, nval);
//test derivative
cout<<endl;
cout<<"How many terms in chebyshev evaluation?"<<endl;
//input mval , between 6 and 40, mval=0 to end
int mval = 20;
cout<<mval<<endl;
if ((mval <= 0) || (mval > nval))
{
return;
}
chder(a, b, c, cder, mval);
cout<<" x Actual Cheby. deriv."<<endl;
cout.setf(ios::fixed|ios::right);
cout.precision(6);
for (int i = -8; i<=8; i++)
{
x = i * pio2 / 10.0;
cout.width(13);
cout<<x;
cout.width(13);
cout<<fder(x);
aaa = chebev(a, b, cder, mval, x);
cout.width(13);
cout<<aaa<<endl;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -