What part can be taken by the diagonal line of the trigger

Source: Internet
Author: User

From http: // 218.1.231.240/iqbbs/dispbbs. asp? Boardid = 16 & id = 152836

Finally, it is calculated as 21480 regions.







 

 

First, calculate the number of intersections: the calculation result is 16801 intersections.

Assume z = exp (PI/15 * I) = cos (PI/15) + I * sin (PI/15)

Then Z ^ 15 =-1, Z ^ 30 = 1. Point 1, Z, Z ^ 2,..., Z ^ 29 form a positive 30 edge on the complex plane.

The smallest polynomial of Z is 1 + Z-Z ^ 3-z ^ 4-z ^ 5 + Z ^ 7 + Z ^ 8.

That is, the above expression is about Z is 0, and the rational Coefficient Polynomials with any number of times below 8 cannot be 0 at Z. (Excluding 0 polynomials)

All vertices of this polygon are vertices in Q [Z] (that is, the possible values of all rational coefficients polynomials after Z is substituted ).

It will also be in Q [Z. Now my algorithm is to represent the intersection of each diagonal with a rational polynomial about the number of Z less than 8. This representation method must be unique. If the two intersections have the same polynomial, they are the same point. Otherwise, they are different.

The first program calculates all intersections and outputs. The output format is that each row is


A, B, C, D, E, F, G, H [I, j, S, T]


The first eight numbers indicate that the intersection is
A + bz + cz ^ 2 + DZ ^ 3 + EZ ^ 4 + FZ ^ 5 + Gz ^ 6 + Hz ^ 7


The four numbers below indicate that the point is the intersection of the Z ^ I Z ^ J and the Z ^ s Z ^ t of the straight line.


# Include <stdio. h>
# Include <process. h>
_ Int64 factor (_ int64 A ,__ int64 B ){
If (B = 0) return;
Else Return Factor (B, A % B );
}


Class q {
_ Int64 _ up;
_ Int64 _ down;
Void normalize (){
_ Int64 FAC = factor (_ up, _ down );
_ Down/= FAC;
_ Up/= FAC;
If (_ down <0 ){
_ Down =-_ down;
_ Up =-_ up;
}
}
Public:
Q (): _ up (0), _ down (1 ){}
Q (_ int64 up ,__ int64 down): _ up (up), _ down (down ){}
Q (_ int64 X): _ up (x), _ down (1 ){}
Q & operator ++ = (const Q & X );
Q & operator-= (const Q & X );
Q & operator * = (const Q & X );
Q & operator/= (const Q & X );
Q operator-() const {q TMP = * This; TMP. _ up =-_ up; return TMP ;}
Q operator + (const Q & X) const {q TMP = * This; TMP + = x; return TMP ;}
Q operator-(const Q & X) const {q TMP = * This; TMP-= x; return TMP ;}
Q operator * (const Q & X) const {q TMP = * This; TMP * = x; return TMP ;}
Q operator/(const Q & X) const {q TMP = * This; tmp/= x; return TMP ;}
Bool iszero () const {return _ up = 0 ;}
Bool operator = (const Q & X) const {return _ up = x. _ up & _ down = x. _ down ;}
Void output () const {If (_ down = 1) printf ("% 4i64d", _ up); else printf ("% 2i64d/% i64d", _ up, _ down );}
};


Q & Q: Operator + = (const Q & X ){
_ Up = _ up * X. _ down + _ down * X. _ up;
_ Down * = x. _ down;
Normalize ();
Return * this;
}


Q & Q: Operator-= (const Q & X ){
_ Up = _ up * X. _ Down-_ down * X. _ up;
_ Down * = x. _ down;
Normalize ();
Return * this;
}


Q & Q: Operator * = (const Q & X ){
_ Up * = x. _ up;
_ Down * = x. _ down;
Normalize ();
Return * this;
}


Q & Q: Operator/= (const Q & X ){
_ Up * = x. _ down;
_ Down * = x. _ up;
Normalize ();
Return * this;
}


Q mod [9] = {q (1), Q (1), Q (0), Q (-1), Q (-1), Q (-1 ), q (0), Q (1), Q (1 )};


Void Mod (q a [15]) {
Int I, J;
For (I = 14; I> = 8; I --){
Q divider = A [I];
For (j = 0; j <= 8; j ++ ){
A [I-j]-= divider * mod [8-j];
}
}
}


Void dump (const q m [15] [15], const Q B [15]) {
Int I, J;
Printf ("// N // n ");
For (I = 0; I <15; I ++ ){
For (j = 0; j <14; j ++ ){
M [J] [I]. Output ();
Printf (",");
}
M [J] [I]. Output ();
Printf ("= ");
B [I]. Output ();
Printf ("// n ");
}
}


Void solveequation (q m [8] [8], Q B [15]) {
Int I, J, K;
For (I = 0; I <8; I ++ ){
// Dump (M, B );
For (j = I; j <8; j ++)
If (! M [I] [J]. iszero () break;
If (J! = I ){
If (j> = 8 ){
Printf ("There/'s no inverse for the matrix // n ");
Exit (-1 );
}
For (k = 0; k <8; k ++ ){
Q tmp = m [k] [I];
M [k] [I] = m [k] [J];
M [k] [J] = TMP;
}
Q tmp = B [I];
B [I] = B [J];
B [J] = TMP;
}
Q divider = m [I] [I];
For (j = I; j <8; j ++) m [J] [I]/= divider;
B [I]/= Divider;
For (j = 0; j <8; j ++ ){
If (j = I) continue;
Q mult = m [I] [J];
For (k = I; k <8; k ++) m [k] [J]-= mult * m [k] [I];
B [J]-= mult * B [I];
}
}
}

Void inverse (const q a [15], Q B [15]) {
Q m [8] [8];
Q tmp [15];
Int I, J;
For (I = 0; I <8; I ++ ){
For (j = 0; j <15; J ++) TMP [J] = Q (0 );
For (j = 0; j <8; j ++) TMP [I + J] = A [J];
MoD (TMP );
For (j = 0; j <8; j ++ ){
M [I] [J] = TMP [J];
}
}
B [0] = Q (1 );
For (I = 1; I <15; I ++) B [I] = Q (0 );
Solveequation (M, B );
}


Void multiple (const q a [15], const Q B [15], q c [15]) {
Int I, J;
For (I = 0; I <15; I ++) c= Q (0 );
For (I = 0; I <15; I ++) for (j = 0; j <15; J ++ ){
If (I + j <15 ){
C [I + J] + = A [I] * B [J];
} Else {
C [I + j-15]-= A [I] * B [J];
}
}
MoD (C );
}


Void output (const q r [15], int I, Int J, int S, int K ){
Int U;
For (u = 0; U <7; U ++ ){
R [u]. Output ();
Printf (",");
}
R [u]. Output ();
Printf ("[% d, % d] // n", I, j, S, k );
}


# Define Inc (z, x) do {//
Int TMP = (x) % 30; If (TMP <0) TMP + = 30 ;//
If (TMP <15) (z) [TMP] + = Q (1 );//
Else (z) [tmp-15]-= Q (1 );//
} While (0)


# Define Dec (z, x) do {//
Int TMP = (x) % 30; If (TMP <0) TMP + = 30 ;//
If (TMP <15) (z) [TMP]-= Q (1 );//
Else (z) [tmp-15] + = Q (1 );//
} While (0)


Void find (int I, Int J, int S, int t ){
Int K;
// Printf ("% d // n", I, j, S, T );
Q Delta [15], invdelta [15], R [15];
For (k = 0; k <15; k ++ ){
Delta [k] = 0;
}
INC (delta, J-T); Dec (Delta, I-t); Dec (delta, J-S); Inc (delta, I-s );
Dec (delta, T-j); Inc (delta, t-I); Inc (delta, S-j); Dec (delta, s-I );
MoD (DELTA );
Inverse (delta, invdelta );
For (k = 0; k <15; k ++) Delta [k] = 0;
INC (Delta, I-J + S); Dec (delta, I-j + T); Dec (delta,-I + J + S); Inc (delta, -I + J + t );
INC (delta, J + S-t); Dec (Delta, I + S-t); Dec (delta, J-S + T); Inc (delta, i-S + t );
MoD (DELTA );
Multiple (invdelta, Delta, R );
Output (R, I, j, S, T );
}


Int main (){
Int I, j, S, T;
For (I = 0; I <30; I ++) for (S = I + 1; S <30; S ++) for (j = S + 1; j <30; j ++) for (t = J + 1; t <30; t ++ ){
Find (I, j, S, T );
}
}

The above program can show how many diagonal lines pass through the intersection points on each diagonal line. With this information, it is very easy to continue.

