<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Mathematica 问答社区 - 列表操作 中最新问题</title>
<link>https://mmaqa.com/qa/questions/%E5%88%97-%E8%A1%A8-%E6%93%8D-%E4%BD%9C</link>
<description>Powered by Question2Answer</description>
<item>
<title>请教关于select的参数写法</title>
<link>https://mmaqa.com/qa/2785/select</link>
<description>有一串数组&lt;br /&gt;
&lt;br /&gt;
list={{1,2,3,4},{2,2,3,4},{3,2,3,4},{4,2,3,4},{5,2,3,4},{6,6,6,6},{6,6,7,7},{12,12,13,14},{11,12,3,4},{22,22,33,34},{2,2,13,14},{2,22,43,4},{2,2,33,44},}&lt;br /&gt;
&lt;br /&gt;
用count把每个元素都&amp;lt;5，且4个元素相加&amp;lt;20的数量显示出来，这部分已经完成。&lt;br /&gt;
&lt;br /&gt;
问题：&lt;br /&gt;
&lt;br /&gt;
1.现在要把每个元素都&amp;lt;5，且4个元素相加&amp;lt;20的数组从list中去除，变成list2，请问该如何写&lt;br /&gt;
&lt;br /&gt;
2.要把list中所有&amp;gt;17的元素，都=17，要如何写</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/2785/select</guid>
<pubDate>Tue, 12 Oct 2021 14:34:28 +0000</pubDate>
</item>
<item>
<title>如何生成一簇匿名函数</title>
<link>https://mmaqa.com/qa/2709/</link>
<description>想生成一簇 &lt;br /&gt;
&lt;br /&gt;
{#1, #2, #3}.{a, b, c} + d &amp;amp;&lt;br /&gt;
&lt;br /&gt;
的匿名函数来表示一簇平面，其中形如 &amp;nbsp;{{a,b,c},d} 的数据有 32 个。&lt;br /&gt;
&lt;br /&gt;
也就是要得到形如&lt;br /&gt;
&lt;br /&gt;
{a1#1+b1#2+c1#3+d1 &amp;amp; ,a2#1+b2#2+c2#3+d2 &amp;amp;,..., an#1+bn#2+cn#3+dn &amp;amp;}</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/2709/</guid>
<pubDate>Sun, 29 Mar 2020 10:12:08 +0000</pubDate>
</item>
<item>
<title>替换时的一个错误，原因？</title>
<link>https://mmaqa.com/qa/2564/</link>
<description>2 Subscript[a, 2] + 3 Subscript[a, 1] + 4 Subscript[a, 3] -&lt;br /&gt;
&amp;nbsp;&amp;nbsp;1 /. {Subscript[a, i_] -&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;Subscript[y,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;i] - {Subscript[s, 1], Subscript[s, 2], Subscript[s, 3]}[[i]]}&lt;br /&gt;
&lt;br /&gt;
运行后为什么出现错误：Part::pkspec1: 表达式 i 不能作为部分指定使用.</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/2564/</guid>
<pubDate>Mon, 11 Mar 2019 03:30:27 +0000</pubDate>
</item>
<item>
<title>如何简洁且易懂地实现这样的数据处理</title>
<link>https://mmaqa.com/qa/2489/</link>
<description>

&lt;p&gt;已知：&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;pre data-pbcklang=&quot;prettyprint lang-mma&quot; data-pbcktabsize=&quot;4&quot; class=&quot;prettyprint lang-mma&quot;&gt;tdat = {t1, t2, t3};
xdat = {x1, x2, x3};
vdat = {v1, v2, v3};
Fdat = {F1, F2, F3};
mdat = {m};
ndat = {n};
&lt;/pre&gt;

&lt;p&gt;如何简洁且易懂地得到这样的列表&lt;/p&gt;

&lt;pre data-pbcklang=&quot;prettyprint lang-mma&quot; data-pbcktabsize=&quot;4&quot; class=&quot;prettyprint lang-mma&quot;&gt;whatIwant = {{&quot;t&quot;, &quot;x&quot;, &quot;v&quot;, &quot;F&quot;, &quot;m&quot;, &quot;n&quot;}, {t1, x1, v1, F1, m, 
   n}, {t2, x2, v2, F2}, {t3, x3, v3, F3}}&lt;/pre&gt;

&lt;p&gt;即，实现下面的效果&lt;/p&gt;

&lt;p&gt;&lt;img alt=&quot;&quot; src=&quot;https://mmaqa.com/qa/?qa=blob&amp;amp;qa_blobid=17978885041900739666&quot; style=&quot;height:182px; width:572px&quot;&gt;&lt;/p&gt;</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/2489/</guid>
<pubDate>Tue, 18 Sep 2018 11:29:49 +0000</pubDate>
</item>
<item>
<title>如何按照特定的条件筛选数据？</title>
<link>https://mmaqa.com/qa/2193/</link>
<description>

&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
data = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}}&lt;/pre&gt;



&lt;p&gt;如何提取出data中第3个元素大于8的数据？&lt;/p&gt;



&lt;p&gt;希望得到&lt;/p&gt;



&lt;p&gt;{{7, 8, 9}, {10, 11, 12}}&lt;/p&gt;</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/2193/</guid>
<pubDate>Sat, 16 Sep 2017 14:54:33 +0000</pubDate>
</item>
<item>
<title>极限定义的问题。</title>
<link>https://mmaqa.com/qa/2040/</link>
<description>

&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
ForAll[\[CurlyEpsilon], \[CurlyEpsilon] &amp;gt; 0, 
Exists[\[Delta], \[Delta] &amp;gt; 0, 
Implies[0 &amp;lt; Abs[x] &amp;lt; \[Delta], 
0 &amp;lt; Abs[f[x]] &amp;lt; \[CurlyEpsilon]]]] // Resolve
ForAll[\[CurlyEpsilon], \[CurlyEpsilon] &amp;gt; 0, 
Exists[\[Delta], \[Delta] &amp;gt; 0, 
Implies[0 &amp;lt; RealAbs[x] &amp;lt; \[Delta], 
0 &amp;lt; RealAbs[f[x]] &amp;lt; \[CurlyEpsilon]]]] // Resolve

True

\!\(
\*SubscriptBox[\(\[ForAll]\), \({\[CurlyEpsilon]}, \[CurlyEpsilon] &amp;gt; 
   0\)]\(
\*SubscriptBox[\(\[Exists]\), \({\[Delta]}, \[Delta] &amp;gt; 
    0\)]\((0 &amp;lt; RealAbs[x] &amp;lt; \[Delta] \[Implies] 
    0 &amp;lt; RealAbs[f[x]] &amp;lt; \[CurlyEpsilon])\)\)\)&lt;/pre&gt;



&lt;p&gt;&amp;nbsp;&lt;/p&gt;



&lt;p&gt;为什么Abs换成RealAbs就不行了？&lt;/p&gt;</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/2040/</guid>
<pubDate>Wed, 21 Jun 2017 15:36:53 +0000</pubDate>
</item>
<item>
<title>求二维数组的区域极大值，求x在2600-3000间的极大值。</title>
<link>https://mmaqa.com/qa/2037/x2600-3000</link>
<description>

