I was using the following code to check if a list is 0:

1 -> M
Repeat not( sum( fPart( listOP1 * M )))
M+1 -> M
End

Yet this obviously breaks if the sum of the list is 0, but the terms individually might not be. Is there a simple way, short of looping every list item, to see if the list values are all 0?
Yes.
Code:
If not(sum(abs(L1
Disp "ALL ELEMENTS ARE 0

Code:
If prod(not(L1
PT_ wrote:

Code:
If prod(not(L1
Very clever, that works as well. Smile
Ah, forgot about abs(). This is a fix for my polynomials program. Didn't realize rational zeroes test doesnt work on non-integer coefficients, so just converting all coefficients to integers. Smile

Edit: So prod( not( fPart( List ))) ?
The correct idiom is

Code:
min(not(fPart([list]


It's faster.

I presume you're using some form of Euclidean Algorithm to find the gcd and convert coefficients to integers?
  
Register to Join the Conversation
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.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement