| 165 |
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace 牛顿法
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form1 form = new Form1();
double[] x ={ 1.0, 1.0, 1.0 };
double h = 0.1;
int m=100;
double eps = 0.00001;
if (form.Newtown(3, x, h,ref m, eps) == false)
MessageBox.Show("", "jiji");
// else
{
textBox1.Text = x[0].ToString() +"\n\t"+ x[1].ToString() +"\n\t"+ x[2].ToString()+m.ToString();
}
}
public bool Newtown(int n, double[] x, double h,ref int nMax, double eps)
{
int l = nMax;//记录迭代次数
2007年12月12日 星期三 21:11
|