Is there a command for vector sum in User RPL?
|
05-22-2014, 09:29 AM
Post: #1
|
|||
|
|||
Is there a command for vector sum in User RPL?
The sigmaLIST command is handy. Is there a vector sum command when operating on vectors? If not, is there a best-practice for this?
It ain't OVER 'till it's 2 PICK |
|||
05-22-2014, 12:29 PM
Post: #2
|
|||
|
|||
RE: Is there a command for vector sum in User RPL? | |||
05-22-2014, 12:44 PM
Post: #3
|
|||
|
|||
RE: Is there a command for vector sum in User RPL?
Thanks. I am surprised this isn't included. It seems like it should be.
It ain't OVER 'till it's 2 PICK |
|||
05-22-2014, 01:08 PM
Post: #4
|
|||
|
|||
RE: Is there a command for vector sum in User RPL?
(05-22-2014 12:44 PM)HP67 Wrote: I am surprised this isn't included. It's easy to create a list with the elements of a vector: Code: \<< OBJ\-> OBJ\-> DROP \->LIST \GSLIST \>> Thus the building blocks are there. You can't blame the developers that they didn't include all combinations. Why is 3PICKSWAP missing in UserRPL but you can find it in SysRPL? Cheers Thomas |
|||
05-22-2014, 01:26 PM
Post: #5
|
|||
|
|||
RE: Is there a command for vector sum in User RPL?
(05-22-2014 01:08 PM)Thomas Klemm Wrote: Thus the building blocks are there. You can't blame the developers that they didn't include all combinations. Indeed, you can use Thomas' code, name it MYVECSUM, and 'POOF' it is now inlcuded. And as Thomas notes, as you start to explore SysRPL, you will find that they did include just about every combination stack manipulation sequence into a new command that you can imagine. Plus a whole bunch you can't imagine. There are some that are so obscure I have struggled to imagine there were enough similar stack juggling scenarios to justify introducing a new command. A simple stupid example: there is ROM word for the number 53. Could the number 53 really have been used enough times to justify creating that, just to save a few nibs when it's needed? Nevertheless, I still bow to those guys... "I'm not worthy" --Bob Prosperi |
|||
05-22-2014, 01:32 PM
(This post was last modified: 05-22-2014 01:40 PM by HP67.)
Post: #6
|
|||
|
|||
RE: Is there a command for vector sum in User RPL?
(05-22-2014 01:08 PM)Thomas Klemm Wrote: Thus the building blocks are there. That is not what I am saying. By your argument all they had to do was supply a basic set of commands from which all other commands could be coded by the user. But they went much further than that. Where do you draw the line? Let's hope this doesn't degenerate into a discussion of "turing completeness!" Given that many commands do operate on multiple objects it seems somewhat of a puzzling omission that there wasn't a sigma that operated on vectors. I would think sigma for lists is the more unusual built-in given lists can contain non-numeric data where the notion of sigma is not relevant, while vectors only contain numeric data. A vector sum is a fairly basic operation that is useful without having to think too hard. Converting to a list or doing a dot product seem to be pretty expensive alternatives. There is a basic difference in asking if there is a fundamental mathematical operation among the hundreds of operations on the calculator, which is what I asked, and asking why every possible combination of stack-dancing isn't hardcoded in User RPL which I didn't ask and already know the answer to. I don't see much of a connection. I would be more ready to understand it if somebody from HP said "yeah, we forgot about that!" It ain't OVER 'till it's 2 PICK |
|||
05-22-2014, 02:46 PM
Post: #7
|
|||
|
|||
RE: Is there a command for vector sum in User RPL?
[1 2 3 4 5 6 7 8 9] AXL ΣLIST yields 45.
|
|||
05-22-2014, 02:49 PM
Post: #8
|
|||
|
|||
RE: Is there a command for vector sum in User RPL? | |||
05-22-2014, 05:00 PM
Post: #9
|
|||
|
|||
RE: Is there a command for vector sum in User RPL?
[1 2 3 4 5 6 7 8 9] 1 PEVAL yields 45.
|
|||
05-27-2014, 04:30 PM
Post: #10
|
|||
|
|||
RE: Is there a command for vector sum in User RPL?
Thanks guys. Many interesting tricks there. I was wondering if there was support for this already. The answer is no. Then I was wondering if any techniques are better than others- use less storage, faster, etc. Then I looked in the doc and found a table that describes the storage used for each type of object. Unless somebody knows otherwise it seems lists are the way to go, even when you could use a vector. They take less space and have more command support.
It ain't OVER 'till it's 2 PICK |
|||
05-27-2014, 06:08 PM
Post: #11
|
|||
|
|||
RE: Is there a command for vector sum in User RPL?
(05-22-2014 01:32 PM)HP67 Wrote: A vector sum is a fairly basic operation that is useful without having to think too hard. What would that be? I can come up with normalization of weights to make sure that their sum is 1. But looking at vectors as mathematical objects I don't see a lot of applications. What's the geometrical meaning of the sum of the coordinates of a vector? Compared to the scalar product or the length. This value changes even with isometric coordinate transformations: compare [4, 3] to [5, 0] or [2, 2, 1] to [0, 3, 0]. Kind regards Thomas |
|||
05-28-2014, 02:14 AM
(This post was last modified: 05-28-2014 02:15 AM by Gerson W. Barbosa.)
Post: #12
|
|||
|
|||
RE: Is there a command for vector sum in User RPL? | |||
05-28-2014, 05:35 AM
Post: #13
|
|||
|
|||
RE: Is there a command for vector sum in User RPL?
(05-27-2014 06:08 PM)Thomas Klemm Wrote:(05-22-2014 01:32 PM)HP67 Wrote: A vector sum is a fairly basic operation that is useful without having to think too hard. That's because you're a mathematician and I'm a programmer I was looking at it as a programming object. And I did have a real problem I was working on. The first thing that comes to mind is to be able to calculate various forms of averages and standard deviations on discrete data without being forced into the built-in stats mode. I had just such a problem I was trying to solve when this issue came up. But really I look at this as a basic operation that should be part of a language. APL, LISP etc. have this capability. Mathematical functions can operate on vectors. There are thousands of functions built in to the 50g like f0gamma. So why not vector sum without having to go through an expensive conversion to list or creating a like-sized vector to do a dot product with? As I found, lists are more storage efficient and have more command support. So I don't see the need for vectors any more until I need to do something that's not supported for lists but is supported for vectors. It ain't OVER 'till it's 2 PICK |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)