&lt;p&gt;&lt;img alt=&quot;&quot; src=&quot;https://mmaqa.com/qa/?qa=blob&amp;amp;qa_blobid=3350904093286980763&quot; style=&quot;height:346px; width:561px&quot;&gt;&lt;/p&gt;



&lt;p&gt;&amp;nbsp;&lt;/p&gt;



&lt;p&gt;data={{2595.76, 0.000692501}, {2597.69, 0.000747758}, {2599.61, 0.000804909}, {2601.54, 0.000857249}, {2603.47, 0.000915285}, {2605.4, 0.000971129}, {2607.33, 0.00103177}, {2609.26, 0.00109435}, {2611.19, 0.00116123}, {2613.11, 0.00123059}, {2615.04, 0.00130112}, {2616.97, 0.00137482}, {2618.9, 0.00145834}, {2620.83, 0.00155051}, {2622.76, 0.00165481}, {2624.69, 0.00176818}, {2626.61, 0.00189417}, {2628.54, 0.00203138}, {2630.47, 0.002194}, {2632.4, 0.00237739}, {2634.33, 0.00258379}, {2636.26, 0.00280479}, {2638.18, 0.00303875}, {2640.11, 0.00327698}, {2642.04, 0.00351069}, {2643.97, 0.00373329}, {2645.9, 0.00394237}, {2647.83, 0.00412218}, {2649.76, 0.00427206}, {2651.68, 0.00438529}, {2653.61, 0.00446627}, {2655.54, 0.0045179}, {2657.47, 0.00455074}, {2659.4, 0.00456874}, {2661.33, 0.0045813}, {2663.25, 0.00458731}, {2665.18, 0.00459571}, {2667.11, 0.0046107}, {2669.04, 0.00463695}, {2670.97, 0.00468661}, {2672.9, 0.00477598}, {2674.83, 0.00489715}, {2676.75, 0.00506004}, {2678.68, 0.00525445}, {2680.61, 0.00547971}, {2682.54, 0.00572805}, {2684.47, 0.00598887}, {2686.4, 0.00624912}, {2688.33, 0.00649204}, {2690.25, 0.00669059}, {2692.18, 0.00684037}, {2694.11, 0.00692781}, {2696.04, 0.00695141}, {2697.97, 0.00692074}, {2699.9, 0.00684713}, {2701.82, 0.00672837}, {2703.75, 0.00658899}, {2705.68, 0.00643942}, {2707.61, 0.00629571}, {2709.54, 0.00616508}, {2711.47, 0.00605992}, {2713.4, 0.00598401}, {2715.32, 0.00593572}, {2717.25, 0.00591187}, {2719.18, 0.00591824}, {2721.11, 0.00594162}, {2723.04, 0.00598835}, {2724.97, 0.00605281}, {2726.9, 0.00612762}, {2728.82, 0.00620873}, {2730.75, 0.00630628}, {2732.68, 0.00641316}, {2734.61, 0.00652735}, {2736.54, 0.00664618}, {2738.47, 0.00677772}, {2740.39, 0.0069184}, {2742.32, 0.00707008}, {2744.25, 0.00723897}, {2746.18, 0.0074305}, {2748.11, 0.00764001}, {2750.04, 0.00788015}, {2751.97, 0.00814771}, {2753.89, 0.00844686}, {2755.82, 0.00877984}, {2757.75, 0.00915252}, {2759.68, 0.00956529}, {2761.61, 0.0100251}, {2763.54, 0.0105257}, {2765.47, 0.0110869}, {2767.39, 0.0117216}, {2769.32, 0.0124403}, {2771.25, 0.0132517}, {2773.18, 0.0141673}, {2775.11, 0.0151929}, {2777.04, 0.0163331}, {2778.96, 0.0175801}, {2780.89, 0.018928}, {2782.82, 0.0203512}, {2784.75, 0.0218254}, {2786.68, 0.0233052}, {2788.61, 0.0247557}, {2790.54, 0.0261408}, {2792.46, 0.0274448}, {2794.39, 0.0286381}, {2796.32, 0.0297074}, {2798.25, 0.0306425}, {2800.18, 0.031455}, {2802.11, 0.032163}, {2804.04, 0.0327892}, {2805.96, 0.0333605}, {2807.89, 0.0339131}, {2809.82, 0.0344691}, {2811.75, 0.0350611}, {2813.68, 0.0357086}, {2815.61, 0.0364387}, {2817.53, 0.0372588}, {2819.46, 0.0381594}, {2821.39, 0.0391116}, {2823.32, 0.0401017}, {2825.25, 0.0410952}, {2827.18, 0.0420683}, {2829.11, 0.0430056}, {2831.03, 0.0439057}, {2832.96, 0.0447703}, {2834.89, 0.0456175}, {2836.82, 0.0464772}, {2838.75, 0.0474131}, {2840.68, 0.0484741}, {2842.61, 0.0497066}, {2844.53, 0.0511272}, {2846.46, 0.0527395}, {2848.39, 0.0545429}, {2850.32, 0.0565612}, {2852.25, 0.058807}, {2854.18, 0.0613118}, {2856.1, 0.0641114}, {2858.03, 0.0672658}, {2859.96, 0.0708083}, {2861.89, 0.0747529}, {2863.82, 0.0790979}, {2865.75, 0.0838067}, {2867.68, 0.0887475}, {2869.6, 0.093765}, {2871.53, 0.0986875}, {2873.46, 0.103406}, {2875.39, 0.107887}, {2877.32, 0.1122}, {2879.25, 0.116498}, {2881.18, 0.120986}, {2883.1, 0.125826}, {2885.03, 0.131114}, {2886.96, 0.1368}, {2888.89, 0.142695}, {2890.82, 0.14845}, {2892.75, 0.153589}, {2894.67, 0.1576}, {2896.6, 0.160062}, {2898.53, 0.160685}, {2900.46, 0.159393}, {2902.39, 0.156305}, {2904.32, 0.151761}, {2906.25, 0.146219}, {2908.17, 0.140191}, {2910.1, 0.134143}, {2912.03, 0.128459}, {2913.96, 0.12339}, {2915.89, 0.119065}, {2917.82, 0.115477}, {2919.75, 0.112593}, {2921.67, 0.110408}, {2923.6, 0.108979}, {2925.53, 0.108471}, {2927.46, 0.109241}, {2929.39, 0.111782}, {2931.32, 0.116696}, {2933.24, 0.124479}, {2935.17, 0.135437}, {2937.1, 0.149497}, {2939.03, 0.166129}, {2940.96, 0.184366}, {2942.89, 0.203015}, {2944.82, 0.220738}, {2946.74, 0.236287}, {2948.67, 0.248599}, {2950.6, 0.256951}, {2952.53, 0.26104}, {2954.46, 0.261027}, {2956.39, 0.257416}, {2958.31, 0.250966}, {2960.24, 0.242479}, {2962.17, 0.232699}, {2964.1, 0.222159}, {2966.03, 0.211177}, {2967.96, 0.199898}, {2969.89, 0.18844}, {2971.81, 0.176873}, {2973.74, 0.165297}, {2975.67, 0.153826}, {2977.6, 0.142623}, {2979.53, 0.131817}, {2981.46, 0.121536}, {2983.39, 0.111888}, {2985.31, 0.102941}, {2987.24, 0.094718}, {2989.17, 0.0872579}, {2991.1, 0.0805461}, {2993.03, 0.0745791}, {2994.96, 0.0693164}, {2996.89, 0.0647107}, {2998.81, 0.0607013}, {3000.74, 0.0572328}, {3002.67, 0.054242}, {3004.6, 0.0516835}, {3006.53, 0.0494801}, {3008.46, 0.0475906}, {3010.38, 0.0459943}, {3012.31, 0.0446362}, {3014.24, 0.0434967}, {3016.17, 0.0425668}, {3018.1, 0.0417878}, {3020.03, 0.0411811}}&lt;/p&gt;</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/2037/x2600-3000</guid>
<pubDate>Wed, 21 Jun 2017 06:12:58 +0000</pubDate>
</item>
<item>
<title>一个含有变换列表的列表，怎么提取里边的数据？</title>
<link>https://mmaqa.com/qa/1981/</link>
<description>

&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
Clear[&amp;quot;Global`*&amp;quot;]
W[x_] := x^(-4) + 2 x^2 - 3 + (x^(-4) - 1)^2
f[x_, y_, z_] := 
 1/2 ((1/((1 + z)^3*x^3) - x^(-3) + 1)^(-1/3) - 1)*x^3*y^2
g[x_, t_] := -1/3 t (x^3 - 1)
xlist = Range[1, 1.5, 0.1];
Table[NSolve[
  f[x, y, 0.1] + g[x, 2] + 
   NIntegrate[\[Lambda]^2*D[W[t], t]/(1 - t^3), {\[Lambda], 1, 
     x}, {t, ((0.1 + 1)^3*(\[Lambda]^3 - 1) + 1)^(1/3), \[Lambda]}], 
  y], {x, xlist}]&lt;/pre&gt;



&lt;p&gt;结果为一个列表：&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
{{{y -&amp;gt; 0.}, {y -&amp;gt; 0.}}, {{y -&amp;gt; -2.05048}, {y -&amp;gt; 
    2.05048}}, {{y -&amp;gt; -3.03445}, {y -&amp;gt; 
    3.03445}}, {{y -&amp;gt; -3.91118}, {y -&amp;gt; 
    3.91118}}, {{y -&amp;gt; -4.75495}, {y -&amp;gt; 
    4.75495}}, {{y -&amp;gt; -5.58941}, {y -&amp;gt; 5.58941}}}&lt;/pre&gt;



&lt;p&gt;我想让结果里的y1的值提取出来组成一个列表，y2的值提取出来组成另一个列表，请问该怎么处理？&lt;/p&gt;



&lt;p&gt;对于这种数值解方程得出的结果该怎么提取数据？&lt;/p&gt;



&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/1981/</guid>
<pubDate>Mon, 12 Jun 2017 08:51:42 +0000</pubDate>
</item>
<item>
<title>数值计算时，怎么在某一区间取更多的点？我下边的程序能通过Table实现吗？</title>
<link>https://mmaqa.com/qa/1905/table</link>
<description>

&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
Clear[&amp;quot;Global`*&amp;quot;]
W[x_] := a1 (x^(-4) + 2 x^2 - 3)
p2[x_] := 
 Integrate[
  D[W[x], x]/(1 - x^3)/
   a1, {x, ((\[Delta] + 1)^3*(xb^3 - 1) + 1)^(1/3), xb}]
yy = Table[
   NIntegrate[
    D[W[x], x]/(1 - x^3)/
     a1, {x, ((\[Delta] + 1)^3*(xb^3 - 1) + 1)^(1/3), xb}], {\[Delta],
     0.5, 1, 0.5}, {xb, 1, 4, 0.1}];
xx = Range[1, 4, 0.1];
ListLinePlot[Transpose[{xx, yy[[2]]}], Mesh -&amp;gt; All, 
 AxesLabel -&amp;gt; {xb, p2}]&lt;/pre&gt;



&lt;p&gt;图形结果如下&lt;/p&gt;



&lt;p&gt;&lt;img alt=&quot;&quot; src=&quot;https://mmaqa.com/qa/?qa=blob&amp;amp;qa_blobid=16705183391428163993&quot; style=&quot;height:267px; width:446px&quot;&gt;&lt;/p&gt;



&lt;p&gt;程序中1至4步长都是0.1，但我想在1至1.5取步长0.01,1.5之后取步长0.01，该怎么做？&lt;/p&gt;</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/1905/table</guid>
<pubDate>Thu, 25 May 2017 04:04:53 +0000</pubDate>
</item>
<item>
<title>创建由前100个立方数组成的列表，把列表中的平方数替换成x。请问应该如何实现。</title>
<link>https://mmaqa.com/qa/1891/100x</link>
<description>创建由前100个立方数组成的列表，把列表中的平方数替换成x。请问应该如何实现。</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/1891/100x</guid>
<pubDate>Mon, 08 May 2017 01:23:10 +0000</pubDate>
</item>
<item>
<title>对文件中的数据处理</title>
<link>https://mmaqa.com/qa/1802/</link>
<description>

&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://mmaqa.com/?qa=blob&amp;amp;qa_blobid=17271286151031759285&quot;&gt;https://mmaqa.com/?qa=blob&amp;amp;qa_blobid=17271286151031759285&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;nonDipoleContributions[[1 ;; -2, {1, 2}]]&lt;/p&gt;



&lt;p&gt;nonDipoleContributions[[1 ;; -2, {3}]]&lt;/p&gt;



&lt;p&gt;这个命令对数据做了什么。&lt;/p&gt;</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/1802/</guid>
<pubDate>Sun, 19 Mar 2017 07:44:02 +0000</pubDate>
</item>
<item>
<title>数据按一定规律重组</title>
<link>https://mmaqa.com/qa/1789/</link>
<description>我现在遇到个问题，假设data1={1,2,3,4},data2={5,6,7,8},现在需要将data1、data2数据重组为形式data3={{1,5},{2,6},{3,7},{4,8}}，就是将data1、data2的数据构成1-1,2-2,3-3,4-4形式，使其对应成一对，怎样让MMA简单实现？另外就是，如果data1、data2数据等个数，而data1、data2之间建立一个对应关系（不一定是上面那种，比如是1-2,2-3,3-4,4-1），这又该怎么实现？谢谢</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/1789/</guid>
<pubDate>Thu, 16 Mar 2017 09:48:04 +0000</pubDate>
</item>
<item>
<title>如何生成类似下面的矩阵</title>
<link>https://mmaqa.com/qa/1654/</link>
<description>

&lt;p&gt;想要生成类似下面的矩阵&lt;/p&gt;



&lt;p&gt;&lt;img alt=&quot;&quot; src=&quot;https://mmaqa.com/qa/?qa=blob&amp;amp;qa_blobid=6770711095917290703&quot; style=&quot;height:181px; width:291px&quot;&gt;&lt;/p&gt;



&lt;p&gt;我是这么想得&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
temp = {};
Do[
 c = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
 c[[i]] = 0;
 AppendTo[temp, c],
 {i, 1, 10}]
temp // MatrixForm&lt;/pre&gt;



