sample6_4.cs
来自「用于矩阵的各种运算」· CS 代码 · 共 31 行
CS
31 行
/*
* 示例程序Sample6_4: Interpolation类的一元三点等距插值
*/
using System;
using CSharpAlgorithm.Algorithm;
namespace CSharpAlgorithm.Sample
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
// 数据
int n = 10;
double x0 = 0.10;
double xstep = 0.10;
double[] y = {0.904837,0.860708,0.778801,0.670320,0.606531,0.565525,0.496585,0.427415,0.394554,0.367879};
double[] t = {0.25, 0.63, 0.95};
// 插值运算
for (int i=0; i<t.Length; ++i)
{
double yt = Interpolation.GetValueLagrange3(n, x0, xstep, y, t[i]);
Console.WriteLine("f(" + t[i] + ") = " + yt);
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?