Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ClrAllLists
- ClrHome
- a+bi
- Disp "ENTER COEFF.S AS
- Input "A LIST:",L1
- dim(L1->D
- 0->N
- ~1->X
- 1->Y
- Input "IMAG.FACTRS Y/N?",A
- If abs(A
- [i]->X
- 0->E
- For(I,1,D
- If real(L1(I)) and imag(L1(I
- 1->E
- End
- If abs(E
- [i]->X
- If real(L1(1))<0
- Then
- ~L1->L1
- Disp "MINUS
- End
- L1(1->A
- For(I,2,dim(L1
- L1(I->B
- 0->F
- While (real(B) or imag(B)) and F<16
- F+1->F
- A-Bint(A/B->C
- B->A
- C->B
- End
- End
- If real(L1(1))>0 and real(A)<0
- ~A->A
- real(A->B
- [i]imag(A->C
- If real(L1(1))=0 and abs(B)=0
- Then
- C->A
- If imag(L1(1))<0 and imag(C)>0
- ~A->A
- End
- If imag(L1(1))=0 and abs(B)=abs(C
- Then
- abs(B->A
- If real(L1(1))<0
- ~A->A
- End
- If imag(L1(1))=0 and B=0
- Then
- abs(C->A
- If real(L1(1))<0
- ~A->A
- End
- 0->dim(|LL
- If abs(A)>1 or real(A)<0 or imag(A
- Then
- Disp A,"*
- L1/A->L1
- If abs(A)>1
- {A->|LL
- End
- While real(L1(D))=0 and imag(L1(D))=0
- Disp {1,0
- D-1->D
- End
- D->dim(L1
- If D<=1
- Goto E
- 1->S
- 1->U
- {0->|LK
- Lbl 0
- 0->E
- For(I,1,D
- If real(L1(I)) and imag(L1(I
- 1->E
- End
- L1(1->A
- L1(D->B
- A->C
- 1->J
- If real(A) and imag(A)
- Then
- A->theta
- int(sqrt(abs(theta->V
- prgmADIVCMPX
- L3->L5
- If dim(|LL
- augment(|LL,L5->L5
- 2->J
- End
- For(J,J,2-(real(B)!=0 and imag(B)!=0)
- If J=2
- Then
- B->A
- B->C
- End
- 0->dim(L2
- 0->dim(L3
- For(I,1,sqrt(abs(C
- If fPart(real(C)/I)=0 and fPart(imag(C)/I)=0
- Then
- AI/C->L2(1+dim(L2
- A/I->L3(1+dim(L3
- End
- End
- If dim(L3
- SortA(L3
- 0->dim(L4
- For(I,1,dim(L2
- L2(I->L4(1+dim(L4
- L3(I->L4(1+dim(L4
- End
- If J=1
- Then
- L4->L5
- If dim(|LL
- augment(|LL,L5->L5
- If real(L1(1))=1 and imag(L1(1))=0
- {1->L5
- End
- End
- If real(B) and imag(B
- Then
- L1(D->theta
- int(sqrt(abs(theta->V
- prgmADIVCMPX
- L3->L4
- End
- 1->M
- max(1,round(dim(L5)/2,0->N
- If (abs(L1(2))abs(L1(D-1))!=0 and prod(abs(L1))=0) or prod(abs(L1))!=0
- Then
- SxrootL4->L4
- SxrootL5->L5
- End
- Lbl 1
- 0->T
- For(H,1,dim(L4
- For(I,M,N
- 0->L
- Repeat L=2+2(imag(X)!=0
- L4(H)/L5(I->Q
- {L1(1->L2
- L2->L3
- For(J,2,dim(L1
- If S=1
- Then
- L1(J)+QL2(J-1->L2(J
- Else
- If U and imag(X)=0
- Then
- If abs(L1(J
- L1(J)+QL2(dim(L2->L2(1+dim(L2
- Else
- If fPart((J-1)/S)=0
- L1(J)+QL2(dim(L2->L2(1+dim(L2
- If fPart((J-1)/S)=0
- L1(J)-QL3(dim(L3->L3(1+dim(L3
- End
- End
- End
- If abs(L2(dim(L2))) and abs(L3(dim(L3))) or (imag(X) and S>1 and abs(L3(dim(L3)))!=0
- Then
- L+1->L
- XL4(H->L4(H
- Else
- If abs(L3(dim(L3)))=0
- L3->L2
- D-S->D
- If S=1
- Then
- round(L2,0->L1
- dim(L1)-1->dim(L1
- If real(L4(H))=0 and real(L5(I))=0
- Then
- imag(L4(H->L4(H
- imag(L5(I->L5(I
- End
- If E
- Disp {L5(I),~L4(H)}
- If E=0
- Disp {L5(I),~L4(H)}/gcd(abs(L5(I)),abs(L4(H
- Else
- 1->R
- If fPart(round(abs(L4(H)),5))=0 and fPart(round(abs(L5(I)),5))=0
- 0->R
- 0->T
- Lbl R
- {L5(I)^(S^R)->L2
- For(W,2,S+T
- 0->L2(W
- End
- L4(H)^(S^R)->L2(W
- If real(X) and real(L4(H)L2(W))>0 or imag(L4(H)L2(W))>0
- ~L2(W->L2(W
- L1->L3
- dim(L2->dim(L3
- DelVar L61+dim(L1)-dim(L2->E
- For(V,1,E
- L3(1)/L2(1->L6(V
- L3-L2L6(V->L3
- If V<E
- Then
- For(W,2,dim(L3
- L3(W->L3(W-1
- End
- L1(V+dim(L3->L3(dim(L3
- End
- End
- If sum(abs(L3
- T+1->T
- If T>D
- Goto E
- If sum(abs(L3
- Goto R
- Disp L2
- round(L6,0->L1
- D-T->D
- If D<=S+1
- Goto K
- End
- End
- End
- If D>S+T+1
- End
- If D>S+T+1
- End
- M+N->M
- dim(L5->N
- If M<=dim(L5) and D>S+T+1
- Goto 1
- L1(1->A
- For(I,2,dim(L1
- L1(I->B
- 0->F
- While (real(B) or imag(B)) and F<16
- F+1->F
- A-Bint(A/B->C
- B->A
- C->B
- End
- End
- If abs(real(A))=abs(imag(A)) and imag(L1(1))=0 or (imag(A)=0
- abs(real(A->A
- If real(A)=0
- abs(imag(A->A
- L1/A->L1
- 0->dim(L2
- For(I,1,dim(L1
- If abs(L1(I
- I->L2(1+dim(L2
- End
- If dim(L2)=3 and L1(1)L1(dim(L1))=L1(int(dim(L1)/2)+1)^^2
- Goto K
- S->R
- 1->U
- S+1->S
- If dim(L2)=2 and D>=5 and fPart(D/2
- DelVar U(D-1)/2->S
- If D>S+T+1 and S!=R
- Goto 0
- If dim(L2)=2 and (fPart(sqrt(abs(L1(1)))) or fPart(sqrt(abs(L1(D
- Goto E
- Lbl K
- 1->Z
- Lbl 2
- If D>=5
- Then
- 1->J
- {0->|LK
- L1(Z+1->A
- If real(A) and imag(A
- Then
- A->theta
- int(sqrt(abs(theta->V
- prgmADIVCMPX
- L3->|LK
- 2->J
- End
- L1(dim(L1)-Z->B
- For(J,J,2-(real(B)!=0 and imag(B)!=0)
- If J=2
- L1(dim(L1)-Z->A
- abs(A->B
- For(I,1,sqrt(B
- If not(fPart(B/I
- Then
- AI/B->|LK(1+dim(|LK
- A/I->|LK(1+dim(|LK
- End
- End
- End
- L1(dim(L1)-Z->A
- If real(A) and imag(A
- Then
- A->theta
- int(sqrt(abs(theta->V
- prgmADIVCMPX
- augment(|LK,L3->|LK
- End
- L1(Z+1->A
- L1(dim(L1)-Z->B
- If real(A)=real(B) and imag(A)=imag(B) and dim(|LK)>1
- int(dim(|LK)/2+1->dim(|LK
- If Z+1=dim(L1)-Z and not(fPart(sqrt(abs(L1(Z+1
- {sqrt(abs(L1(Z+1))),[i]sqrt(abs(L1(Z+1->|LK
- If Z+1=dim(L1)-Z and fPart(Z/2
- Goto E
- End
- Z+1->Z
- If sum(abs(|LK))=0 and D>=5
- Goto 2
- If sum(abs(|LK)) and D>=5
- Then
- L4->L2
- L5->L3
- While fPart(sum(abs(round(L4,5)))) or fPart(sum(abs(round(L5,5
- L2L4->L4
- L3L5->L5
- End
- round(L4,0->L4
- round(L5,0->L5
- D->U
- int(Z/2->Z
- For(H,1,dim(L4
- For(K,1,dim(|LK
- For(I,1,dim(L5
- 0->L
- Repeat L=2+2(imag(X)!=0
- {L5(I),|LK(K),~L4(H->L2
- If dim(|LK)=2 and Z>=2
- Then
- {L5(I->L2
- For(J,2,Z
- 0->L2(J
- End
- |LK(K->L2(J
- For(J,J+1,J+Z-1
- 0->L2(J
- End
- XL4(H->L2(J
- End
- L1->L3
- dim(L2->dim(L3
- DelVar L61+dim(L1)-dim(L2->E
- For(V,1,E
- L3(1)/L2(1->L6(V
- L3-L2L6(V->L3
- If V<E
- Then
- For(W,2,dim(L3
- L3(W->L3(W-1
- End
- L1(V+dim(L3->L3(dim(L3
- End
- End
- If sum(abs(L3))=0
- Then
- round(L6,0->L1
- Disp L2
- dim(L1->D
- If dim(L1)=dim(L2) or (L1(int(D/2+1))=0 and fPart(D/2
- Goto E
- Else
- L+1->L
- XL4(H->L4(H
- End
- End
- If D>=5
- End
- If D>=5
- End
- If D>=5
- End
- End
- If D>=5 and D<U
- Goto K
- Lbl E
- If D>1
- L1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement