home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   sci.math.symbolic      Symbolic algebra discussion      10,432 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 8,807 of 10,432   
   Nasser M. Abbasi to Christopher Creutzig   
   Re: fyi, Mupad CAS result being added to   
   16 Jun 15 03:08:42   
   
   From: nma@12000.org   
      
   On 6/16/2015 2:03 AM, Christopher Creutzig wrote:   
   > On 6/14/15 4:54 PM, Nasser M. Abbasi wrote:   
   >   
   >> CPU time used is real time using mupad rtime(). Leafcount was   
   >> obtained by writing the result of each problem to file and then   
   >> using Maple's LeafCount to do the measurements on the output. This is   
   >> since mupad does not have leafCount function.  (It seems to me   
   >   
   > Counting leaves is probably just as arbitrary as any other measure one   
   > could cook up - nothing wrong with it for sure, but unless I'm missing   
   > something, it is not a clear win over other complexity measures like   
   > length or bytes, either.   
   >   
   > Anyway, here's a MuPAD implementation, which includes functions in its   
   > count (I don't know if that is what you want, it's a matter of taste   
   > whether to call them leaves):   
   >   
   > leaf := Type::Predicate(x -> bool(x = op(x))):   
   > leafCount := x -> nops([prog::find(x, leaf, Type)]):   
   >   
   > leafCount(sin(x^2+3))   
   >   
   >    6   
   >   
   >   
   > Looking forward to seeing your results,   
   >   
   > Christopher   
   >   
      
   Thanks for the function. You are right, different system measure this   
   little differently. For example on this input   
      
          x + 6*ln(x^(1/2)) + (4*x^(1/2) - 1)/x - 4*x^(1/2)   
      
   Maple gives leaf count of 22, while Mathematica gives 30   
   for same:   
      
   x + 6*Log[x^(1/2)] + (4*x^(1/2) - 1)/x - 4*x^(1/2)   
      
   Your function gave 27 for the above. Mathematica describes   
   how it does it here   
      
   https://reference.wolfram.com/language/ref/LeafCount.html   
      
   "LeafCount gives a measure of the total "size" of an expression.   
      
   LeafCount counts the number of subexpressions in expr that   
   correspond to "leaves" on the expression tree.   
      
   LeafCount is based on FullForm representation of expressions."   
      
   The 30 actually comes from FullForm and _not_ from TreeForm.   
      
   I found also that sage does not have such a function buildin.   
      
   --Nasser   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca