This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

Two polynomials f(x) and g(x) are represented as lists in L1 and L2, such that the coefficient of xk in f(x) is L1(k+1), and the coefficient of xk in g(x) is L2(k+1), with no trailing zeros at the end of L1 or L2.

Challenge: Write the shortest program that returns f(x)g(x) as a list, to Ans. The list should not have any trailing zeros. Preserving the original lists L1 and L2 is not required.

I used functions to overcome the fact that you can't use a seq( command inside a seq( command. Also, I looped based on the power in the multiplied product, rather than the power of the terms in the multiplicands.

In total, 66 bytes. It's a good size, but it isn't very fast - if one were to use a calculator to find coefficients of generating functions, you'd probably need a faster routine.

Thanks for that catch, Baruch and DarkerLine. I did intend to store to dim(L1.

Last edited by Guest on 30 Dec 2008 06:11:44 pm; edited 1 time in total

You're thinking of sum(. cumSum( of a list returns the cumulative sums, as a list: the first element is the same, the second element is the sum of the first two, the third is the sum of the first three, and so on. cumSum(L1 or 1 gives a list like {1,2,3,4,5,...}.

As for the first line, I suspect he meant to store to dim(L1 instead.

Last edited by Guest on 12 Jul 2010 01:30:23 am; edited 1 time in total

Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.