&lt;p&gt;想问一下有其他方便的方法吗&lt;/p&gt;</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/1654/</guid>
<pubDate>Tue, 17 Jan 2017 07:17:44 +0000</pubDate>
</item>
<item>
<title>MMA如何做Flatten的反操作，加{}</title>
<link>https://mmaqa.com/qa/1583/mmaflatten</link>
<description>

&lt;p&gt;由于某种需要，我想给列表{1,2,3,4,5,6}进行加{}操作，就是外层加一层{}，内部指定位置比如2-4也加一层括号，变为{{1,{2},{3},{4},5,6}}，不要手动添加，最好通过函数实现...&lt;/p&gt;</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/1583/mmaflatten</guid>
<pubDate>Mon, 26 Dec 2016 14:01:11 +0000</pubDate>
</item>
<item>
<title>如何对数据进行指定运算操作</title>
<link>https://mmaqa.com/qa/1551/</link>
<description>

&lt;p&gt;已知数据data = {1, 12, 34, 4, 5,&amp;nbsp;3 7, 9}，指定位置列表{1,3,4,7}，现在想对data的1,3,4,7位置元素除以2，其余位置元素除以3，然后把运算后的元素列表再赋给data，问该如何操作...&lt;/p&gt;



&lt;p&gt;我只会下面这个操作&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
data[[#]]/18 &amp;amp; /@ {1, 3, 4, 7}&lt;/pre&gt;



&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/1551/</guid>
<pubDate>Fri, 23 Dec 2016 14:22:04 +0000</pubDate>
</item>
<item>
<title>如何提取一组列表数据经傅里叶变换后为实数的项及其位置</title>
<link>https://mmaqa.com/qa/1548/</link>
<description>

&lt;p&gt;一组数经傅里叶变换后变为一组复数，但是单个数据却不可以傅里叶变换，所以我无法用Select选出经傅里叶变换后为实数的原数据及其位置&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
data = {1, 1, 2, 2, 1, 1, 0, 0}
Fourier[data]
Select[Fourier[data], Im@# == 0 &amp;amp;]&lt;/pre&gt;



&lt;p&gt;&lt;img alt=&quot;&quot; src=&quot;https://mmaqa.com/qa/?qa=blob&amp;amp;qa_blobid=12864693857986856319&quot; style=&quot;height:449px; width:400px&quot;&gt;&lt;/p&gt;



&lt;p&gt;与此相关的另一个问题是，如何返回符合要求的列表数据及其位置&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
Position[{1, 3, 1, 9, 2, 6, 4, 2, 6, 5}, # &amp;gt; 3 &amp;amp;]&lt;/pre&gt;



&lt;p&gt;&lt;img alt=&quot;&quot; src=&quot;https://mmaqa.com/qa/?qa=blob&amp;amp;qa_blobid=8662213109988147967&quot; style=&quot;height:449px; width:400px&quot;&gt;&lt;/p&gt;</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/1548/</guid>
<pubDate>Fri, 23 Dec 2016 08:54:17 +0000</pubDate>
</item>
<item>
<title>如何提取下面数组中第一项为0的项</title>
<link>https://mmaqa.com/qa/1544/0</link>
<description>

&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
a = {{1, 5, 50}, {0, 10, 50}, {0, 15, 50}, {1, 20, 50}, {0, 25,50}, {0, 30, 50}, {0, 35, 50}, {1, 40, 50}, {0, 45, 50}};&lt;/pre&gt;



&lt;p&gt;对于这样数据，怎么提取第个为0的项&lt;/p&gt;



&lt;p&gt;如对于上面一组数据，应该求出来是下面这样的&lt;/p&gt;



&lt;p&gt;{{0, 10, 50}，{0, 15, 50}，{0, 30, 50}, {0, 35, 50}， {0, 45, 50}}&lt;/p&gt;</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/1544/0</guid>
<pubDate>Mon, 14 Nov 2016 06:10:28 +0000</pubDate>
</item>
<item>
<title>Map如何来对函数赋值</title>
<link>https://mmaqa.com/qa/1521/map</link>
<description>

&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
f[x_, y_] := Block[{}, 0.0817*(3.71*Sqrt[x] + 5.81 - 0.25 x)*(y - 9.14) + 91.4]&lt;/pre&gt;



&lt;p&gt;定义一个f[x，y]&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
f[{1, 2}, {1, 2}]&lt;/pre&gt;



&lt;p&gt;我可以这么给他赋值&lt;/p&gt;



&lt;p&gt;如何把上面这句话改写成Map来写&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
f[#] &amp;amp; /@ {{1, 2}, {1, 2}}
Map[f, {{1, 2}, {1, 2}}, {2}]&lt;/pre&gt;



&lt;p&gt;我试了这两种都不对。&lt;/p&gt;</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/1521/map</guid>
<pubDate>Tue, 08 Nov 2016 13:13:30 +0000</pubDate>
</item>
<item>
<title>如何将两个数组里的元素两两合并</title>
<link>https://mmaqa.com/qa/1374/</link>
<description>

&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
举一个例子，我想有下面的效果
a  = {x1, x2, x3};
b = {x4, x5, x6};
c = {};
For[i = 1, i &amp;lt;= Length[a], i++,
 c = AppendTo[c, {a[[i]], b[[i]]}];
 ]&lt;/pre&gt;



&lt;p&gt;于是得到 c 为 {{x1, x4}, {x2, x5}, {x3, x6}}&lt;/p&gt;



&lt;p&gt;我想问一下有什么别的方法可以得到这样的结果吗&lt;/p&gt;



&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/1374/</guid>
<pubDate>Sun, 16 Oct 2016 07:57:33 +0000</pubDate>
</item>
<item>
<title>如何求一个分布的分位数</title>
<link>https://mmaqa.com/qa/1290/</link>
<description>

&lt;p&gt;比如我知道t服从t分布，当t = 1.96可以求出t&amp;lt;=1.96的概率&lt;/p&gt;



&lt;p&gt;&lt;img alt=&quot;&quot; src=&quot;https://mmaqa.com/qa/?qa=blob&amp;amp;qa_blobid=14966068493091790156&quot; style=&quot;height:117px; width:600px&quot;&gt;&lt;/p&gt;



&lt;p&gt;那么我如何求t为多少时，概率为0.95&lt;/p&gt;</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/1290/</guid>
<pubDate>Fri, 07 Oct 2016 13:28:09 +0000</pubDate>
</item>
<item>
<title>数组为何不能这样赋值？</title>
<link>https://mmaqa.com/qa/1117/</link>
<description>

&lt;p&gt;这样做不可以：
&lt;br&gt;
&amp;nbsp;&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
Map[p, Range[0, 3]] = {a, b, c, d}&lt;/pre&gt;



&lt;p&gt;
&lt;br&gt;
而这样做却可以：&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;

{p[0], p[1], p[2], p[3]} = {a, b, c, d}&lt;/pre&gt;



&lt;p&gt;
&lt;br&gt;
为什么？
&lt;br&gt;

&lt;br&gt;
另：定义一个从零开始计数的数组有这么难吗？上面那个代码看来可行，但是又不想输入4次数组名。。。期待你的高见。
&lt;br&gt;

&lt;br&gt;
&amp;nbsp;
&lt;br&gt;
还有：math到底有没有自定义数据类型的概念？网上找了好久，好像没有。。。这么强大的功能，math为什么不支持？&lt;/p&gt;</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/1117/</guid>
<pubDate>Fri, 19 Aug 2016 01:15:20 +0000</pubDate>
</item>
<item>
<title>能解释一下这个[[-1 ;; -3 ;; -1]]吗</title>
<link>https://mmaqa.com/qa/1113/1-3-1</link>
<description>

&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
SortBy[a, Last][[-1 ;; -3 ;; -1]]&lt;/pre&gt;



&lt;p&gt;这句话表示按照逆序取出最后三个，但是我不能理解她的表达方式&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
SortBy[a, Last][[-3 ;; -1]]&lt;/pre&gt;



&lt;p&gt;比如像这句话表示取出 倒数第三个到倒数第一个的值&lt;/p&gt;</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/1113/1-3-1</guid>
<pubDate>Thu, 18 Aug 2016 08:43:37 +0000</pubDate>
</item>
<item>
<title>生成随机整数序列</title>
<link>https://mmaqa.com/qa/1033/</link>
<description>我的问题比较简单，给定整数n，生成包含1～n的所有整数的长度为n的随机序列，有没有现成的函数？谢谢</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/1033/</guid>
<pubDate>Wed, 27 Jul 2016 06:53:26 +0000</pubDate>
</item>
<item>
<title>How to robustly  find the term in a complex expression that leads to a non numeric value (Infinity, indeterminate, etc)</title>
<link>https://mmaqa.com/qa/1031/robustly-complex-expression-numeric-infinity-indeterminate</link>
<description>

&lt;p&gt;For example, when evaluating&amp;nbsp;this expression,&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
&amp;nbsp; &amp;nbsp; f[z_] := Log[z/1] + Log[Sin[z + 1/Cos[1/z]]];

&amp;nbsp; &amp;nbsp; f[0]&lt;/pre&gt;



&lt;p&gt;I want to find the terms z/1 in the first Log&amp;nbsp;and 1/z&amp;nbsp;in Cos&lt;/p&gt;



&lt;p&gt;&amp;nbsp;&lt;/p&gt;



&lt;p&gt;SE 总是上不去就来这里问问&lt;/p&gt;</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/1031/robustly-complex-expression-numeric-infinity-indeterminate</guid>
<pubDate>Mon, 25 Jul 2016 04:31:11 +0000</pubDate>
</item>
<item>
<title>如何实现压平列表的最内层？</title>
<link>https://mmaqa.com/qa/583/</link>
<description>

&lt;p&gt;例如：&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
{{a, b}, {c, {d}, e}, {f, {g, h}}}&lt;/pre&gt;



&lt;p&gt;希望实现的结果为：&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
{{a, b}, {c, d, e}, {f, g, h}}&lt;/pre&gt;



&lt;p&gt;再例如：&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
{{{a},{b},{c},d},{e}}&lt;/pre&gt;



&lt;p&gt;希望实现的结果为：&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
{{a,b,c,d},{e}}&lt;/pre&gt;



&lt;p&gt;我使劲倒弄Flatten，可是怎么弄都好像不对.....&lt;/p&gt;



&lt;p&gt;===========================================================&lt;/p&gt;



&lt;p&gt;利用TreeForm对最内层下一个定义。&lt;/p&gt;



&lt;p&gt;&lt;img alt=&quot;&quot; src=&quot;https://mmaqa.com/qa/?qa=blob&amp;amp;qa_blobid=2593430001404022223&quot; style=&quot;height:242px; width:401px&quot;&gt;&lt;/p&gt;



&lt;p&gt;只有TreeForm产生的图的全体最终节点（最内层）中的元素被取出，并且放入到对应的上一节点内（压平）。又如：&lt;/p&gt;



&lt;p&gt;&lt;img alt=&quot;&quot; src=&quot;https://mmaqa.com/qa/?qa=blob&amp;amp;qa_blobid=4930373348600798311&quot; style=&quot;height:254px; width:377px&quot;&gt;&lt;/p&gt;



&lt;p&gt;以及：&lt;/p&gt;



&lt;p&gt;&lt;img alt=&quot;&quot; src=&quot;https://mmaqa.com/qa/?qa=blob&amp;amp;qa_blobid=12059161003486864784&quot; style=&quot;height:326px; width:365px&quot;&gt;&lt;/p&gt;



&lt;p&gt;还有：&lt;/p&gt;



&lt;p&gt;&lt;img alt=&quot;&quot; src=&quot;https://mmaqa.com/qa/?qa=blob&amp;amp;qa_blobid=14021921662386941257&quot; style=&quot;height:350px; width:572px&quot;&gt;&lt;/p&gt;



&lt;p&gt;================================================&lt;/p&gt;



&lt;p&gt;发现了一个比较严重的问题。好像各位都完全没考虑列表元素是符号值的情况啊。&lt;/p&gt;



&lt;p&gt;出错示例：&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
In[94]:= flattenMostInner=Map[#/.{{x___}:&amp;gt;x,x___:&amp;gt;x}&amp;amp;,#,{Depth[#]-2}]&amp;amp;;
flattenMostInner2=Map[#/.{x_List:&amp;gt;Flatten@x}&amp;amp;,#,{Depth[#]-3}]&amp;amp;;
flattenMostInner3=Apply[Sequence,#,{Depth[#]-2}]&amp;amp;;
test0={{{a},{b}},{{c,{d}},{e},{f},{{g},{h}}}};
test1=List[List[List[Hue[0.5107930946784643`,0.8354307161342199`,0.7718521452428755`]],List[Hue[0.5113169196285673`,0.8358213579394708`,0.7713657815095133`]]],List[List[Hue[0.192618226271086`,0.8755716287620745`,0.7116923362420707`],List[Hue[0.5107930946784643`,0.8354307161342199`,0.7718521452428755`]]],List[Hue[0.3731282181502969`,0.789529229678425`,0.8195909513398986`]],List[Hue[0.4076579648111174`,0.7921461731652201`,0.8172922377294225`]],List[List[Hue[0.192618226271086`,0.8755716287620745`,0.7116923362420707`]],List[Hue[0.3731282181502969`,0.789529229678425`,0.8195909513398986`]]]]];
test2={{{f[a]},{f[b]}},{{g[a],{g[b]}},{f[a]},{g[e]},{{h[a]},{h[b]}}}};
test3=
flattenMostInner@test0
flattenMostInner2@test0
flattenMostInner3@test0
flattenMostInner@test1//FullForm
flattenMostInner2@test1//FullForm
flattenMostInner3@test1//FullForm
flattenMostInner@test2
flattenMostInner2@test2
flattenMostInner3@test2
Out[100]= {{{a},{b}},{{c,d},{e},{f},{g,h}}}
Out[101]= {{{a},{b}},{{c,d},{e},{f},{g,h}}}
Out[102]= {{{a},{b}},{{c,d},{e},{f},{g,h}}}
Out[103]//FullForm= List[List[List[Hue[0.5107930946784643`,0.8354307161342199`,0.7718521452428755`]],List[Hue[0.5113169196285673`,0.8358213579394708`,0.7713657815095133`]]],List[List[Hue[0.192618226271086`,0.8755716287620745`,0.7116923362420707`],List[Hue[0.5107930946784643`,0.8354307161342199`,0.7718521452428755`]]],List[Hue[0.3731282181502969`,0.789529229678425`,0.8195909513398986`]],List[Hue[0.4076579648111174`,0.7921461731652201`,0.8172922377294225`]],List[List[Hue[0.192618226271086`,0.8755716287620745`,0.7116923362420707`]],List[Hue[0.3731282181502969`,0.789529229678425`,0.8195909513398986`]]]]]
Out[104]//FullForm= List[List[List[Hue[0.5107930946784643`,0.8354307161342199`,0.7718521452428755`]],List[Hue[0.5113169196285673`,0.8358213579394708`,0.7713657815095133`]]],List[List[Hue[0.192618226271086`,0.8755716287620745`,0.7116923362420707`],List[Hue[0.5107930946784643`,0.8354307161342199`,0.7718521452428755`]]],List[Hue[0.3731282181502969`,0.789529229678425`,0.8195909513398986`]],List[Hue[0.4076579648111174`,0.7921461731652201`,0.8172922377294225`]],List[List[Hue[0.192618226271086`,0.8755716287620745`,0.7116923362420707`]],List[Hue[0.3731282181502969`,0.789529229678425`,0.8195909513398986`]]]]]
Out[105]//FullForm= List[List[List[Hue[0.5107930946784643`,0.8354307161342199`,0.7718521452428755`]],List[Hue[0.5113169196285673`,0.8358213579394708`,0.7713657815095133`]]],List[List[Hue[0.192618226271086`,0.8755716287620745`,0.7116923362420707`],List[0.5107930946784643`,0.8354307161342199`,0.7718521452428755`]],List[Hue[0.3731282181502969`,0.789529229678425`,0.8195909513398986`]],List[Hue[0.4076579648111174`,0.7921461731652201`,0.8172922377294225`]],List[List[0.192618226271086`,0.8755716287620745`,0.7116923362420707`],List[0.3731282181502969`,0.789529229678425`,0.8195909513398986`]]]]
Out[106]= {{{f[a]},{f[b]}},{{g[a],{g[b]}},{f[a]},{g[e]},{{h[a]},{h[b]}}}}
Out[107]= {{{f[a]},{f[b]}},{{g[a],{g[b]}},{f[a]},{g[e]},{{h[a]},{h[b]}}}}
Out[108]= {{{f[a]},{f[b]}},{{g[a],{b}},{f[a]},{g[e]},{{a},{b}}}}&lt;/pre&gt;



&lt;p&gt;==============================================================&lt;/p&gt;



&lt;p&gt;此外，必须更加精密地定义最底层的概念。节点的长度，理应是根据FullFrom的头部为List的节点作计算的。&lt;/p&gt;



&lt;p&gt;因此例如：&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
{a, {b, g[g[g[{c, {d}}]]]}}&lt;/pre&gt;



&lt;p&gt;应该得到：&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
{a, b, g[g[g[{c, {d}}]]]}&lt;/pre&gt;



&lt;p&gt;诸如以下的：&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
{a -&amp;gt; {1, {2, {3}}}, {b :&amp;gt; {2, {3}}, {c, {d}}}}&lt;/pre&gt;



&lt;p&gt;应该得到：&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
{a -&amp;gt; {1, {2, {3}}}, {b :&amp;gt; {2, {3}}, {c, d}}}&lt;/pre&gt;



&lt;p&gt;因为：&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
In[116]:= {a-&amp;gt;{1,{2,{3}}},{b:&amp;gt;{2,{3}},{c,{d}}}}//FullForm
Out[116]//FullForm= List[Rule[a,List[1,List[2,List[3]]]],List[RuleDelayed[b,List[2,List[3]]],List[c,List[d]]]]&lt;/pre&gt;



&lt;p&gt;理应只有List[C,List[d]]被压平。&lt;/p&gt;



&lt;p&gt;==========================================&lt;/p&gt;



&lt;p&gt;为什么Atom的识别是无歧义非人为的：&lt;/p&gt;



&lt;p&gt;&lt;img alt=&quot;&quot; src=&quot;https://mmaqa.com/qa/?qa=blob&amp;amp;qa_blobid=15974814466659834956&quot; style=&quot;height:392px; width:584px&quot;&gt;&lt;/p&gt;



&lt;p&gt;只有List作为头部的节点才能计算层数。在FullForm和TreeForm是掩盖不了的。又如：&lt;/p&gt;



&lt;p&gt;&lt;img alt=&quot;&quot; src=&quot;https://mmaqa.com/qa/?qa=blob&amp;amp;qa_blobid=14146451874927937974&quot; style=&quot;height:339px; width:600px&quot;&gt;&lt;/p&gt;



&lt;p&gt;蓝色线是表示满足最底层的分叉，蓝圈是对于flattenMostInner有意义而不是视为一个单独Atom的节点。本质上来说这是一个图论问题。&lt;/p&gt;</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/583/</guid>
<pubDate>Sat, 21 May 2016 14:21:27 +0000</pubDate>
</item>
<item>
<title>如何实现如下的列表操作？</title>
<link>https://mmaqa.com/qa/396/</link>
<description>

&lt;p&gt;现有一个列表其结构如下:&lt;/p&gt;



&lt;p&gt;&lt;img alt=&quot;&quot; src=&quot;https://mmaqa.com/qa/?qa=blob&amp;amp;qa_blobid=16854516434612070436&quot; style=&quot;height:136px; width:600px&quot;&gt;&lt;/p&gt;



&lt;p&gt;生成表的代码：&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
f[x_, y_] := Log[x, y]
ParallelTable[
 {(Arg[f[E^(I z) x, y]] + \[Pi])/(2 \[Pi]), 1/(
   1 + 0.3 Log[Abs[f[E^(I z) x, y]] + 1]), 
   1 - 1/(1.1 + 5 Log[Abs[f[E^(I z) x, y]] + 1])], z},
 {z, -\[Pi], \[Pi], \[Pi]/5}, {y, -25 + 0.0012, 25, 1}, {x, 
  0 + 0.0012, 50, 1}]&lt;/pre&gt;



&lt;p&gt;现在我希望将这个表转化为以下的形式：&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
(*表的结构抽象一点来看是这样的*)
{
 {
  {{f000,z0},{f001,z0},...,{f00p,z0}},
  {{f010,z0},{f011,z0},...,{f01p,z0}},...
  {{f0q0,z0},{f0q1,z0},...,{f0qp,z0}}
 },
 {
  {{f100,z1},{f101,z1},...,{f10p,z1}},
  {{f110,z1},{f111,z1},...,{f11p,z1}},...
  {{f1q0,z1},{f1q1,z1},...,{f1qp,z1}}
 },...,
 {
  {{fr00,zr},{fr01,zr},...,{fr0p,zr}},
  {{fr10,zr},{fr11,zr},...,{fr1p,zr}},...
  {{frq0,zr},{frq1,zr},...,{frqp,zr}}
 }
}

(*现在希望变成这样*)
{
 g[{
  {{f000},{f001},...,{f00p}},
  {{f010},{f011},...,{f01p}},...
  {{f0q0},{f0q1},...,{f0qp}}
 },z0],
 g[{
  {{f100},{f101},...,{f10p}},
  {{f110},{f111},...,{f11p}},...
  {{f1q0},{f1q1},...,{f1qp}}
 },z1],...,
 g[{
  {{fr00},{fr01},...,{fr0p}},
  {{fr10},{fr11},...,{fr1p}},...
  {{frq0},{frq1},...,{frqp}}
 },zr],
}&lt;/pre&gt;



&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/396/</guid>
<pubDate>Sun, 08 May 2016 06:16:32 +0000</pubDate>
</item>
<item>
<title>总体而言是Parallel系列的函数快，还是开启并行选项的编译过的同名函数快？</title>
<link>https://mmaqa.com/qa/150/parallel</link>
<description>开启并行选项的编译过的同名函数和Parallel系列的同名函数实现方式是一样的么？可以达到一样/更优的速度么？</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/150/parallel</guid>
<pubDate>Sun, 17 Apr 2016 03:00:59 +0000</pubDate>
</item>
<item>
<title>为什么ParallelTable比Table慢，ParallelMap比Map慢</title>
<link>https://mmaqa.com/qa/146/paralleltabletableparallelmapmap</link>
<description>

&lt;p&gt;这是为什么呢？
&lt;br&gt;

&lt;br&gt;
&amp;nbsp;&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
Test1[System`Dump`matrix_?MatrixQ, System`Dump`y___] :=&amp;nbsp;
Block[{System`Dump`m = System`Dump`toRaster[System`Dump`matrix]},
Developer`ToPackedArray[System`Dump`m]]
Test3[System`Dump`matrix_?MatrixQ, System`Dump`y___] :=&amp;nbsp;
System`Dump`toRaster[System`Dump`matrix]


Ember`toRaster[{x___}] := ParallelMap[Ember`toRaster, {x}]

Ember`toRaster[(Hue | GrayLevel | RGBColor | CMYKColor)[x_]] := x
Ember`toRaster[(Hue | GrayLevel | RGBColor | CMYKColor)[x_,&amp;nbsp;
y__]] := {x, y}
Ember`toRaster[___] := 0


Test4[w_, y___] := Developer`ToPackedArray[Ember`toRaster[w]]


fn := (x + I y)^(x + I y)
DistributeDefinitions[fn, Test1, Test3, Ember`toRaster, Test4]
RepeatedTiming[
Test1[Table[
Hue[(Arg[fn] + \[Pi])/(2 \[Pi]), 1/(1 + 0.3 Log[Abs[fn] + 1]),&amp;nbsp;
1 - 1/(1.1 + 5 Log[Abs[fn] + 1]), 1], {y, -2 + 0.0012, 2,&amp;nbsp;
0.2}, {x, -2 + 0.0012, 2, 0.2}]], 120] // Short
RepeatedTiming[
Test3[ParallelTable[
Hue[(Arg[fn] + \[Pi])/(2 \[Pi]), 1/(1 + 0.3 Log[Abs[fn] + 1]),&amp;nbsp;
1 - 1/(1.1 + 5 Log[Abs[fn] + 1]), 1], {y, -2 + 0.0012, 2,&amp;nbsp;
0.2}, {x, -2 + 0.0012, 2, 0.2}]], 120] // Short
RepeatedTiming[
Test4[Table[
Hue[(Arg[fn] + \[Pi])/(2 \[Pi]), 1/(1 + 0.3 Log[Abs[fn] + 1]),&amp;nbsp;
1 - 1/(1.1 + 5 Log[Abs[fn] + 1]), 1], {y, -2 + 0.0012, 2,&amp;nbsp;
0.2}, {x, -2 + 0.0012, 2, 0.2}]], 120] // Short
RepeatedTiming[
Parallelize[
Test1[Table[
Hue[(Arg[fn] + \[Pi])/(2 \[Pi]), 1/(1 + 0.3 Log[Abs[fn] + 1]),&amp;nbsp;
1 - 1/(1.1 + 5 Log[Abs[fn] + 1]), 1], {y, -2 + 0.0012, 2,&amp;nbsp;
0.2}, {x, -2 + 0.0012, 2, 0.2}]]], 120] // Short&lt;/pre&gt;



&lt;p&gt;
&lt;br&gt;

&lt;br&gt;

&lt;br&gt;

&lt;br&gt;

&lt;br&gt;

&lt;br&gt;

&lt;br&gt;
分别结果为&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
{0.0069,{{&amp;lt;&amp;lt;1&amp;gt;&amp;gt;},{&amp;lt;&amp;lt;1&amp;gt;&amp;gt;},&amp;lt;&amp;lt;17&amp;gt;&amp;gt;,{&amp;lt;&amp;lt;1&amp;gt;&amp;gt;}}}
{0.02,{{&amp;lt;&amp;lt;1&amp;gt;&amp;gt;},&amp;lt;&amp;lt;18&amp;gt;&amp;gt;,{{&amp;lt;&amp;lt;1&amp;gt;&amp;gt;},&amp;lt;&amp;lt;19&amp;gt;&amp;gt;}}}
{0.47,{{&amp;lt;&amp;lt;1&amp;gt;&amp;gt;},&amp;lt;&amp;lt;18&amp;gt;&amp;gt;,{{&amp;lt;&amp;lt;1&amp;gt;&amp;gt;},&amp;lt;&amp;lt;19&amp;gt;&amp;gt;}}}
{0.0071,{{&amp;lt;&amp;lt;1&amp;gt;&amp;gt;},{&amp;lt;&amp;lt;1&amp;gt;&amp;gt;},&amp;lt;&amp;lt;17&amp;gt;&amp;gt;,{&amp;lt;&amp;lt;1&amp;gt;&amp;gt;}}}&lt;/pre&gt;



&lt;p&gt;
&lt;br&gt;
并且后两者报错。
&lt;br&gt;
谁能说明下并行为什么会比正常运算慢呢？&lt;/p&gt;</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/146/paralleltabletableparallelmapmap</guid>
<pubDate>Sat, 16 Apr 2016 11:14:51 +0000</pubDate>
</item>
<item>
<title>如何用各个向量之间的余弦值对变量进行分类</title>
<link>https://mmaqa.com/qa/134/</link>
<description>

&lt;p&gt;对这方面知识还了解不太多，如果概念错了，请指正谢谢
&lt;br&gt;
&amp;nbsp;&lt;/p&gt;



&lt;pre class=&quot;prettyprint lang-mma&quot;&gt;
data = {{2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2,
     2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 
    2}, {2, 2, 2, 1}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2,
     2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 
    2}, {2, 2, 2, 2}, {1, 2, 1, 1}, {2, 2, 2, 2}, {2, 2, 2, 2}, {1, 2,
     2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 
    2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 1}, {2, 2,
     2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 
    2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 1, 2, 2}, {2, 2, 2, 2}, {2, 2,
     2, 2}, {1, 1, 1, 1}, {2, 2, 2, 2}, {2, 1, 2, 2}, {2, 1, 2, 
    2}, {2, 1, 2, 1}, {2, 2, 2, 1}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 1,
     1, 1}, {2, 2, 1, 1}, {2, 1, 2, 1}, {2, 2, 2, 2}, {2, 1, 2, 
    1}, {2, 1, 2, 2}, {2, 2, 2, 2}, {2, 1, 2, 1}, {2, 1, 2, 2}, {2, 1,
     1, 1}, {1, 1, 1, 1}, {2, 2, 2, 2}, {1, 1, 1, 1}, {2, 1, 2, 
    1}, {2, 1, 2, 1}, {2, 1, 2, 1}, {2, 1, 2, 1}, {2, 1, 1, 1}, {2, 1,
     2, 1}, {2, 1, 2, 2}, {2, 2, 2, 1}, {2, 1, 1, 2}, {1, 1, 1, 
    1}, {1, 1, 2, 1}, {2, 2, 2, 2}, {2, 1, 2, 1}, {2, 2, 2, 2}, {2, 1,
     1, 1}, {2, 1, 1, 2}, {1, 1, 1, 1}, {1, 1, 2, 2}, {2, 2, 2, 
    2}, {1, 1, 1, 1}, {1, 1, 2, 2}, {2, 2, 2, 2}, {1, 1, 1, 2}, {1, 2,
     1, 2}, {1, 1, 2, 1}, {2, 2, 2, 1}, {2, 2, 2, 2}, {2, 1, 2, 
    2}, {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, {2, 1, 2, 1}, {1, 1,
     1, 1}, {1, 1, 1, 2}, {2, 1, 2, 2}, {1, 1, 2, 1}, {1, 2, 1, 
    1}, {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 2, 2, 2}, {1, 1, 1, 1}, {2, 2,
     1, 1}, {2, 2, 2, 2}, {1, 1, 1, 1}, {2, 2, 2, 2}, {2, 2, 2, 
    2}, {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1,
     1, 1}, {2, 2, 1, 1}, {1, 1, 1, 1}, {2, 1, 1, 1}, {2, 1, 2, 
    1}, {2, 1, 2, 1}, {2, 2, 1, 2}, {1, 1, 1, 1}, {2, 2, 2, 2}, {2, 1,
     2, 1}, {2, 1, 2, 2}, {1, 1, 1, 2}, {2, 2, 2, 2}, {1, 1, 1, 
    1}, {1, 2, 1, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 1,
     1, 2}, {2, 2, 2, 2}, {1, 2, 2, 1}, {2, 1, 1, 1}, {2, 2, 2, 
    1}, {2, 1, 1, 1}, {2, 1, 2, 1}, {2, 1, 1, 1}, {1, 1, 1, 1}, {2, 1,
     1, 2}, {1, 1, 1, 1}, {1, 1, 2, 1}, {1, 1, 1, 1}, {1, 1, 1, 
    2}, {2, 1, 1, 1}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2,
     2, 2}, {2, 2, 2, 2}, {1, 1, 1, 1}, {2, 2, 2, 2}, {2, 1, 2, 
    1}, {2, 2, 2, 2}, {2, 2, 2, 1}, {1, 2, 1, 2}, {2, 2, 2, 2}, {1, 2,
     1, 2}, {2, 2, 1, 1}, {1, 1, 1, 2}, {2, 2, 2, 2}, {1, 2, 1, 
    1}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {1, 1,
     1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, {2, 2, 2, 2}, {2, 1, 2, 
    1}, {2, 2, 2, 2}, {1, 1, 1, 1}, {1, 1, 2, 1}, {1, 1, 1, 1}, {2, 2,
     1, 1}, {2, 2, 2, 2}, {1, 1, 1, 1}, {2, 2, 1, 2}, {1, 1, 2, 
    2}, {1, 2, 1, 2}, {1, 2, 2, 1}, {2, 2, 2, 2}, {2, 2, 1, 1}, {2, 1,
     2, 1}, {2, 2, 2, 2}, {2, 1, 2, 2}, {1, 1, 1, 2}, {2, 2, 1, 
    1}, {1, 1, 1, 1}, {1, 2, 1, 2}, {2, 2, 2, 1}, {2, 1, 2, 2}, {1, 2,
     1, 2}, {2, 2, 2, 2}, {1, 1, 1, 1}, {2, 1, 2, 1}, {1, 2, 2, 
    2}, {1, 1, 1, 1}, {2, 2, 2, 2}, {1, 1, 1, 1}, {1, 2, 2, 1}, {1, 1,
     1, 1}, {2, 2, 2, 2}, {2, 2, 2, 2}, {1, 1, 1, 1}, {1, 1, 1, 
    1}, {2, 2, 1, 2}, {1, 1, 1, 1}, {2, 2, 2, 2}, {2, 1, 2, 1}, {2, 2,
     1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, {2, 2, 2, 2}, {1, 1, 1, 
    1}, {2, 2, 2, 2}, {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1,
     2, 1}, {1, 1, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 
    2}, {2, 2, 1, 2}, {2, 2, 2, 2}, {1, 1, 2, 2}, {2, 2, 1, 2}, {1, 2,
     1, 2}, {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 2, 2}, {2, 2, 1, 
    1}, {2, 2, 2, 1}, {2, 2, 2, 2}, {2, 2, 1, 2}, {2, 2, 2, 2}, {1, 1,
     2, 1}, {2, 2, 1, 1}, {1, 2, 1, 1}, {2, 2, 2, 2}, {1, 2, 1, 
    1}, {1, 1, 1, 1}, {1, 1, 1, 1}, {2, 2, 2, 2}, {1, 1, 1, 1}, {2, 2,
     2, 2}, {1, 1, 1, 1}, {1, 1, 2, 1}, {1, 2, 1, 2}, {1, 1, 1, 
    1}, {1, 1, 1, 2}, {2, 1, 2, 1}, {1, 1, 1, 1}, {1, 2, 1, 2}, {2, 2,
     2, 2}, {2, 2, 2, 2}, {1, 2, 2, 2}, {1, 1, 1, 1}, {1, 1, 2, 
    1}, {1, 1, 1, 1}, {2, 2, 2, 2}, {2, 1, 2, 2}, {1, 1, 2, 1}, {1, 2,
     1, 2}, {2, 2, 2, 2}, {1, 1, 2, 1}, {1, 2, 2, 1}, {1, 1, 1, 
    1}, {2, 1, 1, 1}, {1, 1, 2, 1}, {2, 1, 1, 1}, {1, 1, 2, 2}, {1, 1,
     2, 2}, {1, 1, 2, 2}, {2, 2, 2, 2}, {1, 2, 2, 2}, {2, 2, 2, 
    1}, {1, 1, 1, 1}};
jl2[x_List] := x[[1]].x[[2]]/((x[[1]].x[[1]]) (x[[2]].x[[2]]))^(1/2);
ModDistance[a_, b_] := jl2[{#1, #2}] &amp;amp;[a, b] 
FindClusters[data, DistanceFunction -&amp;gt; ModDistance]&lt;/pre&gt;



&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
<category>列表操作</category>
<guid isPermaLink="true">https://mmaqa.com/qa/134/</guid>
<pubDate>Sat, 16 Apr 2016 00:59:47 +0000</pubDate>
</item>
</channel>
</rss>