Greetings. As mentioned in earlier posts, I often find the answer given to a question regarding the use of the 'sum' command as: don't use 'sum', use 'add', and all will be fine. I agree, and I use the add command for adding numbers together. But, if all I am doing is adding numbers together, from a sequence and nothing else, why not use the 'sum' command. It seems to be orders of magnitude faster than the 'add' command if there are a large number of numbers(I have no metric for what large is as far as numbers go). As an example, I execute the code below and look at the results. > restart: > st:= time(): > add(k, k=1..10000000);time() - st; 50000005000000 1.271 > restart: > st:= time(): > convert([seq(k,k=1..10000000)],`+`);time() - st; 50000005000000 12.868 > restart: > st:= time(): > sum(k, k=1..10000000);time() - st; > 50000005000000 0. Why is there such a large discrepancy between 'add' and 'sum' commands when it comes to adding/summing a sequence of numbers with respect to the amount of time it takes to calculate? Regards, Georgios Kokovidis

Please Wait...