[BASIC] List routine for eliminating values

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

Moose
New Member
Posts: 29
Joined: Sun 02 Sep, 2007 6:48 am
Location: Shhhhh, they'll hear me!

Post by Moose »

The problem is I already use those methods in testing whether each value is a root.

My real goal is to eliminate any values that happen to be repeated into one each. Using those I'd end up using a for loop to change the value I was looking for.
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

I don't really understand the problem there..
But your program adds those things to a this list, right? That is the moment at which you should check whether it is already in there (with max)
User avatar
JoostinOnline
Regular Member
Posts: 133
Joined: Wed 11 Jul, 2007 10:42 pm
Location: Behind You

Post by JoostinOnline »

driesguldolf wrote:Nah, I was thinking of another function.
Btw, have you tested it with a list filled with zeros or random numbers?
driesguldolf wrote:Nevermind, I mistook it with the string functions.
Well you are just full of excuses, aren't you :lol:
"Macs are the Perfect Computers", said the Perfect Idiot.
Image
Testing for:
Vera
User avatar
driesguldolf
Extreme Poster
Posts: 395
Joined: Thu 17 May, 2007 4:49 pm
Location: $4080
Contact:

Post by driesguldolf »

There is always an excuse :P

Ok, I admit, I was doing things the wrong way. I asked first before I tested :mrgreen:

Neither do I trust TI. :D
Moose
New Member
Posts: 29
Joined: Sun 02 Sep, 2007 6:48 am
Location: Shhhhh, they'll hear me!

Post by Moose »

Wait a minute.... I can use that delta list thingy :roll:

I could do this when list1 is my list:

SortA(L1
not(augment({1},[DELTA]List(L1 -> L2
SortA(L2,L1
dim(L1)-sum(L2S -> dim(L1

I'm still in the brainstorming stage, but it seems like that would work :)
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

doesn't the second sort have to be descending? (could be that I didn't understand it properly..)
augmenting a {0} to the list after not-ing it would help to make it a few microseconds faster I think
Moose
New Member
Posts: 29
Joined: Sun 02 Sep, 2007 6:48 am
Location: Shhhhh, they'll hear me!

Post by Moose »

King Harold wrote:doesn't the second sort have to be descending? (could be that I didn't understand it properly..)
augmenting a {0} to the list after not-ing it would help to make it a few microseconds faster I think
It works pretty good, the not-ing makes ever list value without a change from the last register as one - the boolean opposite of any change from value to value, meaning any list value that doesn't change from the last registers a change of zero, not(0)=1, everything else is not-ed to zero, so if organised in an ascending order, every list value without a change is stored as a one, which is sent to the end of the list. So once I change the dimension of the list, all those ones get cut off, and the corresponding values from list one get cut off too.

I'll try augmenting a zero after all that, thanks for the tip.
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

Registers..?
Moose
New Member
Posts: 29
Joined: Sun 02 Sep, 2007 6:48 am
Location: Shhhhh, they'll hear me!

Post by Moose »

King Harold wrote:Registers..?
Lol sorry

(not to self: don't use the word "registers" when around assembly programmers)

I can't think of another word for it though. It shows a change of zero I guess, I meant it in a more figurative way.
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

Well I don't get you, I thought your algorithm works like this:
Sort to place duplicate values next to each other
Make a delta-list (will have 0 at the index of any duplicate except the last one)
Not( the d-list..
append 0 to front to match size
use the list to key-sort the old list and chop the duplicates off

sort {2,3,1,2
dlist {1,2,2,3
not {1,0,1
augmnt0 {0,1,0
keysort {0,0,1,0
chop {1,2,3,2
{1,2,3

like so.
Moose
New Member
Posts: 29
Joined: Sun 02 Sep, 2007 6:48 am
Location: Shhhhh, they'll hear me!

Post by Moose »

Oh I see what you mean. I actually only stick that zero there since the p/q technique doesn't work for any roots that are 0 (y=x^2 would only yield a bunch of 1's in the possible root value list).

Other than that your exactly right.

I don't know why, but I don't need to line up the lists with an extra value in the delta list, maybe it's just a result of the strange ways I use basic.
Post Reply