The term "nVectors" in "Rosetta Code: Vector dot product" is undefined
See original GitHub issueDescribe your problem and how to reproduce it:
One of the test cases on the sidebar says dotProduct(...nVectors) should return 156000
. nVectors is undefined
Additionally, I notice that there are some tests where the text value doesn’t match the actual test string.
Add a Link to the page with the problem: https://www.freecodecamp.org/learn/coding-interview-prep/rosetta-code/vector-dot-product
Tell us about your browser and operating system:
- Browser Name: Firefox
- Browser Version: 82
- Operating System: Linux Mint
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Dot product - Rosetta Code
Task Create a function/use an in-built function, to compute the dot product, also known as the scalar product of two vectors.
Read more >Vector products - Rosetta Code
A vector is defined as having three dimensions as being represented by an ordered collection of three numbers: (X, Y, Z).
Read more >Undefined values - Rosetta Code
A scalar variable (numeric or string) cannot have an 'undefined' value; if an attempt is made to read a variable which has never...
Read more >Variables - Rosetta Code
Variable declaration. Variables local to a function ( i and j in the example below) can be declared just before the body of...
Read more >Vector - Rosetta Code
Task Implement a Vector class (or a set of functions) that models a Physical Vector. The four basic operations and a pretty print...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Seems like an easy fix. So to be clear, we should do these to the tests:
I have a branch that addresses these issues, but there is a further issue with the solution as the dot product is only defined for pairs of vectors, and any test with an odd number of vectors should either fail (since dot products should return scalars) or return a vector (the scalar product of the first vectors times the last one probably; but a dot product function really should return a scalar).
The original vector product challenge at Rosetta Code actually calls for the computation of all four vector products. There is already a ‘Dot Product’ challenge separate from this one (it only uses two vectors for input) and a ‘Vector Cross Product’ which has similar problems to this issue.
So, which solution is best for the dot product in this issue (my vote is two vectors only, followed distantly by any number of pairs that I implemented)? Should I go ahead and fix ‘Vector Cross Product’ and add ‘Vector Triple Product’ and ‘Scalar Triple Product’ to complete the set in one PR or split them into separate issues/PRs or just ignore the other two completely since they can be computed with the dot and cross products?