• 大小: 83KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-09
  • 语言: C#
  • 标签: C#  源码  各阶比较  

资源简介

用C#语言做的比较经典牛顿迭代法和三阶、五阶以及六阶收敛牛顿迭代的小程序。有源码和各阶收敛的牛顿迭代法公式。

资源截图

代码片段和文件信息

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 _6StepNewton
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
        }

        private void MainForm_Load(object sender EventArgs e)
        {
            this.cbo_equation.SelectedIndex = 0;
        }

        private void btn_Start_Click(object sender EventArgs e)
        {
            if (this.txt_X.Text.Trim() == ““)
            {
                MessageBox.Show(“请输入初始值x0!“);
                this.txt_X.Focus();
                return;
            }

            removeDgvRows(this.dgv_nd1);
            removeDgvRows(this.dgv_nd3);
            //removeDgvRows(this.dgv_nd4);
            removeDgvRows(this.dgv_nd5);
            removeDgvRows(this.dgv_nd6);

            int i = this.cbo_equation.SelectedIndex;
            int k = 0;
            double x = Convert.ToDouble(this.txt_X.Text.Trim());
            double x1 = x;
            double x3 = x;
            double x4 = x;
            double x5 = x;
            double x6 = x;

            this.dgv_nd1.Rows.Add(k x);
            this.dgv_nd3.Rows.Add(k x);
            //this.dgv_nd4.Rows.Add(k x);
            this.dgv_nd5.Rows.Add(k x);
            this.dgv_nd6.Rows.Add(k x);

            //经典牛顿迭代法
            while (System.Math.Abs(fx(i x1)) > 0.00000000000001)
            {
                double f = fx(ix1);
                double d = dx(i x1);
                x1 = x1 - f / d;
                k++;
                this.dgv_nd1.Rows.Add(k x1);
            }

            //三阶收敛牛顿迭代法
            k = 0;
            while (System.Math.Abs(fx(i x3)) > 0.00000000000001)
            {
                x3 = FixedF3(i x3);
                k++;
                this.dgv_nd3.Rows.Add(k x3);
            }

            //四阶收敛牛顿迭代法
           /* k = 0;
            while (System.Math.Abs(fx(i x4)) > 0.00000000000001)
            {
                x4 = FixedF4(i x4);
                k++;
                this.dgv_nd4.Rows.Add(k x4);
            }*/

            //五阶收敛牛顿迭代法
            k = 0;
            while (System.Math.Abs(fx(i x5)) > 0.00000000000001)
            {
                x5 = FixedF5(i x5);
                k++;
                this.dgv_nd5.Rows.Add(k x5);
            }

            //六阶收敛牛顿迭代法的循环过程
            k = 0;
            while (System.Math.Abs(fx(i x6)) > 0.00000000000001)
            {
                x6 = FixedF6(i x6);
                k++;
                this.dgv_nd6.Rows.Add(k x6);
            }

            this.lab_nd1.Text = this.dgv_nd1.Rows[this.dgv_nd1.Rows.Count - 1].Cells[0].Value.ToString();
            this.lab_nd3.Text = this.dgv_nd3.Rows[this.dgv_nd3.Rows.Count - 1].Cells[0].Value.ToString()

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      17920  2011-12-11 16:47  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton.exe

     文件       3769  2011-11-23 20:42  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\6StepNewton.csproj

     文件        117  2011-11-23 20:42  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\app.config

     文件      17920  2011-12-11 16:47  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\bin\Debug\6StepNewton.exe

     文件        117  2011-11-23 20:42  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\bin\Debug\6StepNewton.exe.config

     文件      34304  2011-12-11 16:47  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\bin\Debug\6StepNewton.pdb

     文件      11608  2011-12-11 16:48  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\bin\Debug\6StepNewton.vshost.exe

     文件        117  2011-11-23 20:42  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\bin\Debug\6StepNewton.vshost.exe.config

     文件        490  2010-03-17 22:39  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\bin\Debug\6StepNewton.vshost.exe.manifest

     文件      12581  2011-12-01 16:08  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\MainForm.cs

     文件      19720  2011-12-01 16:05  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\MainForm.Designer.cs

     文件       7396  2011-12-01 16:05  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\MainForm.resx

     文件       1010  2011-12-11 16:48  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\obj\x86\Debug\6StepNewton.csproj.FileListAbsolute.txt

     文件      17920  2011-12-11 16:47  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\obj\x86\Debug\6StepNewton.exe

     文件      34304  2011-12-11 16:47  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\obj\x86\Debug\6StepNewton.pdb

     文件       4440  2011-11-23 19:47  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       6109  2011-12-11 16:47  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        710  2011-12-01 16:05  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\obj\x86\Debug\GenerateResource-ResGen.read.1.tlog

     文件        642  2011-12-01 16:05  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\obj\x86\Debug\GenerateResource-ResGen.write.1.tlog

     文件          2  2011-12-01 16:05  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\obj\x86\Debug\GenerateResource.read.1.tlog

     文件          2  2011-12-01 16:05  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\obj\x86\Debug\GenerateResource.write.1.tlog

     文件       4608  2011-11-23 20:42  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\obj\x86\Debug\TempPE\Properties.Resources.Designer.cs.dll

     文件        180  2011-12-01 16:05  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\obj\x86\Debug\_6StepNewton.MainForm.resources

     文件        180  2011-11-23 20:42  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\obj\x86\Debug\_6StepNewton.Properties.Resources.resources

     文件        496  2011-11-23 20:02  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\Program.cs

     文件       1384  2011-11-21 20:45  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\Properties\AssemblyInfo.cs

     文件       2862  2011-11-23 20:42  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\Properties\Resources.Designer.cs

     文件       5612  2011-11-21 20:45  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\Properties\Resources.resx

     文件       1110  2011-11-23 20:42  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\Properties\Settings.Designer.cs

     文件        249  2011-11-21 20:45  C#语言的各阶牛顿迭代法比较(有源码)\6StepNewton源码\6StepNewton\Properties\Settings.settings

............此处省略17个文件信息

评论

共有 条评论