sample6_3.cs
来自「C#的数值计算的几乎所有算法」· CS 代码 · 共 30 行
CS
30 行
/*
* 示例程序Sample6_3: Interpolation类的一元三点不等距插值
*/
using System;
using CSharpAlgorithm.Algorithm;
namespace CSharpAlgorithm.Sample
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
// 数据
int n = 5;
double[] x = {1.615,1.634,1.702,1.828,1.921};
double[] y = {2.41450,2.46459,2.65271,3.03035,3.34066};
double[] t = {1.682,1.813};
// 插值运算
for (int i=0; i<t.Length; ++i)
{
double yt = Interpolation.GetValueLagrange3(n, x, y, t[i]);
Console.WriteLine("f(" + t[i] + ") = " + yt);
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?