The above program can not directly calculate the number of intersections. You need to sort the output result line (you can use the sort command), and then process the redundant points through the computer to count the results.

Finally, it is calculated as 21480 regions.
The formula is sum {(d (I)-1), D (I) is the number of diagonal lines passing through the I point} + 1 + L, and L is the number of diagonal lines.
Here, c30.sort.txt is the result of sorting the output results of the above program.


# Include <stdio. h>
# Include <string. h>
# Define Max size 100
Struct intersect {
Int I, j, S, T;
} Backup [maxsize];
Struct points {
Int X, Y;
} TMP [maxsize];
Int dumppoints (File * Out, char * result, int lcount)
{
Int C, I, J;
Fprintf (Out, "% s [", result );
For (I = 0, c = 0; I <lcount; I ++ ){
Int X, Y;
X = backup [I]. I; y = backup [I]. J;
For (j = 0; j <C; j ++ ){
If (TMP [J]. x = x & TMP [J]. Y = y) break;
}
If (j = c ){
TMP [J]. x = x; TMP [J]. Y = y;
C ++;
}
X = backup [I]. S; y = backup [I]. T;
For (j = 0; j <C; j ++ ){
If (TMP [J]. x = x & TMP [J]. Y = y) break;
}
If (j = c ){
TMP [J]. x = x; TMP [J]. Y = y;
C ++;
}
}
For (I = 0; I <C; I ++ ){
Fprintf (Out, "(% d, % d)", TMP [I]. X, TMP [I]. Y );
}
Fprintf (Out, "] // n ");
Return C;
}


 


Int main ()
{
Char Buf [100];
Char Prev [100] = "";
Char * P, * q; int lcount = 0, scount = 0;
Int I, j, S, T, sum;
File * In = fopen ("c30.sort.txt", "R ");
File * out = fopen ("c30.dup.txt", "W ");
Q = Prev; sum = 0;
While (! Feof (in )){
Fgets (BUF, 100, in );
P = strchr (BUF ,/'[/');
If (P = NULL) continue;
* P =/'// 0/'; P ++;
If (strcmp (BUF, Prev) {// start new string
Int c = dumppoints (Out, Prev, lcount );
If (C> 0) sum + = C-1;
Lcount = 0;
Strcpy (prev, Buf );
Q = Prev + (p-BUF );
Strcpy (Q, P );
Scount = 0;
}
Sscanf (P, "% d, % d", & I, & J, & S, & T );
If (lcount <maxsize ){
Backup [lcount]. I = I; backup [lcount]. j = J; backup [lcount]. S = s; backup [lcount]. t = T;
}
If (J-I! = 15 & t-s! = 15 ){
Scount ++;
}
Lcount ++;
}
Sum + = dumppoints (Out, Prev, lcount)-1;
Fclose (in );
Fclose (out );
Printf ("Total % d // n", sum + 15*27 + 1 );
}

 


Below is a formula found through Google:


-- Author: Duz
-- Release Date: 9:37:41
--
A PDF file: http://math.berkeley.edu /~ Poonen/papers/ngon.pdf

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.