当前位置: 首页 > news >正文

使用Mathematica实现Newton-Raphson收敛速度算法(简单高阶多项式)

在这篇报告中,将Newton-Raphson的收敛算法应用于:

GenNewtonCounter = Compile[{{z, _Complex}, {n, _Integer}},Module[{counter = 0, zold = N[z] + 1, znew = N[z], k, m},If[Abs[znew] < 10^(-9), znew = 10^(-9) + 0.0*I, znew = znew];For[counter = 0,(Abs[zold - znew] > 10^(-6)) && (counter < 85), counter++,(zold = znew; znew = zold*(1 - 1/n) + 1/(n*zold^(n - 1)))];For[k = 0,(Abs[znew - Exp[2*Pi*I*k/n]] > 0.1) && (k < n), k++,counter = counter + 85];counter]];GenNewtonArray[{{remin_, remax_}, {immin_, immax_}}, steps_, n_] :=Table[GenNewtonCounter[x + y I, n],{y, immin, immax, (immax - immin)/(steps - 1)},{x, remin, remax, (remax - remin)/(steps - 1)}]GenNewtonPlot[data_, n_, colorfunc_] :=ListDensityPlot[data,AspectRatio -> 1, Mesh -> False, Frame -> False, PlotRange -> {0, 85*n}, ColorFunction -> (colorfunc[n, #] &)]
tr[x_] = Which[x < 0, 0, x > 1, 1, True, x];GenNewtonColorOne[n_, x_] :=If[x < 1/n, Hue[2*n*x], RGBColor[0, 0, 0]];
GenNewtonColorSeven[n_, x_] :=Which[x < 0.14285, RGBColor[tr[(3) 7 x], tr[(3) 7 x], tr[(3) 7 x]],0.14286 < x < 0.28571, RGBColor[tr[(3) (7 x - 1)], tr[(3) (7 x - 1)], 0],0.28572 < x < 0.42857, RGBColor[0, tr[(3) (7 x - 2)], tr[(3) (7 x - 2)]],0.42858 < x < 0.57142, RGBColor[tr[(3) (7 x - 3)], 0, tr[(3) (7 x - 3)]],0.57143 < x < 0.71428, RGBColor[tr[(3) (7 x - 4)], 0, 0],0.71529 < x < 0.85714, RGBColor[0, tr[(3) (7 x - 5)], 0],0.85715 < x < 1, RGBColor[0, 0, tr[(3) (7 x - 6)]],True, RGBColor[0, 0, 0]]
genregion = GenNewtonArray[{{-2, 2}, {-2, 2}}, 1000, 7];
GenNewtonPlot[genregion, 7, GenNewtonColorOne]

GenNewtonPlot[genregion, 7, GenNewtonColorSeven]

相关文章:

  • Beckhoff(倍福) -- MES(ITAC) TCP 通讯
  • Wise Disk Cleaner:免费高效的系统清理专家
  • C++课设:从零开始打造影院订票系统
  • Java中的抽象类
  • 2.1.3_2 编码和调制(下)
  • 用 DeepSeek 创作一首属于自己的歌
  • 图的邻接表存储及求邻接点操作
  • 【QT】QT多语言切换
  • 极客时间:在 Google Colab 上尝试 Prefix Tuning
  • 01.SQL语言概述
  • 算法-构造题
  • CSS悬停闪现与a标签嵌套的问题
  • vue3:十六、个人中心-修改密码
  • 《前端面试题:JavaScript 作用域深度解析》
  • leetcode Top100 189.轮转数组
  • Python Cookbook-7.13 生成一个字典将字段名映射为列号
  • 【学习笔记】TLS
  • 【threejs】每天一个小案例讲解:题外话篇
  • JDK 17 新特性
  • Java常见异常处理指南:IndexOutOfBoundsException与ClassCastException深度解析
  • 做企业宣传网站公司/手机端搜索引擎排名
  • 独立设计购物网站/电脑培训学校课程
  • 路由器搭建wordpress/上海专业seo
  • 中国建设银行网站公积金查询/神童预言新冠2023结束
  • 沙漠风网站建设/电脑系统优化工具
  • wordpress搬家 数据库/北京中文seo