Description
There is a spherical space generator capable of producing a hard sphere in n-dimensional space. Now that you are trapped in this n-dimensional sphere, you only know the coordinates of the n+1 points on the sphere, and you need to determine the spherical coordinates of the n-dimensional sphere as quickly as you can to destroy the sphere space generator.
Analysis
- The distance from each point to the center of the circle is equal
- The distance between points in n-dimensional coordinates is
dist = sqrt((a1-b1)^2 + (a2-b2)^2 + … + (an-bn)^2)
- The equations are listed, with a total of n+1, but the power of X is not 1, so two-phase subtraction gives the equation of the power of N x to 1.
- Process
(X1-P11) ^2 + (X2-P12) ^2 + ... + (xn-p1n) ^2 = r^2
X1^2-2*X1*P11 + p11^2 + x2^2-2*x2*p12 + p12^2 + ...-r^2 = 0
(X1^2-2*X1*P11) + ... + (xn^2-2*xn*p1n)-r^2 =-(p11^2 + p12^2 + ... + p1n^2) ... 1
(X1^2-2*X2*P21) + ... + (xn^2-2*xn*p2n)-r^2 =-(p21^2 + p22^2 + ... + p2n^2) ... 2
(X1^2-2*X3*P31) + ... + (xn^2-2*xn*p3n)-r^2 =-(p31^2 + p32^2 + ... + p3n^2) ... 3
(x1^2-2*x4*p41) + ... + (xn^2-2*xn*p4n)-r^2 =-(p41^2 + p42^2 + ... + p4n^2) ... 4
(X1^2-2*X5*P51) + ... + (xn^2-2*xn*p5n)-r^2 =-(p51^2 + p52^2 + ... + p5n^2) ... 5
...
(xn^2-2*xn*p{n+1}1) + ...-r^2 =-(p{n+1}1^2 + p{n+1}2^2 + ... + p{n+1}n^2). N+1
2-1: (2*X1*P11-2*X1*P21) + ... + (2*xn*p1n-2*xn*p2n) = (p11^2+...+p1n^2)-(p21^2+...+p2n^2). 1
3-2: (2*x1*p21-2*x1*p31) + ... + (2*xn*p2n-2*xn*p3n) = (p21^2+...+p2n^2)-(p31^2+...+p3n^2). 2
..... N
=
2 (P11-P21) * x1 + ... + 2 (p1n-p2n) * xn = (p11^2+...+p1n^2)-(p21^2+...+p2n^2): 1
2 (P21-P31) * x1 + ... + 2 (p2n-p3n) * xn = (p21^2+...+p2n^2)-(p31^2+...+p3n^2): 2
...
... n
Code
https://code.csdn.net/snippets/619114
bzoj-1013-Spherical Space Generator sphere