Skip to main content
10 events
when toggle format what by license comment
Oct 29, 2022 at 4:31 answer added thorimur timeline score: 1
Oct 29, 2022 at 4:19 comment added user293787 Apologies, I misunderstood your comment. I have no useful answer in that case. Maybe use a different kind of definition altogether, such as NCExpand[expr_] := expr //. NonCommutativeMultiply[a___,b_+c_,d___] :> a**b**d+a**c**d. Maybe look at the NCAlgebra package for inspiration, for example the definition of ExpandNonCommutativeMultiply. Generally, I like multiple definitions, because it often gives readable code, but I understand that that is not your question.
Oct 29, 2022 at 1:37 history edited JvT CC BY-SA 4.0
added 285 characters in body
Oct 29, 2022 at 1:33 comment added JvT file:///home/jacovantonder/%E7%94%BB%E5%83%8F/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88/Screenshot%20from%202022-10-29%2011-32-13.png
Oct 29, 2022 at 1:32 comment added JvT How is it included?
Oct 27, 2022 at 5:57 comment added user293787 That case is included, if you use 3 underscores for a and d.
Oct 27, 2022 at 5:54 comment added JvT I guess what I mean is if I apply what you gave to my example for NCExpand[b+c] it will just return NCExpand[b+c]. I was wondering if you could somehow include this case in the definition of NCExpand[] without requiring a separate definition NCExpand[b_+c_]:=NCExpand[b]+NCExpand[c].
Oct 27, 2022 at 5:46 comment added JvT Could you explain how you would specifically implement it for the example I gave?
Oct 24, 2022 at 9:29 comment added user293787 Yes, see this. Example: f[a___,b_+c_,d___]:=f[a,b,d]+f[a,c,d]. For a tutorial, see this.
Oct 24, 2022 at 9:27 history asked JvT CC BY-SA 4.0