Don't use this tag. If you have questions about cartesian products (e.g. SQL, Spark, Datatables, heterogeneous tuples), use `cartesian-product` tag. If you have questions about planar geometry / 3D-graphics, use `cartesian-coordinates` tag.
Questions tagged [cartesian]
245 questions
7
votes
1 answer
Python: shortest way to compute cartesian power of list
Suppose we have a list L. The cartesian product L x L could be computed like this:
product = [(a,b) for a in L for b in L]
How can the cartesian power L x L x L x ... x L (n times, for a given n) be computed, in a short and efficient way?

chtenb
- 14,924
- 14
- 78
- 116
6
votes
2 answers
Julia - n-nested loops
Im trying to make a n-nested loop method in Julia
function fun(n::Int64)
@nloops n i d->1:3 begin\n
@nexprs n j->(print(i_j))\n
end
end
But the @nloops definition is limited to
_nloops(::Int64, ::Symbol, ::Expr, ::Expr...)
and I…

isebarn
- 3,812
- 5
- 22
- 38
6
votes
3 answers
Shortest Path distance between points given as X-Y coordinates
I am currently working on a project that has a vector containing X and Y coordinates for approximately 800 points. These points represent an electric network of lines.
My goal is to compute the shortest distance Path between a Point A and Point B…

Christian Lopez
- 61
- 1
- 2
5
votes
2 answers
Compute distance in Cartesian Coordinate System in Mathematica
Analyzing Eye-movements on a screen, I set my origin to the bottom left corner of it
(Hard to modify at that point).
Trying to compute distance between some points and the center of the screen I use the simple formula displayed below.
Problem is…

500
- 6,509
- 8
- 46
- 80
5
votes
1 answer
How to create new columns based on cartesian product of multiple columns from pyspark dataframes
Let me take a simple example to explain what I am trying to do. let us say we have two very simple dataframes as below:
Df1
+---+---+---+
| a1| a2| a3|
+---+---+---+
| 2| 3| 7|
| 1| 9| 6|
+---+---+---+
Df2
+---+---+
| b1| b2|
+---+---+
| 10| …

spectrum
- 61
- 5
5
votes
4 answers
Algorithm for RC car
I'm looking for an algorithm, and I have no idea where to start!
I'm trying to get from point A to point B in a cartesian graph. Movement is restricted to that of a RC car: backward, forward, forward-left, and forward-right (constant turning…

loneboat
- 2,845
- 5
- 28
- 40
5
votes
2 answers
Create cartesian product (powerset?) of JavaScript objects by looping through unknown number of arrays
I'm a beginner, so please pardon my ignorance if this is trivial.
I have a javascript object of unknown length, and each property's value is an array (also of unknown length to me). For example:
var obj = {"varA":[1,2,3],
…

user4438610
- 75
- 6
5
votes
1 answer
Pathfinding with teleporters
I'm working on a project with a virtual robot (Turtles in the ComputerCraft mod for Minecraft), where the robot would be in a maze of tunnels and have to navigate around in them. The world is conveniently already divided into tiles (a 2D Cartesian…

Schilcote
- 2,344
- 1
- 17
- 35
5
votes
2 answers
Algorithm [preferably fortran] to interpolate data from a 2D unstructured grid to form a cartesian grid
I am modeling fracture propagation using a 2D dynamic unstructured grid. As the fracture propagate over time, the elements move accordingly. For a given time step, I would like to interpolate the data of my unstructured grid zi=f(xi,yi) (where…

RoLio
- 63
- 1
- 5
5
votes
3 answers
Cartesian to Polar (3d coordinates)
How do you convert between Cartesian and Polar (and back) coordinate systems in 3D space? Preferably with a c# example but anything would really be appreciated. Thanks!
Edit
When 20% of the change is taken into account (not forming a sphere)
Edit 2…

Darestium
- 643
- 2
- 11
- 29
4
votes
1 answer
How to reduce memory consumption when performing a cartesian product?
Given a 2d matrix such as [[a,b,c],[d,e,f]...]], I want to perform a Cartesian product of the matrix so I can determine all the possible combinations.
For this particular constraint, when I am using a 2d matrix with 12 different subsets, it uses…

Krish
- 415
- 2
- 11
4
votes
1 answer
How to check if ax is polar projection in matplotlib?
Is there an attribute that from either fig or ax that can indicate if the projection for the ax is polar or not?
I'm trying to create a basic nested function in one of my more complicated functions that essentially has the following…

O.rka
- 29,847
- 68
- 194
- 309
4
votes
2 answers
Query does cartesian join unless
I've got a query that's supposed to return 2 rows. However, it returns 48 rows. It's acting like one of the tables that's being joined isn't there. But if I add a column from that table to the select clause, with no changes to the from or where…

Paul Tomblin
- 179,021
- 58
- 319
- 408
4
votes
2 answers
How to do a rotation in R^2?
i'm stuck with a seemingly simple problem in mathematics: i need to rotate points in a 2-dimensional cartesian coordinate system, i.e. i have a point given by (x/y) and an angle gamma and i need to get the coordinates of this point if rotated by…

xenonite
- 1,671
- 4
- 28
- 43
4
votes
2 answers
Neo4j: error in adding relationships among existing nodes
When writing a query to add relationships to existing nodes, it keeps me warning with this message:
"This query builds a cartesian product between disconnected patterns.
If a part of a query contains multiple disconnected patterns, this will build a…

sirdan
- 1,018
- 2
- 13
- 34