Re: Order of terms

• To: mathgroup at smc.vnet.net
• Subject: [mg77743] Re: Order of terms
• From: dh <dh at metrohm.ch>
• Date: Fri, 15 Jun 2007 06:21:14 -0400 (EDT)
• References: <f4r3ic\$980\$1@smc.vnet.net>

```
Hi Thomas,

Plus orders its agruments automatically. Therefore, you must either

replace Plus by e.g. List or redefine PLus what is pretty dangerous.

Here is a rule that replaces by List and orders according to sum of indices:

rule={Plus->List,_[x1:__,x2:Subscript[a,k1_]Subscript[b,k2_],x3:Subscript[a,k3_]Subscript[b,k4_],x4__]/;(k1+k2)>(k3+k4):>

{x1,x3,x2,x4}};

c//.rule

hope this helps, Daniel

> Given

>

>

> In:= c[p_] := Sum[Subscript[a, k]* Subscript[b, n - k], {n, 0, p}, {k, 0,

> n}]

>

>

>

> How can I get the output in the same order that the double sum is written?

> For example I would like to have the output from c be

>

>

>

> In:= Hold[Subscript[a, 0]Subscript[b, 0]+Subscript[a, 0]Subscript[b,

> 1]+Subscript[a, 1]Subscript[b, 0]+Subscript[a, 0]Subscript[b,

> 2]+Subscript[a, 1]Subscript[b, 1]+Subscript[a, 2]Subscript[b, 0]]

>

>

> rather than the default

>

>

> c

>

> Thanks in advance for any and all replies.

>

> Thomas

>

```

• Prev by Date: Re: ReplaceRepeated info
• Next by Date: Re: Help with formatting output
• Previous by thread: Order of terms
• Next by thread: Re: Order of terms
{"ft_lang_label":"__label__en","ft_lang_prob":0.5905356,"math_prob":0.49487346,"size":1180,"snap":"2020-24-2020-29","text_gpt3_token_len":429,"char_repetition_ratio":0.19982994,"word_repetition_ratio":0.0,"special_character_ratio":0.38050848,"punctuation_ratio":0.23426573,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9872787,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],"im_url_duplicate_count":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-06-02T21:56:48Z\",\"WARC-Record-ID\":\"<urn:uuid:cbb25fc7-b79a-4544-b0b4-7aa32abf2b63>\",\"Content-Length\":\"44533\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:410e94ea-c197-4508-bc1f-2559a5d9d6ca>\",\"WARC-Concurrent-To\":\"<urn:uuid:cf63c3f0-fd1d-414e-8d91-0370aa9867e1>\",\"WARC-IP-Address\":\"140.177.205.73\",\"WARC-Target-URI\":\"http://forums.wolfram.com/mathgroup/archive/2007/Jun/msg00718.html\",\"WARC-Payload-Digest\":\"sha1:5INF6FGLMD476KDJANVWZ5H4SKDQ37Y7\",\"WARC-Block-Digest\":\"sha1:VMI7SPT63VTM6LJUBN5W5BTFQLPJMMYS\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-24/CC-MAIN-2020-24_segments_1590347426801.75_warc_CC-MAIN-20200602193431-20200602223431-00422.warc.gz\"}"}