网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
06月26日漏签0天
c#吧 关注:188,403贴子:822,787
  • 看贴

  • 图片

  • 吧主推荐

  • 视频

  • 游戏

  • 3回复贴,共1页
<<返回c#吧
>0< 加载中...

这可怎么办啊???

  • 取消只看楼主
  • 收藏

  • 回复
  • 静静坐
  • c#初学者
    2
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
An unhandled exception of type *System.IndexOutOfRangeException* occurred in job.1.exe
Additional information: Index was outside the bounds of the array.


  • 静静坐
  • c#初学者
    2
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace job._1
{
public partial class exp1_Lag : Form
{
public exp1_Lag()
{
InitializeComponent();
}
List<double> xn=null;
List<double> yn=null;
public void txtxy_TextChanged(object sender, EventArgs e)
{
string str = txtInput.Text;
int i1 = 0, i2 = 0;
while (str[i1] != *\0*)
{
string str0 = null;
if (str[i1] == *(*)
{
while (str[i1 + 1] != *,*)
{
str0 += str[i1 + 1];
i1++;
}
xn[i2] = double.Parse(str0);
str0 = null;
while (str[i1 + 1] != *)*)
{
str0 += str[i1 + 1];
i1++;
}
yn[i2] = double.Parse(str0);
i2++;
}
}
}
public void button1_Click(object sender, EventArgs e)
{
int n=int.Parse(txtn.Text);
int sum = 1;
double x = double.Parse(txtque.Text);
double tmp = 1, fx=0;
for (int i = 1; i <= n; i++)
{
sum *= i;
}
for (int i = 0; i <= sum; i++)
{
for (int j = 0; j <= n; j++)
{
if (j != i)
{
tmp *= (x - xn[j]) / (xn[i] - xn[j]);
}
}
fx+=tmp*yn[i];
}
lblans.Text = fx.ToString();
}
}
}
***********************************************************************************
***********************************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace job._1
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new exp1_Lag());
}
}
}
**********************************************************************************
*************************************************************************************

实现拉格朗日插值函数算法


2025-06-26 22:16:31
广告
  • 静静坐
  • c#初学者
    2
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
神啊,没人理啊


  • 静静坐
  • c#初学者
    2
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 3回复贴,共1页
<<返回c#吧
分享到:
©2025 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示