📄 sample6_7.cs
字号:
/*
* 示例程序Sample6_7: Interpolation类的埃尔米特不等距插值
*/
using System;
using CSharpAlgorithm.Algorithm;
namespace CSharpAlgorithm.Sample
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
// 数据
int n = 10;
double[] x = {0.1,0.15,0.3,0.45,0.55,0.6,0.7,0.85,0.9,1.0};
double[] y = {0.904837,0.860708,0.740818,0.637628,0.576950,0.548812,0.496585,0.427415,0.406570,0.367879};
double[] t = {0.356};
double[] dy = new double[y.Length];
for (int i=0; i<y.Length; ++i)
dy[i]=-y[i];
// 插值运算
for (int i=0; i<t.Length; ++i)
{
double yt = Interpolation.GetValueHermite(n, x, y, dy, t[i]);
Console.WriteLine("f(" + t[i] + ") = " + yt);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -