使用Mathematica绘制随机多项式的根

使用ListPlot和NSolve直接绘制:

复制代码
(*返回系数为r和s之间整数的n次随机多项式*) 
eq[n_, r_, s_] := RandomInteger[{r, s}, {n}] . Array[Power[x, # - 1] &, n] 
(*返回给定随机多项式的根所对应的笛卡尔坐标*) 
sol[n_, r_, s_] := {Re[#], Im[#]} & /@ (x /. NSolve[eq[n, r, s] == 0, x]) ListPlot[sol[400, 1, 6], PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}}, AspectRatio -> Automatic, PlotStyle -> {PointSize[Medium], Opacity[0.2], Black}]

使用Image和Fourier:

复制代码
SetSystemOptions["SparseArrayOptions" -> {"TreatRepeatedEntries" -> 1}];
\[Gamma] = 0.12;
\[Beta] = 1.0;
fLor = Compile[{{x, _Integer}, {y, _Integer}}, (\[Gamma]/(\[Gamma] + 
        x^2 + y^2))^\[Beta], RuntimeAttributes -> {Listable}(*,
   CompilationTarget->"C"*)];
<< Developer`
$PlotComplexPoints[list_, magnification_, paddingX_, paddingY_, 
  brightness_] := 
 Module[{RePos = 
    paddingX + 1 + Round[magnification (# - Min[#])] &[Re[list]], 
   ImPos = paddingY + 1 + Round[magnification (# - Min[#])] &[Im[list]],
    sparse, lor, dimX, dimY}, dimX = paddingX + Max[RePos];
  dimY = paddingY + Max[ImPos];
  Image[(brightness Sqrt[dimX dimY] Abs[
       InverseFourier[
        Fourier[SparseArray[
           Thread[{ImPos, RePos}\[Transpose] -> 
             ConstantArray[1, Length[list]]], {dimY, dimX}]] Fourier[
          RotateRight[
           fLor[#[[All, All, 1]], #[[All, All, 2]]] &@
            Outer[List, Range[-Floor[dimY/2], Floor[(dimY - 1)/2]], 
             Range[-Floor[dimX/2], Floor[(dimX - 1)/2]]], {Floor[
             dimY/2], 
            Floor[dimX/2]}]]]])\[TensorProduct]ToPackedArray[{1.0, 
      0.3, 0.1}], Magnification -> 1]]

直接绘制10000个随机的复平面点图:

复制代码
$PlotComplexPoints[ RandomComplex[{-1 - I, 1 + I}, 10000], 300, 20, 20, 10]

随机的150阶多项式的根的分布图:

复制代码
expr = Evaluate@Sum[RandomInteger[{1, 10}] #^k, {k, 150}] &; 
list = Table[N@Root[expr, k], {k, 150}]; 
$PlotComplexPoints[list, 320, 20, 20, 140]
相关推荐
oo哦哦7 小时前
2026年多平台内容管理系统技术选型:从架构设计到工程落地
人工智能·线性代数·矩阵
松☆13 小时前
ops-blas:昇腾NPU上线性代数算子的性能天花板在哪?
线性代数
oo哦哦18 小时前
2026年实体门店获客新变局:当短视频矩阵成为“必修课“,哪套系统真正能落地?
线性代数·矩阵
05候补工程师20 小时前
【线性代数】核心考点复习笔记:二次型配方法、施密特正交化步骤与特征值经典题型详解
经验分享·笔记·线性代数·考研·算法
程序员清洒2 天前
catlass 算子模板库的分层抽象设计:从模板到高性能矩阵乘
线性代数·机器学习·矩阵·cann
oo哦哦2 天前
矩阵系统的流行病学密码:用SIR传染模型和基本再生数R₀,解释为什么你的100条种草内容,传播力还不如别人1条
线性代数·矩阵·r语言
05候补工程师2 天前
【考研线代】矩阵相似与对角化核心解题套路与防坑指南 (附实战笔记)
经验分享·笔记·线性代数·考研·矩阵
晚烛2 天前
CANN 模型蒸馏实战:大模型知识迁移到小模型
python·线性代数·矩阵
AI科技星2 天前
哥德巴赫猜想1+1基于平行素数对等腰梯形网格拓扑与素数渐近密度的大偶数满填充完备性证明
人工智能·线性代数·架构·概率论·学习方法
AI科技星3 天前
《数学公理体系·第三部·数术几何》(2026 年版)
c语言·开发语言·线性代数·算法·矩阵·量子计算·agi