0
$\begingroup$

I need to ensure that the order is important and that $a_1a_2a_2$ is different from $a_2a_1a_2$ or as a matter of fact, any other possibility. In other words, $a_m$s are considered non-commutative. So how do I write this up in Mathematica, as I already figured out that IntegerPartitions is not something I'm looking for? The deal is with Ordered Partitions. $$\sum_{i_1+i_2+...+i_m=n}a_{i_1}a_{i_2}...a_{i_m}\Big\}$$ Thankful for your efforts.

Update

For more context, this question is part of another one:

Double summation involving partition of a number n as a condition

$\endgroup$
1

1 Answer 1

2
$\begingroup$

Something like this?

n = 4
times[x_] := x;
times[args__] := NonCommutativeMultiply[args];
Total[
 times @@@ Map[Subscript[a, #] &,
   Flatten[Permutations /@ IntegerPartitions[n], 1],
   {2}
  ]
]

enter image description here

$\endgroup$
4
  • $\begingroup$ Well that's what I require, but I would like you to address the question in the website: mathematica.stackexchange.com/questions/230746/… Thank you for your reply :) $\endgroup$
    – user74846
    Commented Sep 26, 2020 at 8:46
  • $\begingroup$ @user74846 If this question is related to the other one, you should include a link to it in the question. $\endgroup$ Commented Sep 26, 2020 at 8:56
  • $\begingroup$ @user74846, this is quite different from the other question, so asking a separate question is fine. Otherwise, you should not have neglected to put in all requirements in your other question to begin with. $\endgroup$ Commented Sep 26, 2020 at 10:01
  • $\begingroup$ Thank you for your efforts. Yes @J.M. I think I should have elaborated the question well enough. I will ensure this next time. But to be clear, at the start I was looking for ordered partition only, though I admit I didn't frame up well. $\endgroup$
    – user74846
    Commented Sep 26, 2020 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.