Closed rpruim closed 10 years ago
Can you please remind me what it did?
Computes the length of a vector in the mathematical sense rather than in the Computer Science sense:
> x <- rep(1,4)
> length(x)
[1] 4
> vlength(x)
[1] 2
> sqrt(sum(x^2))
[1] 2
Would “vnorm()” be a better name?
I don’t have strong feelings, but I could imagine that “vlength()” might be mis-interpreted.
Just my $0.02,
Nick
On Mar 24, 2014, at 9:40 AM, Randall Pruim notifications@github.com wrote:
Computes the length of a vector in the mathematical sense rather than in the Computer Science sense:
x <- rep(1,4) length(x) [1] 4 vlength(x) [1] 2 sqrt(sum(x^2)) [1] 2
— Reply to this email directly or view it on GitHub.
vlength()
is used in the FASt book. But it would be easy enough to put vlength()
back into the fastR package if we don't want it in the mosaic package. My students tend to think in terms of lengths of vectors, so vlength()
works quite well. But we could add an alias called vnorm()
and do both if we like.
Sounds good (and I don’t have strong feelings on this one).
Nick
On Mar 24, 2014, at 9:45 AM, Randall Pruim notifications@github.com wrote:
vlength() is used in the FASt book. But it would be easy enough to put vlength() back into the fastR package if we don't want it in the mosaic package. My students tend to think in terms of lengths of vectors, so vlength() works quite well. But we could add an alias called vnorm() and do both if we like.
— Reply to this email directly or view it on GitHub.
From wikipedia (for lack of a better reference to copy and paste from ;-):
For the length of a vector in Euclidean space (which is an example of a norm, as explained below), the notation |v| with single vertical lines is also widespread.
I think this is a pretty common way of thinking -- the length of a vector in Euclidean space is an example of a more general notion (norm) in a general vector space. So to me, the only question is whether to add vnorm()
as another name for the same thing for folks who prefer that terminology. Your thought on that one?
I believe that the equivalent function in matlab is “norm”.
But I defer to the judgment of the mathematician and wikipedia!
Nick
On Mar 24, 2014, at 9:50 AM, Randall Pruim notifications@github.com wrote:
From wikipedia (for lack of a better reference to copy and paste from ;-):
For the length of a vector in Euclidean space (which is an example of a norm, as explained below), the notation |v| with single vertical lines is also widespread.
I think this is a pretty common way of thinking -- the length of a vector in Euclidean space is an example of a more general notion (norm) in a general vector space. So to me, the only question is whether to add vnorm() as another name for the same thing for folks who prefer that terminology. Your thought on that one?
— Reply to this email directly or view it on GitHub.
norm()
, and even vnorm()
could conjure of memories of rnorm()
, pnorm()
, qnorm()
, dnorm()
. Perhaps that is an argument against using norm here?
I agree with this logic. That's the first thing that came to my mind.
On Mon, Mar 24, 2014 at 10:07 AM, Randall Pruim notifications@github.comwrote:
norm(), and even vnorm() could conjure of memories of rnorm(), pnorm(), qnorm(), dnorm(). Perhaps that is an argument against using norm here?
Reply to this email directly or view it on GitHubhttps://github.com/rpruim/mosaic/issues/299#issuecomment-38448089 .
This used to be in
fastR
but has disappeared, probably because it was intended to move to the mosaic package and somehow didn't make it.