sample6_5.cs
来自「C#的数值计算的几乎所有算法」· CS 代码 · 共 30 行
CS
30 行
/*
* 示例程序Sample6_5: Interpolation类的连分式不等距插值
*/
using System;
using CSharpAlgorithm.Algorithm;
namespace CSharpAlgorithm.Sample
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
// 数据
int n = 10;
double[] x = {-1.0,-0.8,-0.65,-0.4,-0.3,0.0,0.2,0.45,0.8,1.0};
double[] y = {0.0384615,0.0588236,0.0864865,0.2,0.307692,1.0,0.5,0.164948,0.0588236,0.0384615};
double[] t = {0.85, 0.25};
// 插值运算
for (int i=0; i<t.Length; ++i)
{
double yt = Interpolation.GetValuePqs(n, x, y, t[i]);
Console.WriteLine("f(" + t[i] + ") = " + yt);
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?