📄 d2r10.cpp
字号:
# include<iostream.h>
# include<math.h>
# include<iomanip.h>
void main()
{
//program d2r10
//driver for routine splie2
double x1[11], x2[11], y[11][11], y2[11][11],x1x2;
int m,n,i,j;
m = 10;
n = 10;
for (i = 1; i<=m; i++)
x1[i] = 0.2 * i;
for (i = 1; i<=n; i++)
x2[i] = 0.2 * i;
for (i = 1; i<=m; i++)
{
for (j = 1; j<=n; j++)
{
x1x2 = x1[i] * x2[j];
y[i][j] = x1x2*x1x2;
}
}
splie2(x1, x2, y, m, n, y2);
cout<<setprecision(6)<<setiosflags(ios::fixed);
cout<<endl;
cout<<"Second derivatives from splie2"<<endl;
cout<<"Natural spline assumed"<<endl;
cout<<endl;
for (i = 1; i<=5; i++)
{
for (j = 1; j<=5; j++)
cout<<setw(12)<<y2[i][j];
cout<<endl;
}
cout<<endl;
cout<<"Actual second derivatives"<<endl;
cout<<endl;
for (i = 1; i<=5; i++)
{
for (j = 1; j<=5; j++)
y2[i][j] = 2.0* (x1[i] *x1[i]);
for (j = 1; j<=5; j++)
cout<<setw(12)<<y2[i][j];
cout<<endl;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -