公告:本站正式转型为非交互式静态网站!
转型:本站将通过笔记和博客的形式继续为大家服务,关于 Mathematica 问答服务请移步至QQ群:365716997
联系:如有问题请联系QQ群管理员,或发送邮件至:lixuan.xyz@qq.com。
感谢:最后非常感谢大家多年来的支持与帮助!
参考《互联网跟帖评论服务管理规定》《中华人民共和国网络安全法》《网络信息内容生态治理规定》《互联网用户账号信息管理规定》

—— 2022-11-27

欢迎来到 Mathematica 问答社区

提问时请贴上文本代码

语法高亮:在编辑器中点击

被禁止的话题:广告破解

请阅读:《提问的智慧》

备用域名:mma.ooo

支持LaTex数学公式
行内公式标识符:\$ 或“$\backslash ($”+“$\backslash )$”,
行间公式标识符:\$\$ 或 “$\backslash [$”+“$\backslash ]$”

社区建议QQ群:365716997

分类

0 投票
1.3k 浏览
Cases[Plot[Sin[x], {x, 0, Pi}], Line[{x__}] :> x, Infinity]

模式匹配的部分看的明白,关键是Plot这个地方,到底是怎么回事,Plot作图和模式有什么关系,又是怎么和Line联系起来的。

{{6.41141*10^-8, 6.41141*10^-8}, {0.000963583, 
  0.000963583}, {0.0019271, 0.0019271}, {0.00385414, 
  0.00385413}, {0.00770821, 0.00770814}, {0.0154164, 
  0.0154158}, {0.0308327, 0.0308278}, {0.0616653, 
  0.0616262}, {0.128517, 0.128164}, {0.190939, 0.189781}, {0.252137, 
  0.249474}, {0.318521, 0.313163}, {0.380476, 0.371362}, {0.447617, 
  0.432818}, {0.513533, 0.491258}, {0.57502, 0.543852}, {0.641693, 
  0.598553}, {0.703937, 0.647224}, {0.764956, 0.692505}, {0.831161, 
  0.738715}, {0.892937, 0.778917}, {0.9599, 0.819134}, {1.02564, 
  0.855045}, {1.08695, 0.88521}, {1.15344, 0.914164}, {1.15441, 
  0.914557}, {1.15538, 0.914948}, {1.15732, 0.915729}, {1.1612, 
  0.917281}, {1.16896, 0.920343}, {1.18447, 0.926301}, {1.21551, 
  0.937545}, {1.21656, 0.93791}, {1.21761, 0.938274}, {1.21971, 
  0.938999}, {1.22391, 0.940436}, {1.23232, 0.943261}, {1.24913, 
  0.94871}, {1.28276, 0.958803}, {1.28379, 0.959095}, {1.28482, 
  0.959387}, {1.28688, 0.959967}, {1.29101, 0.961114}, {1.29926, 
  0.963361}, {1.31577, 0.967657}, {1.3168, 0.967916}, {1.31783, 
  0.968175}, {1.3199, 0.96869}, {1.32402, 0.969706}, {1.33228, 
  0.971689}, {1.34878, 0.975456}, {1.34975, 0.975668}, {1.35071, 
  0.975878}, {1.35263, 0.976297}, {1.35648, 0.977123}, {1.36418, 
  0.978731}, {1.37958, 0.981774}, {1.38054, 0.981957}, {1.38151, 
  0.982138}, {1.38343, 0.982499}, {1.38728, 0.983208}, {1.39498, 
  0.984584}, {1.41038, 0.987161}, {1.41142, 0.987327}, {1.41247, 
  0.987492}, {1.41455, 0.987819}, {1.41873, 0.98846}, {1.42708, 
  0.98969}, {1.42812, 0.989839}, {1.42916, 0.989987}, {1.43125, 
  0.990279}, {1.43542, 0.990851}, {1.44377, 0.991943}, {1.44482, 
  0.992075}, {1.44586, 0.992206}, {1.44795, 0.992463}, {1.45212, 
  0.992966}, {1.46047, 0.99392}, {1.47716, 0.99562}, {1.47814, 
  0.99571}, {1.47911, 0.9958}, {1.48106, 0.995977}, {1.48496, 
  0.996318}, {1.49275, 0.996956}, {1.49373, 0.997032}, {1.4947, 
  0.997106}, {1.49665, 0.997252}, {1.50055, 0.997534}, {1.50834, 
  0.99805}, {1.50932, 0.998111}, {1.51029, 0.99817}, {1.51224, 
  0.998286}, {1.51614, 0.998506}, {1.51711, 0.998559}, {1.51808, 
  0.998611}, {1.52003, 0.998712}, {1.52393, 0.998902}, {1.5249, 
  0.998947}, {1.52588, 0.998991}, {1.52783, 0.999077}, {1.53172, 
  0.999237}, {1.5327, 0.999274}, {1.53367, 0.999311}, {1.53562, 
  0.999381}, {1.53952, 0.999511}, {1.54047, 0.99954}, {1.54143, 
  0.999569}, {1.54334, 0.999623}, {1.54429, 0.999649}, {1.54525, 
  0.999674}, {1.54716, 0.999721}, {1.54811, 0.999743}, {1.54907, 
  0.999764}, {1.55098, 0.999804}, {1.55194, 0.999822}, {1.55289, 
  0.99984}, {1.5548, 0.999872}, {1.55576, 0.999887}, {1.55671, 
  0.999901}, {1.55767, 0.999914}, {1.55862, 0.999926}, {1.55958, 
  0.999937}, {1.56053, 0.999947}, {1.56149, 0.999957}, {1.56244, 
  0.999965}, {1.5634, 0.999973}, {1.56435, 0.999979}, {1.56531, 
  0.999985}, {1.56626, 0.99999}, {1.56722, 0.999994}, {1.56817, 
  0.999997}, {1.56913, 0.999999}, {1.57008, 1.}, {1.57104, 
  1.}, {1.57199, 0.999999}, {1.57295, 0.999998}, {1.5739, 
  0.999995}, {1.57486, 0.999992}, {1.57581, 0.999987}, {1.57677, 
  0.999982}, {1.57772, 0.999976}, {1.57868, 0.999969}, {1.57963, 
  0.999961}, {1.58059, 0.999952}, {1.58154, 0.999942}, {1.5825, 
  0.999932}, {1.58345, 0.99992}, {1.58537, 0.999894}, {1.58632, 
  0.99988}, {1.58728, 0.999864}, {1.58919, 0.999831}, {1.59014, 
  0.999813}, {1.5911, 0.999794}, {1.59301, 0.999753}, {1.59396, 
  0.999732}, {1.59492, 0.999709}, {1.59683, 0.999661}, {1.60065, 
  0.999554}, {1.60168, 0.999523}, {1.60272, 0.99949}, {1.60479, 
  0.999422}, {1.60894, 0.999273}, {1.60997, 0.999233}, {1.61101, 
  0.999192}, {1.61308, 0.999106}, {1.61723, 0.998922}, {1.61826, 
  0.998874}, {1.6193, 0.998824}, {1.62137, 0.998721}, {1.62552, 
  0.998503}, {1.63381, 0.998016}, {1.63484, 0.99795}, {1.63588, 
  0.997883}, {1.63795, 0.997746}, {1.6421, 0.997459}, {1.65038, 
  0.996835}, {1.65142, 0.996752}, {1.65246, 0.996668}, {1.65453, 
  0.996496}, {1.65867, 0.996141}, {1.66696, 0.995379}, {1.66793, 
  0.995286}, {1.6689, 0.995192}, {1.67083, 0.995001}, {1.6747, 
  0.994607}, {1.68244, 0.993775}, {1.69791, 0.991932}, {1.69887, 
  0.991809}, {1.69984, 0.991685}, {1.70177, 0.991435}, {1.70564, 
  0.990922}, {1.71338, 0.989852}, {1.72885, 0.987536}, {1.7299, 
  0.98737}, {1.73095, 0.987203}, {1.73304, 0.986867}, {1.73723, 
  0.986181}, {1.74562, 0.984758}, {1.76239, 0.981703}, {1.76343, 
  0.981503}, {1.76448, 0.981301}, {1.76658, 0.980896}, {1.77077, 
  0.980072}, {1.77915, 0.978372}, {1.79592, 0.974766}, {1.79695, 
  0.974536}, {1.79798, 0.974304}, {1.80004, 0.973839}, {1.80415, 
  0.972895}, {1.81238, 0.970959}, {1.82885, 0.966889}, {1.86177, 
  0.957965}, {1.86273, 0.957689}, {1.86369, 0.957412}, {1.86561, 
  0.956856}, {1.86945, 0.955734}, {1.87713, 0.953447}, {1.89248, 
  0.948704}, {1.92319, 0.938549}, {1.98979, 0.913497}, {2.05197, 
  0.886452}, {2.11292, 0.856615}, {2.17906, 0.820643}, {2.24077, 
  0.783841}, {2.30766, 0.74058}, {2.37012, 0.697189}, {2.43136, 
  0.652008}, {2.49779, 0.600241}, {2.55979, 0.549534}, {2.62697, 
  0.492207}, {2.69293, 0.433762}, {2.75446, 0.377537}, {2.82117, 
  0.314965}, {2.88346, 0.255277}, {2.94452, 0.1958}, {3.01077, 
  0.130452}, {3.07259, 0.0689525}, {3.07366, 0.0678768}, {3.07474, 
  0.066801}, {3.0769, 0.0646492}, {3.08121, 0.0603447}, {3.08984, 
  0.0517324}, {3.10709, 0.0344968}, {3.10817, 0.0334192}, {3.10925, 
  0.0323415}, {3.1114, 0.0301861}, {3.11571, 0.0258749}, {3.12434, 
  0.017251}, {3.12542, 0.0161729}, {3.1265, 0.0150948}, {3.12865, 
  0.0129386}, {3.13297, 0.00862586}, {3.13404, 0.00754765}, {3.13512, 
  0.00646944}, {3.13728, 0.004313}, {3.13836, 0.00323477}, {3.13944, 
  0.00215654}, {3.14051, 0.0010783}, {3.14159, 6.41141*10^-8}}

 

用户: 落雨流觞 (1.1k 分)

1个回答

0 投票
 
已采纳

你可以通过FullForm查看一下完整结构

Plot[Sin[x], {x, 0, Pi}] // FullForm

Plot画函数图像其实生成的是Graphics,里面有一项是Line[{***}]的样式(即画图连线坐标),这个模式就是匹配这个的。

用户: 天龙七绝剑 (421 分)
采纳于 用户:落雨流觞
非常感谢  受教了。我很好奇 Plot是怎么作图的?看数据点,难道是计算函数值?
...