I have a function which contains multiplications of symbolic constants,a[i,j], that are small, for example:

f = a[1, 1]*a[2, 3]*aa[1, 1]+a[1, 2]*a[2, 3]+a[1, 3]*aa[1, 5]*a[1, 4]*a[1, 3]

How can I eliminate the terms that contain the multiplication of 3 terms a[i, j] or more terms, since the value of the set tends to 0?.

I try use the function DeleteCase, but I have not had a result.



I think this has appeared before but cannot find the right link. Anyway, one approach is to make a series in a new variable after multiplying each original variable by that new one. Then set that new variable to unity.

removeToOrder[poly_, n_] := Module[{t, vars, tpoly},
  vars = Variables[poly];
  tpoly = poly /. Thread[vars -> t*vars];
  Normal[Series[tpoly, {t, 0, n - 1}]] /. t -> 1]

The example:

f = a[1, 1]*a[2, 3]*aa[1, 1] + a[1, 2]*a[2, 3] + 
   a[1, 3]*aa[1, 5]*a[1, 4]*a[1, 3];

removeToOrder[f, 3]

(* Out[124]= a[1, 2] a[2, 3] *)
  • $\begingroup$ I didn't know how to contact you. There used to be an interesting notebook located here library.wolfram.com/infocenter/Conferences/321 from a presentation you did. Would it be possible to upload it again ? Or has it been deleted for any reason ? Thank you $\endgroup$ – faysou Nov 25 '17 at 21:43
  • $\begingroup$ @faysou I have no idea what happened to the library.w.c html or notebook version of "Data Structures and Efficient Algorithms in Mathematica" but I'll ask around. Thanks for pointing this out. $\endgroup$ – Daniel Lichtblau Nov 26 '17 at 16:28
  • $\begingroup$ @faysou It's back again, under Downloads. $\endgroup$ – Daniel Lichtblau Nov 28 '17 at 22:56
  • $\begingroup$ Ok thank you Daniel. $\endgroup$ – faysou Nov 30 '17 at 7:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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