Re: dummy index list

*To*: mathgroup at smc.vnet.net*Subject*: [mg20275] Re: [mg20256] dummy index list*From*: "Andrzej Kozlowski" <andrzej at tuins.ac.jp>*Date*: Mon, 11 Oct 1999 02:19:51 -0400*Sender*: owner-wri-mathgroup at wolfram.com

I shall only attempt to answer question 1. First, the code you sent is incorrect. I assume that you meant: In[1]:= testlist = {a, -b, c, -d}; In[2]:= Cases[Flatten[testlist, Infinity, Times], _Symbol] Out[2]= {a, b, c, d} You can get the same result somewhat quicker with: In[3]:= DeleteCases[testlist, -1, Infinity] Out[3]= {a, b, c, d} This code works because of the OneIdentity attribute of Times, which means that Times[a] is just a. Moreover, this code has a certain advantage over yours (probably irrelevant for your needs) in that it will also work in cases like In[9]:= testlist = {a^2, -b^2, c, -d}; here your code gives In[10]:= Cases[Flatten[testlist, Infinity, Times], _Symbol] Out[10]= {c, d} while In[11]:= DeleteCases[testlist, -1, Infinity] Out[11]= 2 2 {a , b , c, d} Andrzej -- Andrzej Kozlowski Toyama International University JAPAN http://sigma.tuins.ac.jp http://eri2.tuins.ac.jp ---------- >From: "Arturas Acus" <acus at itpa.lt> To: mathgroup at smc.vnet.net >To: mathgroup at smc.vnet.net >Subject: [mg20275] [mg20256] dummy index list >Date: Sun, 10 Oct 1999 00:04:08 -0400 > > Dear Group, > > I have 2 questions: > 1) I want the fastest way to select dummy symbols > from some expression. Suppose we have a list of > dummy indices {a,-b,c, -d}. What is the fastest way to > get rid of the minus sign? > > Here is my solution: > testlist={a,-b,c, -d}; > Map[Cases[Flatten[#,Infinity,Times],_Symbol]&,testlist] > > However I am not satisfied and believe there should > be a simple solution for such a simple task. I will use > this function very often in future, so it should be > as fast as possible. > > 2) I am not a professional programmer, so I am > very interesting in algorithm speed estimates > (there was a lot of such estimates published > recently in this group). > Do some tutorials on the web exist on this subject? > At the moment I am interesting in Mathematica SameQ > algorithm asymptotic (theoretic). > Is it n or log(n) or some other? > How one can know or guess this? Probably > there are some tables for various basic operations, > for example, like > 1.the best selection algorithm can be done at speed ?? > 2. the list intersection algorithm is ?? > 3 the union can be done at ?? > > and so on. Thanks. > > > > > Dr. Arturas Acus > Institute of Theoretical > Physics and Astronomy > Gostauto 12, 2600,Vilnius > Lithuania > > > E-mail: acus at itpa.lt > Fax: 370-2-225361 > Tel: 370-2-612906 >

**Re: vector pattern?**

**Tough Integral**

**dummy index list**

**Finding roots of complex eqs.**