Post Reply 
HP 48GX - Store Coordinates in a List
03-28-2021, 09:08 PM (This post was last modified: 03-28-2021 09:08 PM by Han.)
Post: #3
RE: HP 48GX - Store Coordinates in a List
Leave your data list as-is. Instead, create a new object (string?) whose characters represent the point-number within the list. Let's say we use a 2-character string of indices (there are 256 characters, so that gives us a space of \( 256^2 = 65536 \) points. The "first" point is point 100, which in base 256 is simply the 100th character. So that would be a character 0 followed by character 100 (or the letter "d"). Then the next two characters would be character 1 followed by character 244 since \( 500 = 1\cdot 256^1 + 244 \cdot 256^0 \).

Thus when you want to know which point the \(n\)-th element in your data list is, you simply get the \( 2n \)-th and \( (2n+1) \)-th characters and convert from base 256 back to base 10. Moreover, if you want to search for the \( k \)-th point, you simply traverse your string two characters at a time and compute the decimal representation of those two characters and check to see if it matches the value \( k \). This would be much faster because actual lists are composite objects. Thus, when "skipping" objects in side a list, the cost is very high (as opposed to simply traversing a string 2 characters at a time and doing a quick computation each time).

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP 48GX - Store Coordinates in a List - Han - 03-28-2021 09:08 PM



User(s) browsing this thread: 1 Guest(s)