-
Notifications
You must be signed in to change notification settings - Fork 0
/
mterms.fox
1286 lines (1236 loc) · 39.2 KB
/
mterms.fox
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
INCLUDE 'COSY';
PROCEDURE RUN;
VARIABLE NM 1;
VARIABLE PI 1;
VARIABLE I 2;
VARIABLE J 1;
VARIABLE ORDER 1;
VARIABLE MPAR 1;
VARIABLE ZX 1000;
VARIABLE ZY 1000;
VARIABLE Z 2 1000;
VARIABLE ZXI 1000;
VARIABLE ZYI 1000;
VARIABLE ALPHA 60;
VARIABLE P0 1 60;
VARIABLE P1 1 60;
VARIABLE A0 1 80;
VARIABLE AN 1 80;
VARIABLE BN 1 80;
VARIABLE C 2;
VARIABLE L 1;
VARIABLE K 1;
VARIABLE KP 1;
VARIABLE NPOINTS 1;
VARIABLE ZPOINT0 2;
VARIABLE IER 1;
VARIABLE V 1;
VARIABLE V1 1; VARIABLE V2 1; VARIABLE V3 1; VARIABLE V4 1;
VARIABLE D1 1; VARIABLE D2 1; VARIABLE D3 1; VARIABLE D4 1;
VARIABLE D10 1; VARIABLE D20 1; VARIABLE D30 1; VARIABLE D40 1;
VARIABLE R 1;
VARIABLE Rref 1;
VARIABLE INPUTCHAR 1;
VARIABLE CPUTIME1 1;
VARIABLE CPUTIME2 1;
VARIABLE POLYGONSTR 80 200;
VARIABLE A0 1;
VARIABLE AN 1 100;
VARIABLE BN 1 100;
VARIABLE A01 1;
VARIABLE AN1 1 100;
VARIABLE BN1 1 100;
VARIABLE A02 1;
VARIABLE AN2 1 100;
VARIABLE BN2 1 100;
VARIABLE A03 1;
VARIABLE AN3 1 100;
VARIABLE BN3 1 100;
VARIABLE A04 1;
VARIABLE AN4 1 100;
VARIABLE BN4 1 100;
VARIABLE IMGINDX 1;
VARIABLE MAPF0 4000;
VARIABLE CALCDONE 1;
VARIABLE CALCMODE 1;
FUNCTION EXP1 X;
VARIABLE XR NM;
VARIABLE XI NM;
VARIABLE RESULT NM;
VARIABLE I 2;
I:=CM(0&1);
XR:=REAL(X);
XI:=IMAG(X);
RESULT:=EXP(XR)*(COS(XI)+I*SIN(XI));
EXP1:=RESULT;
ENDFUNCTION;
FUNCTION POW A B;
POW:=EXP1(B*LOG(A));
ENDFUNCTION;
FUNCTION LOG1 A;
VARIABLE LOG10 NM;
VARIABLE LOG110 NM;
VARIABLE LOG11 NM;
LOG10:=LOG(CONS(A));
LOG110:=DER(1,A)*1/A;
DAINT 1 LOG110 LOG11;
LOG1:=LOG10+LOG11;
ENDFUNCTION;
FUNCTION SINH1 A;
SINH1:=(EXP1(A)-EXP1(-A))/2;
ENDFUNCTION;
PROCEDURE MI1 M N L IER NO NV NM1 ; {INVERTS DA MAP M INTO N}
{NO,NV,NM1: The current computational order, DA dimension, DA size.}
VARIABLE C 2 L ; VARIABLE AL 2 L L ; VARIABLE AI 2 L L ; VARIABLE CL 2 L ;
VARIABLE AN NM1 L ; VARIABLE ANR NM1 L ; VARIABLE ANI NM1 L ;
VARIABLE SM NM1 L ; VARIABLE DDA 2 L ;
VARIABLE SCR NM1 ; VARIABLE I 1 ; VARIABLE J 1 ; VARIABLE K 1 ;
VARIABLE NR NM1 L; VARIABLE NI NM1 L;
PROCEDURE DACLIW1 SCR L CL;
VARIABLE J 1;
VARIABLE CL0 2 L;
LOOP J 1 L; CL(J):=DER(J,SCR); ENDLOOP;
ENDPROCEDURE;
IF L>NV ; WRITE 6 ' *** ERROR IN MI, DIM TOO LARGE' ; QUIT 0 ; ENDIF ;
LOOP I 1 L ; DDA(I) := DA(I) ; DANOT 1 ; SCR := M(I) ; DANOT NO ;
C(I) := CONS(SCR) ; AN(I) := M(I)-SCR ; DACLIW1 SCR L CL ;
LOOP J 1 L ; AL(I,J) := CL(J) ; ENDLOOP ; N(I) := 0 ; ENDLOOP ;
{MATINV1 AL AI L ;} AI(1,1):=1/AL(1,1); IF IER#0 ; IER := 1 ; ENDIF ;
IF NO>1 ;
LOOP I 1 L; ANR(I):=REAL(AN(I)); ANI(I):=IMAG(AN(I)); ENDLOOP;
POLVAL 1 ANR L N L NR L ; POLVAL 1 ANI L N L NI L ;
LOOP I 1 L; N(I):=CM(0&1)*NI(I)+NR(I); ENDLOOP;
ENDIF ;
LOOP I 1 L ; N(I) := 0 ;
LOOP J 1 L ; N(I) := N(I) + AI(I,J)*DDA(J) ; ENDLOOP ; ENDLOOP ;
LOOP I 2 NO ; DANOT I ;
POLVAL 1 ANR L N L NR L ; POLVAL 1 ANI L N L NI L ;
LOOP J 1 L; N(J):=CM(0&1)*NI(J)+NR(J); ENDLOOP;
LOOP J 1 L ; SM(J) := 0 ; LOOP K 1 L ;
SM(J) := SM(J) + AI(J,K)*(DDA(K)-N(K)) ; ENDLOOP ; ENDLOOP ;
LOOP J 1 L ; N(J) := SM(J) ; ENDLOOP ; ENDLOOP ;
LOOP I 1 L ; SM(I) := DDA(I) - C(I) ; ENDLOOP ;
LOOP I 1 L; NR(I):=REAL(N(I)); NI(I):=IMAG(N(I)); ENDLOOP;
POLVAL 1 NR L SM L NR L ; POLVAL 1 NI L SM L NI L ;
LOOP I 1 L; N(I):=CM(0&1)*NI(I)+NR(I); ENDLOOP;
ENDPROCEDURE ;
FUNCTION RFCARLSON X Y Z;
{Carlson's elliptic integral of the first kind (scalar value).
GNU Software Library, specfunc, ellint.c, gsl_sf_ellint_RF_e
M. Galassi et al, GNU Scientific Library Reference Manual (3rd Ed.), ISBN 0954612078}
VARIABLE ERRORTOL 1;
VARIABLE NMAX 1;
VARIABLE C1 1; VARIABLE C2 1; VARIABLE C3 1;
VARIABLE XN 1; VARIABLE YN 1; VARIABLE ZN 1;
VARIABLE MU 1; VARIABLE XNDEV 1; VARIABLE YNDEV 1; VARIABLE ZNDEV 1;
VARIABLE E2 1; VARIABLE E3 1; VARIABLE S 1;
VARIABLE N 1;
VARIABLE EPSLON 1; VARIABLE LAMBDA 1;
VARIABLE XNROOT 1; VARIABLE YNROOT 1; VARIABLE ZNROOT 1;
ERRORTOL:=0.0005;
NMAX:=10000;
IF (X<0)+(Y<0)+(Z<0);
WRITE 6 'RFCARLSON: DOMAIN ERROR';
QUIT -1;
ELSEIF NOT(X+Y>0)+NOT(Y+Z>0)+NOT(X+Z>0);
WRITE 6 'RFCARLSON: DOMAIN ERROR';
QUIT -1;
ENDIF;
C1:=1.0/24.0; C2:=3.0/44.0; C3:=1.0/14.0;
N:=0;
WHILE (EPSLON>ERRORTOL);
MU:=(XN+YN+ZN)/3.0;
XNDEV:=2.0-(MU+XN)/MU;
YNDEV:=2.0-(MU+YN)/MU;
ZNDEV:=2.0-(MU+ZN)/MU;
EPSLON:=MAX(MAX(ABS(XNDEV),ABS(YNDEV)),ABS(ZNDEV));
XNROOT:=SQRT(XN);
YNROOT:=SQRT(YN);
ZNROOT:=SQRT(ZN);
LAMBDA:=XNROOT*(YNROOT+ZNROOT)+YNROOT*ZNROOT;
XN:=(XN+LAMBDA)*0.25;
YN:=(YN+LAMBDA)*0.25;
ZN:=(ZN+LAMBDA)*0.25;
N:=N+1;
IF (N=NMAX);
WRITE 6 'RFCARLSON: MAX ITERATIONS REACHED';
ENDIF;
ENDWHILE;
E2:=XNDEV*YNDEV-ZNDEV*ZNDEV;
E3:=XNDEV*YNDEV*ZNDEV;
RFCARLSON:=1.0+(C1*E2-0.1-C2*E3)*E2+C3*E3;
ENDFUNCTION;
FUNCTION ELLINT_F PHI K;
{Legendre elliptic integral of the first kind F (scalar value).
GNU Software Library, specfunc, ellint.c, gsl_sf_ellint_F_e
M. Galassi et al, GNU Scientific Library Reference Manual (3rd Ed.), ISBN 0954612078}
VARIABLE SIN_PHI 1;
VARIABLE X 1;
VARIABLE Y 1;
SIN_PHI:=SIN(PHI);
X:=COS(PHI)*COS(PHI);
Y:=(1.0+K*SIN_PHI)*(1.0-K*SIN_PHI);
ELLINT_F:=SIN_PHI*RFCARLSON(X,Y,1.0);
ENDFUNCTION;
FUNCTION ELLIPTICF PHI K;
{Legendre elliptic integral of the first kind F (DA value).}
VARIABLE MAPF NM;
VARIABLE MAPF1 NM;
VARIABLE MAPF11 NM;
VARIABLE MAPF12 NM;
VARIABLE A 1;
A:=CONS(PHI);
MAPF12:=ELLINT_F(A,K);
MAPF:=1/SQRT(1-K*K*SIN(A+DA(1))*SIN(A+DA(1)));
DAINT 1 MAPF MAPF1;
MAPF12:=MAPF12+MAPF1;
ELLIPTICF:=MAPF12;
ENDFUNCTION;
FUNCTION JAMP X KIN;
{Jacobi amplitude (scalar value).
Arithmetic-geometric mean method, based on subsec. 22.20(ii) at http://dlmf.nist.gov/22.20
NIST Digital Library of Mathematical Functions. http://dlmf.nist.gov/, Release 1.0.14 of 2016-12-21. F. W. J. Olver,
A. B. Olde Daalhuis, D. W. Lozier, B. I. Schneider, R. F. Boisvert, C. W. Clark, B. R. Miller, and B. V. Saunders, eds.}
VARIABLE EPS 1;
VARIABLE A NM 1000; VARIABLE B NM 1000; VARIABLE C NM 1000;
VARIABLE PHI NM; VARIABLE PHI1 NM;
VARIABLE N 1; VARIABLE NN 1;
VARIABLE K 1; VARIABLE KP 1;
VARIABLE BRFLAG 1; VARIABLE J 1;
EPS:=1E-18;
K:=KIN; KP:=SQRT(1-K*K);
A(1):=1; B(1):=KP; C(1):=K;
N:=0;
LOOP J 1 100; IF BRFLAG=0;
N:=N+1;
A(J+1):=(A(J)+B(J))/2;
B(J+1):=SQRT(A(J)*B(J));
C(J+1):=(A(J)-B(J))/2;
IF ABS(C(J+1))<EPS;
BRFLAG:=1;
ENDIF;
ENDIF; ENDLOOP;
NN:=N;
PHI:=(2^NN)*A(NN+1)*X;
LOOP J NN 1 -1;
PHI1:=PHI;
PHI:=(PHI+ASIN(SIN(PHI)*C(J+1)/A(J+1)))/2;
ENDLOOP;
JAMP:=PHI;
ENDFUNCTION;
PROCEDURE SNCNDN U EMMC SN CN DN;
VARIABLE MAPF NM 1;
VARIABLE MAPF0 NM 1;
VARIABLE MAPF1 NM 1;
VARIABLE MAPF11 NM 1;
VARIABLE MAPF12 NM;
VARIABLE A 1 1;
VARIABLE C0 NM 1;
VARIABLE K 1;
K:=SQRT(EMMC);
MAPF(1):=ELLIPTICF(JAMP(CONS(U),K),K);
MAPF0(1):=MAPF(1)-CONS(MAPF(1));
MI MAPF0 MAPF1 1 IER ORDER 1 NM;
MAPF1(1):=MAPF1(1)+JAMP(CONS(U),K);
C0(1):=U-CONS(U);
POLVAL 1 MAPF1 1 C0 1 MAPF11 1 ;
MAPF12:=MAPF11(1);
SN:=SIN(MAPF12);
CN:=COS(MAPF12);
DN:=SQRT(1-K*K*SIN(MAPF12)*SIN(MAPF12));
ENDPROCEDURE;
FUNCTION SNRAW UU EMMC;
VARIABLE SN0 NM; VARIABLE CN0 NM; VARIABLE DN0 NM;
SNCNDN UU EMMC SN0 CN0 DN0;
SNRAW:=SN0;
ENDFUNCTION;
FUNCTION CNRAW UU EMMC;
VARIABLE SN0 NM; VARIABLE CN0 NM; VARIABLE DN0 NM;
SNCNDN UU EMMC SN0 CN0 DN0;
CNRAW:=CN0;
ENDFUNCTION;
FUNCTION DNRAW UU EMMC;
VARIABLE SN0 NM; VARIABLE CN0 NM; VARIABLE DN0 NM;
SNCNDN UU EMMC SN0 CN0 DN0;
DNRAW:=DN0;
ENDFUNCTION;
PROCEDURE SNCNDNI UU EMMC SN00 CN00 DN00;
VARIABLE SN0 NM; VARIABLE CN0 NM; VARIABLE DN0 NM;
SNCNDN UU EMMC SN0 CN0 DN0;
SN00:=SN0;
CN00:=CN0;
DN00:=DN0;
ENDPROCEDURE;
PROCEDURE ELLIPJI UU EMMC EMMC1 SNI CNI DNI;
VARIABLE SN0 NM; VARIABLE CN0 NM; VARIABLE DN0 NM;
VARIABLE SN1 NM; VARIABLE CN1 NM; VARIABLE DN1 NM;
VARIABLE DELTA NM; VARIABLE I 2;
I:=CM(0&1);
SNCNDNI REAL(UU) EMMC SN0 CN0 DN0;
IF 1=1;
SNCNDNI IMAG(UU) EMMC1 SN1 CN1 DN1;
DELTA:=CN1*CN1+EMMC*SN0*SN0*SN1*SN1;
SNI:=(SN0*DN1+I*CN0*DN0*SN1*CN1)/DELTA;
CNI:=(CN0*CN1-I*SN0*DN0*SN1*DN1)/DELTA;
DNI:=(DN0*CN1*DN1-I*EMMC*SN0*CN0*SN1)/DELTA;
ELSEIF 1=1;
SNI:=SN0;
CNI:=CN0;
DNI:=DN0;
ENDIF;
ENDPROCEDURE;
FUNCTION SN UU EMMC EMMC1;
VARIABLE UU0 NM;
VARIABLE SN0 NM; VARIABLE CN0 NM; VARIABLE DN0 NM;
VARIABLE FF1 1;
FF1:=0; UU0:=UU;
IF IMAG(CONS(UU0))>KP/2; UU0:=CM(0&KP)-UU0; FF1:=1; ENDIF;
ELLIPJI UU0 EMMC EMMC1 SN0 CN0 DN0;
IF FF1=1; SN0:=-1/(SQRT(EMMC)*SN0); ENDIF;
SN:=SN0;
ENDFUNCTION;
FUNCTION CN UU EMMC EMMC1;
VARIABLE UU0 NM;
VARIABLE SN0 NM; VARIABLE CN0 NM; VARIABLE DN0 NM;
VARIABLE FF1 1;
FF1:=0; UU0:=UU;
IF IMAG(CONS(UU0))>KP/2; UU0:=CM(0&KP)-UU0; FF1:=1; ENDIF;
ELLIPJI UU0 EMMC EMMC1 SN0 CN0 DN0;
IF FF1=1; CN0:=CM(0&1)*DN0/(SQRT(EMMC)*SN0); ENDIF;
CN:=CN0;
ENDFUNCTION;
FUNCTION DN UU EMMC EMMC1;
VARIABLE UU0 NM;
VARIABLE SN0 NM; VARIABLE CN0 NM; VARIABLE DN0 NM;
VARIABLE FF1 1;
FF1:=0; UU0:=UU;
IF IMAG(CONS(UU0))>KP/2; UU0:=CM(0&KP)-UU0; FF1:=1; ENDIF;
ELLIPJI UU0 EMMC EMMC1 SN0 CN0 DN0;
IF FF1=1; DN0:=CM(0&1)*CN0/SN0; ENDIF;
DN:=DN0;
ENDFUNCTION;
FUNCTION R2STRIP ZP L;
{Based on SC Toolbox function R2STRIP}
VARIABLE K 1;
VARIABLE KP 1;
VARIABLE M 1;
VARIABLE SN1 NM;
VARIABLE T1 1;
VARIABLE T2 1;
K:=VMAX(ZX);
KP:=VMAX(ZY);
M:=EXP(-2*PI*L);
SN1:=SN(ZP,M,1-M);
T1:=REAL(CONS(SN1));
T2:=MAX(0,IMAG(CONS(SN1)));
SN1:=SN1-CONS(SN1)+CM(T1&T2);
R2STRIP:=LOG1(SN1)/PI;
T1:=REAL(CONS(R2STRIP));
T2:=IMAG(CONS(R2STRIP));
IF T2<-0.5; T2:=-T2; ENDIF;
R2STRIP:=R2STRIP-CONS(R2STRIP)+CM(MAX(0,T1)&T2);
T1:=REAL(CONS(R2STRIP));
T2:=IMAG(CONS(R2STRIP));
R2STRIP:=R2STRIP-CONS(R2STRIP)+CM(T1&MAX(0,T2));
T1:=REAL(CONS(R2STRIP));
T2:=IMAG(CONS(R2STRIP));
R2STRIP:=R2STRIP-CONS(R2STRIP)+CM(T1&MIN(1,T2));
ENDFUNCTION;
FUNCTION R2STRIPDER ZP L;
{Based on SC Toolbox function R2STRIP}
VARIABLE K 1;
VARIABLE KP 1;
VARIABLE M 1;
VARIABLE SN1 NM;
VARIABLE T1 1;
VARIABLE T2 1;
K:=VMAX(ZX);
KP:=VMAX(ZY);
M:=EXP(-2*PI*L);
SN1:=SN(ZP,M,1-M);
T1:=REAL(CONS(SN1));
T2:=MAX(0,IMAG(CONS(SN1)));
SN1:=SN1-CONS(SN1)+CM(T1&T2);
R2STRIPDER:=CN(ZP,M,1-M)*DN(ZP,M,1-M)/SN1/PI;
ENDFUNCTION;
FUNCTION STDERIV ZP Z BETA;
{Based on SC Toolbox function STDERIV}
VARIABLE LOG2 1;
VARIABLE THETA 1;
VARIABLE STDERIV0 NM;
VARIABLE J 1;
VARIABLE TERMS NM NPOINTS;
VARIABLE TERMSSUM NM;
VARIABLE TERMSSUM1 NM;
LOG2:=LOG(2);
THETA:=0;
TERMSSUM:=0;
TERMSSUM1:=0;
LOOP J 1 NPOINTS;
TERMS(J):=-PI/2*(ZP-Z(J));
IF NOT(IMAG(CONS(TERMS(J)))>0);
TERMS(J):=-TERMS(J);
ENDIF;
TERMS(J):=LOG1(-I*SINH1(TERMS(J)));
TERMSSUM:=TERMSSUM+TERMS(J)*BETA(J);
TERMSSUM1:=TERMSSUM1+TERMS(J);
ENDLOOP;
STDERIV0:=EXP1(TERMSSUM);
STDERIV:=STDERIV0;
ENDFUNCTION;
FUNCTION RDERIV ZP;
{Compute the value of the SC rectangular map at points ZP
ZP is an complex-valued array.
Based on SC Toolbox function RDERIV}
VARIABLE ZS0 NM 1000;
VARIABLE ZS NM 1000;
VARIABLE BS NM 1000;
VARIABLE DG NM;
VARIABLE DF NM;
VARIABLE F NM;
VARIABLE J 1;
LOOP J 1 NPOINTS; ZS0(J):=CONS(R2STRIP(Z(J),L)); ENDLOOP;
LOOP J 1 NPOINTS; BS(J):=ALPHA|J-1; ENDLOOP;
LOOP J 1 NPOINTS; ZS(J):=CM(REAL(ZS0(J))&INT(IMAG(ZS0(J))+0.5)); ENDLOOP;
F:=R2STRIP(ZP,L);
DF:=R2STRIPDER(ZP,L);
DG:=STDERIV(F,ZS,BS);
RDERIV:=C*DF*DG;
ENDFUNCTION;
FUNCTION FPRIMEINVPROC Z;
VARIABLE MAPF NM;
VARIABLE MAPF1 NM;
VARIABLE MAPF10 NM 1;
VARIABLE MAPF11 NM 1;
VARIABLE MAPF12 NM;
VARIABLE A 1;
MAPF12:=ZPOINT0;
MAPF:=RDERIV(Z);
DAINT 1 MAPF MAPF1;
MAPF10(1):=MAPF1;
MI1 MAPF10 MAPF11 1 IER ORDER 1 NM;
MAPF:=MAPF11(1)-CONS(MAPF11(1));
MAPF12:=MAPF12+MAPF;
MAPF12:=(MAPF12+P0(1))/2/P0(1);
FPRIMEINVPROC:=MAPF12;
ENDFUNCTION;
FUNCTION ROTATEFOURIERAN AN BN PHI J;
ROTATEFOURIERAN:=AN*COS(J*PHI)-BN*SIN(J*PHI);
ENDFUNCTION;
FUNCTION ROTATEFOURIERBN AN BN PHI J;
ROTATEFOURIERBN:=AN*SIN(J*PHI)+BN*COS(J*PHI);
ENDFUNCTION;
FUNCTION SUPERIMPOSEFOURIERA0 A01 A02 A03 A04 V1 V2 V3 V4;
SUPERIMPOSEFOURIERA0:=V1*A01+V2*A02+V3*A03+V4*A04;
ENDFUNCTION;
FUNCTION SUPERIMPOSEFOURIERAN AN1 BN1 AN2 BN2 AN3 BN3 AN4 BN4 V1 V2 V3 V4 J;
SUPERIMPOSEFOURIERAN:=V1*AN1+V2*ROTATEFOURIERAN(AN2,BN2,PI/2,J)+V3*ROTATEFOURIERAN(AN3,BN3,PI,J)+V4*ROTATEFOURIERAN(AN4,BN4,3*PI/2,J);
ENDFUNCTION;
FUNCTION SUPERIMPOSEFOURIERBN AN1 BN1 AN2 BN2 AN3 BN3 AN4 BN4 V1 V2 V3 V4 J;
SUPERIMPOSEFOURIERBN:=V1*BN1+V2*ROTATEFOURIERBN(AN2,BN2,PI/2,J)+V3*ROTATEFOURIERBN(AN3,BN3,PI,J)+V4*ROTATEFOURIERBN(AN4,BN4,3*PI/2,J);
ENDFUNCTION;
PROCEDURE MULTIPOLETERMS R Rref;
VARIABLE J 1;
OPENF 56 'mterms.txt' 'UNKNOWN';
WRITE 6 'MULTIPOLE TERMS' 'SCALED TO R = '&S(R)&' cm';
WRITE 56 'MULTIPOLE TERMS' 'SCALED TO R = '&S(R)&' cm';
WRITE 6 'NOMINAL PLATE VOLTAGE PHI = '&S(V)&' V';
WRITE 56 'NOMINAL PLATE VOLTAGE PHI = '&S(V)&' V';
WRITE 6 'PLATE VOLTAGE COEFFICIENTS:';
WRITE 56 'PLATE VOLTAGE COEFFICIENTS:';
WRITE 6 'PLATE 1: V1 = '&S(V1);
WRITE 56 'PLATE 1: V1 = '&S(V1);
WRITE 6 'PLATE 2: V2 = '&S(V2);
WRITE 56 'PLATE 2: V2 = '&S(V2);
WRITE 6 'PLATE 3: V3 = '&S(V3);
WRITE 56 'PLATE 3: V3 = '&S(V3);
WRITE 6 'PLATE 4: V4 = '&S(V4);
WRITE 56 'PLATE 4: V4 = '&S(V4);
WRITE 6 'PLATE DISTANCE ERRORS:';
WRITE 56 'PLATE DISTANCE ERRORS:';
WRITE 6 'PLATE 1: D1 = '&S(D10)&' cm';
WRITE 56 'PLATE 1: D1 = '&S(D10)&' cm';
WRITE 6 'PLATE 2: D2 = '&S(D20)&' cm';
WRITE 56 'PLATE 2: D2 = '&S(D20)&' cm';
WRITE 6 'PLATE 3: D3 = '&S(D30)&' cm';
WRITE 56 'PLATE 3: D3 = '&S(D30)&' cm';
WRITE 6 'PLATE 4: D4 = '&S(D40)&' cm';
WRITE 56 'PLATE 4: D4 = '&S(D40)&' cm';
WRITE 6 '';
WRITE 56 '';
WRITE 6 'A0 = ' V*SUPERIMPOSEFOURIERA0(A01,A02,A03,A04,V1,V2,V3,V4);
WRITE 56 V*SUPERIMPOSEFOURIERA0(A01,A02,A03,A04,V1,V2,V3,V4);
{WRITE 56 {'A0='&}S(A01){&';'};}
WRITE 6 'AN = ';
{WRITE 56 'AN=';}
LOOP J 1 ORDER;
WRITE 6 V*(R/Rref)^J*SUPERIMPOSEFOURIERAN(AN1(J),BN1(J),AN2(J),BN2(J),AN3(J),BN3(J),AN4(J),BN4(J),V1,V2,V3,V4,J);
WRITE 56 V*(R/Rref)^J*SUPERIMPOSEFOURIERAN(AN1(J),BN1(J),AN2(J),BN2(J),AN3(J),BN3(J),AN4(J),BN4(J),V1,V2,V3,V4,J);
{WRITE 56 {'AN('&SI(J)&')='&}S(AN1(J)){&';'};}
ENDLOOP;
WRITE 6 'BN = ';
{WRITE 56 'BN=';}
LOOP J 1 ORDER;
WRITE 6 V*(R/Rref)^J*SUPERIMPOSEFOURIERBN(AN1(J),BN1(J),AN2(J),BN2(J),AN3(J),BN3(J),AN4(J),BN4(J),V1,V2,V3,V4,J);
WRITE 56 V*(R/Rref)^J*SUPERIMPOSEFOURIERBN(AN1(J),BN1(J),AN2(J),BN2(J),AN3(J),BN3(J),AN4(J),BN4(J),V1,V2,V3,V4,J);
{WRITE 56 {'BN('&SI(J)&')='&}S(BN1(J)){&';'};}
ENDLOOP;
CLOSEF 56;
ENDPROCEDURE;
PROCEDURE CONFMAPCOMP;
NPOINTS:=LENGTH(ALPHA);
POLYGONSTR(1):='p=polygon([ ...';
LOOP J 1 NPOINTS-1;
POLYGONSTR(J+1):=S(ZXI|J)&'+('&S(ZYI|J)&'i), ...';
ENDLOOP;
J:=NPOINTS;
POLYGONSTR(J+1):=S(ZXI|J)&'+('&S(ZYI|J)&'i)], [ ...';
LOOP J 1 NPOINTS-1;
POLYGONSTR(J+NPOINTS+1):=S(ALPHA|J)&', ...';
ENDLOOP;
J:=NPOINTS;
POLYGONSTR(J+NPOINTS+1):=S(ALPHA|J)&']);';
OPENF 55 'vertices.m' 'UNKNOWN';
WRITE 55 'function [p,f]=vertices';
WRITE 55 'options=scmapopt(''Tolerance'',1e-16);';
LOOP J 1 2*NPOINTS+1;
WRITE 55 POLYGONSTR(J);
ENDLOOP;
WRITE 55 'f=rectmap(p,[1,6,7,56], options);';
WRITE 55 'plot(f);';
WRITE 55 'print(''quadplot'&SI(IMGINDX)&''',''-dpdf'');';
WRITE 55 'z=parameters(f);';
WRITE 55 'fileID=fopen(''mapdata.txt'',''w'');';
WRITE 55 'zpoint0=evalinv(f,0);';
WRITE 55 'fprintf(fileID,''%24.16e\n'',real(zpoint0));';
WRITE 55 'fprintf(fileID,''%24.16e\n'',imag(zpoint0));';
WRITE 55 'fprintf(fileID,''%24.16e\n'',real(z.constant));';
WRITE 55 'fprintf(fileID,''%24.16e\n'',imag(z.constant));';
WRITE 55 'fprintf(fileID,''%24.16e\n'',z.stripL);';
WRITE 55 'fprintf(fileID,''%i\n'',length(z.prevertex));';
WRITE 55 'fprintf(fileID,''%24.16e\n'',real(z.prevertex));';
WRITE 55 'fprintf(fileID,''%24.16e\n'',imag(z.prevertex));';
WRITE 55 'exit';
WRITE 55 'end';
CLOSEF 55;
WRITE 6 'WAITING FOR MATLAB TO COMPUTE CONFORMAL MAP PARAMETERS, SET '&SI(IMGINDX)&'...';
OS 'matlab -nosplash -nodesktop -minimize -r vertices';
WRITE 6 '';
IMGINDX:=IMGINDX+1;
ENDPROCEDURE;
PROCEDURE CONFMAPDATA;
VARIABLE TMP 1; VARIABLE J 1;
OPENF 55 'mapdata.txt' 'OLD';
READ 55 ZPOINT0; READ 55 TMP; ZPOINT0:=CM(ZPOINT0&TMP);
READ 55 C; READ 55 TMP; C:=CM(C&TMP);
READ 55 L;
READ 55 NPOINTS; NPOINTS:=INT(NPOINTS);
LOOP J 1 NPOINTS; READ 55 TMP; P0(J):=TMP; ENDLOOP;
LOOP J 1 NPOINTS; READ 55 TMP; P1(J):=TMP; ENDLOOP;
CLOSEF 55;
ENDPROCEDURE;
PROCEDURE GEOMDATA D1 D2 D3 D4;
{Geometry data.
The x- and y-coordinates of the polygonal model are stored in the
vectors ZXI and ZYI, respectively. The interior angles of the polygon,
divided by Pi, are stored in the vector ALPHA.
The x- and y-coordinates of the polygonal model are stored in the COSY
INFINITY vectors ZXI and ZYI, respectively. The interior angles of the
polygon, divided by Pi, are stored in the vector ALPHA.
The parameters D1, D2, D3, and D4 denote the errors in distances from the
origin to the plates. The sequence of the plates and the respective errors
starts from the left plate on the cross section drawing and proceeds in
counter-clockwise order.}
ZXI:=-5.25&-5.25&(-5-D1)&(-5-D1)&-5.25&-5.25&-7;
ZXI:=ZXI&-7&-5.25&-4.125&-3.875&-5&-5&-0.25&-0.25&-2.35&-2.35&2.35;
ZXI:=ZXI&2.35&0.25&0.25&5&5&3.875&4.125&5.25&7&7&5.25&5.25&(5+D3)&(5+D3);
ZXI:=ZXI&5.25&5.25&7&7&5.25&4.125&3.875&5&5&0.25&0.25&2.35&2.35;
ZXI:=ZXI&-2.35&-2.35&-0.25&-0.25&-5&-5&-3.875&-4.125&-5.25&-7&-7;
ZYI:=0.25&2.35&2.35&-2.35&-2.35&-0.25&-0.25;
ZYI:=ZYI&-5&-5&-3.875&-4.125&-5.25&-7&-7&-5.25&-5.25&(-5-D2)&(-5-D2)&-5.25;
ZYI:=ZYI&-5.25&-7&-7&-5.25&-4.125&-3.875&-5&-5&-0.25&-0.25&-2.35;
ZYI:=ZYI&-2.35&2.35&2.35&0.25&0.25&5&5&3.875&4.125&5.25&7&7&5.25;
ZYI:=ZYI&5.25&(5+D4)&(5+D4)&5.25&5.25&7&7&5.25&4.125&3.875&5&5&0.25;
ALPHA:=0.5&1.5&1.5&1.5&1.5&0.5&0.5&0.5&0.75&1.5&1.5&0.75&0.5&0.5&0.5;
ALPHA:=ALPHA&1.5&1.5&1.5&1.5&0.5&0.5&0.5&0.75&1.5&1.5&0.75&0.5&0.5&0.5;
ALPHA:=ALPHA&1.5&1.5&1.5&1.5&0.5&0.5&0.5&0.75;
ALPHA:=ALPHA&1.5&1.5&0.75&0.5&0.5&0.5&1.5&1.5&1.5&1.5;
ALPHA:=ALPHA&0.5&0.5&0.5&0.75&1.5&1.5&0.75&0.5&0.5;
ENDPROCEDURE;
PROCEDURE NOMINALCOEFF A0 AN BN;
A0:= 0.3960514667124162002664889;
AN(1):=-0.6885669997872999326116172E-01;
AN(2):= 0.1038549923778346421865404E-01;
AN(3):=-0.1297913346966461569514939E-02;
AN(4):= 0.1147644547501454185579883E-03;
AN(5):=-0.8616667865527831779307380E-05;
AN(6):=-0.8001982661547007625552443E-07;
AN(7):= 0.2082467167685008440847151E-06;
AN(8):=-0.5650578854280667308819636E-07;
AN(9):= 0.9493137805299051641279443E-08;
AN(10):=-0.1178399055617841478965939E-08;
AN(11):= 0.8674995375714368533264641E-10;
AN(12):= 0.4744035300963714852169690E-11;
AN(13):=-0.2078593716783584744931825E-11;
AN(14):= 0.4148146248054382449300898E-12;
AN(15):=-0.6336771062740538231062328E-13;
AN(16):= 0.8490681557639771424240070E-14;
AN(17):=-0.1872421797230359291328962E-14;
AN(18):= 0.3426453476938451690633081E-15;
AN(19):=-0.4796463381145525802394053E-16;
AN(20):= 0.3673070349668451197684033E-17;
AN(21):= 0.6047013893814340323967724E-18;
AN(22):=-0.2935711731503183201970729E-18;
AN(23):= 0.7048405345513463674564302E-19;
AN(24):= 0.0000000000000000000000000E+00;
AN(25):= 0.0000000000000000000000000E+00;
BN(1):= 0.7766948107121075687303587E-10;
BN(2):= 0.9084503808574815186009811E-09;
BN(3):=-0.2740709784014760385675795E-09;
BN(4):= 0.3211767800415641958410902E-10;
BN(5):= 0.1212772388378897834820223E-11;
BN(6):=-0.1566030408821507397282051E-11;
BN(7):= 0.4348995470313623648896982E-12;
BN(8):=-0.7724423871624272621235177E-13;
BN(9):= 0.7215556636694773644521280E-14;
BN(10):= 0.7337986574181112655162078E-15;
BN(11):=-0.5034212659015152446443716E-15;
BN(12):= 0.1296636147404973131491258E-15;
BN(13):=-0.2062294257995577350069950E-16;
BN(14):= 0.1665197708903231252482612E-17;
BN(15):= 0.1802161180397575394110535E-18;
BN(16):=-0.1036746736978828970543980E-18;
BN(17):= 0.2483145366298546087471422E-19;
BN(18):= 0.0000000000000000000000000E+00;
BN(19):= 0.0000000000000000000000000E+00;
BN(20):= 0.0000000000000000000000000E+00;
BN(21):= 0.0000000000000000000000000E+00;
BN(22):= 0.0000000000000000000000000E+00;
BN(23):= 0.0000000000000000000000000E+00;
BN(24):= 0.0000000000000000000000000E+00;
BN(25):= 0.0000000000000000000000000E+00;
ENDPROCEDURE;
PROCEDURE PERTURBCOEFF1 D1 A0 AN BN;
VARIABLE DA0 1;
VARIABLE DAN 1 100;
VARIABLE DBN 1 100;
VARIABLE J 1;
DA0:=-0.1444884897365176;
DAN(1):=0.024848403415070462;
DAN(2):=-0.0035964314565587524;
DAN(3):=0.0003975167425589697;
DAN(4):=-0.000019027837440425757;
DAN(5):=-2.6389842208771386e-6;
DAN(6):=1.3200429446831776e-6;
DAN(7):=-3.336076829265742e-7;
DAN(8):=6.623339431143421e-8;
DAN(9):=-1.041062666661125e-8;
DAN(10):=1.2617566878151998e-9;
DAN(11):=-8.210887578907022e-11;
DAN(12):=-1.1765160099419854e-11;
DAN(13):=5.596411607742279e-12;
DAN(14):=-1.3920004680873368e-12;
DAN(15):=2.6920021350544594e-13;
DAN(16):=-4.29932669278841e-14;
DAN(17):=5.745154992880337e-15;
DAN(18):=-4.983850750279471e-16;
DAN(19):=-2.0577218923151605e-17;
DAN(20):=2.2283046912641997e-17;
DAN(21):=-6.547768415309331e-18;
DAN(22):=1.3884321371806001e-18;
DAN(23):=-2.376780998696832e-19;
DAN(24):=0.;
DAN(25):=0.;
DBN(1):=3.5484213725721443e-6;
DBN(2):=0.000036014360182936215;
DBN(3):=-0.000010881035411630925;
DBN(4):=1.2753318430030797e-6;
DBN(5):=4.819410386204099e-8;
DBN(6):=-6.220211484910526e-8;
DBN(7):=1.727264556597449e-8;
DBN(8):=-3.0676944205138244e-9;
DBN(9):=2.8646167242545424e-10;
DBN(10):=2.9186368392854654e-11;
DBN(11):=-2.000518511207103e-11;
DBN(12):=5.152243236370143e-12;
DBN(13):=-8.194149177053863e-13;
DBN(14):=6.614926637530062e-14;
DBN(15):=7.16612976746983e-15;
DBN(16):=-4.121119580780476e-15;
DBN(17):=9.87224257084664e-16;
DBN(18):=0.;
DBN(19):=0.;
DBN(20):=0.;
DBN(21):=0.;
DBN(22):=0.;
DBN(23):=0.;
DBN(24):=0.;
DBN(25):=0.;
A0:=A0+D1*DA0;
LOOP J 1 ORDER;
AN(J):=AN(J)+D1*DAN(J);
BN(J):=BN(J)+D1*DBN(J);
ENDLOOP;
ENDPROCEDURE;
PROCEDURE PERTURBCOEFF2 D2 A0 AN BN;
VARIABLE DA0 1;
VARIABLE DAN 1 100;
VARIABLE DBN 1 100;
VARIABLE J 1;
DA0:=0.02463158081389416;
DAN(1):=-0.0006531514532004401;
DAN(2):=-0.0006519016577943848;
DAN(3):=0.000050219855279518;
DAN(4):=7.308752762074169e-6;
DAN(5):=-1.4847818318198809e-6;
DAN(6):=2.7373194983682978e-8;
DAN(7):=2.575921941229351e-8;
DAN(8):=-5.371460655667032e-9;
DAN(9):=-2.0187850804427197e-11;
DAN(10):=1.3699349709711163e-10;
DAN(11):=-1.4367069594248677e-11;
DAN(12):=-4.480616938928591e-13;
DAN(13):=4.389622545399623e-13;
DAN(14):=-6.026734883546398e-14;
DAN(15):=-5.3789105734122435e-15;
DAN(16):=2.5287025520619607e-15;
DAN(17):=-1.440333425607398e-16;
DAN(18):=-5.852426774904934e-17;
DAN(19):=1.0732657190214119e-17;
DAN(20):=-3.371932262158921e-19;
DAN(21):=-2.696899131755618e-19;
DAN(22):=7.290960456984063e-20;
DAN(23):=1.5465718628549282e-22;
DAN(24):=0.;
DAN(25):=0.;
DBN(1):=0.004291141557968972;
DBN(2):=-0.00018121709368299234;
DBN(3):=-0.00009307793575405624;
DBN(4):=0.000010575970230850742;
DBN(5):=5.56435100630618e-7;
DBN(6):=-2.7373406889299316e-7;
DBN(7):=3.7729278212684966e-8;
DBN(8):=-7.810016388882003e-10;
DBN(9):=-6.805548960513614e-10;
DBN(10):=7.860964185613506e-11;
DBN(11):=-5.91594881675488e-12;
DBN(12):=2.3337007215824654e-12;
DBN(13):=-6.514714236739883e-13;
DBN(14):=1.2302360401338842e-13;
DBN(15):=-6.670448858970904e-15;
DBN(16):=-4.141239834729562e-15;
DBN(17):=1.3793259742916664e-15;
DBN(18):=0.;
DBN(19):=0.;
DBN(20):=0.;
DBN(21):=0.;
DBN(22):=0.;
DBN(23):=0.;
DBN(24):=0.;
DBN(25):=0.;
A0:=A0+D2*DA0;
LOOP J 1 ORDER;
AN(J):=AN(J)+D2*DAN(J);
BN(J):=BN(J)+D2*DBN(J);
ENDLOOP;
ENDPROCEDURE;
PROCEDURE PERTURBCOEFF3 D3 A0 AN BN;
VARIABLE DA0 1;
VARIABLE DAN 1 100;
VARIABLE DBN 1 100;
VARIABLE J 1;
DA0:=0.009376974330997085;
DAN(1):=0.0016466903355588974;
DAN(2):=0.00025673876508554755;
DAN(3):=0.000034633068178518805;
DAN(4):=3.699119998049537e-6;
DAN(5):=4.0035108069670176e-7;
DAN(6):=3.1135075378037185e-8;
DAN(7):=-3.4013761560371777e-10;
DAN(8):=-8.329064640595302e-10;
DAN(9):=-1.9072194257427367e-10;
DAN(10):=-3.0553601098349e-11;
DAN(11):=-3.256616872039333e-12;
DAN(12):=-1.1364648285565948e-13;
DAN(13):=2.8168736314034743e-14;
DAN(14):=1.2258346799565113e-14;
DAN(15):=2.6975760287450926e-15;
DAN(16):=5.295885854313568e-16;
DAN(17):=9.992654208203225e-17;
DAN(18):=1.483293712681986e-17;
DAN(19):=1.590520323241747e-18;
DAN(20):=-2.018229056940692e-20;
DAN(21):=-5.522461977746537e-20;
DAN(22):=-1.7833523207981785e-20;
DAN(23):=-3.607909453318381e-21;
DAN(24):=0.;
DAN(25):=0.;
DBN(1):=2.6012561396628937e-6;
DBN(2):=-3.264427228831575e-7;
DBN(3):=1.6219024479853696e-8;
DBN(4):=-9.301485458960886e-11;
DBN(5):=4.875609189517354e-11;
DBN(6):=-3.020687618033502e-11;
DBN(7):=-2.008207049699983e-12;
DBN(8):=8.618373852593456e-13;
DBN(9):=-5.025368408773574e-13;
DBN(10):=1.7929831598457703e-13;
DBN(11):=-4.6486252361772815e-14;
DBN(12):=9.821321480592008e-15;
DBN(13):=-1.6317932526659849e-15;
DBN(14):=8.621596651502531e-17;
DBN(15):=3.3157898412483947e-17;
DBN(16):=-1.2810764392090319e-17;
DBN(17):=3.821237355640557e-18;
DBN(18):=0.;
DBN(19):=0.;
DBN(20):=0.;
DBN(21):=0.;
DBN(22):=0.;
DBN(23):=0.;
DBN(24):=0.;
DBN(25):=0.;
A0:=A0+D3*DA0;
LOOP J 1 ORDER;
AN(J):=AN(J)+D3*DAN(J);
BN(J):=BN(J)+D3*DBN(J);
ENDLOOP;
ENDPROCEDURE;
PROCEDURE PERTURBCOEFF4 D4 A0 AN BN;
VARIABLE DA0 1;
VARIABLE DAN 1 100;
VARIABLE DBN 1 100;
VARIABLE J 1;
DA0:=0.02463156389964638;
DAN(1):=-0.0006572106163680683;
DAN(2):=-0.0006509517704236568;
DAN(3):=0.00005008041481332758;
DAN(4):=7.311960481097025e-6;
DAN(5):=-1.4832042664218915e-6;
DAN(6):=2.686993667956254e-8;
DAN(7):=2.582815475252795e-8;
DAN(8):=-5.375006788041004e-9;
DAN(9):=-2.216645711303911e-11;
DAN(10):=1.3763870154246403e-10;
DAN(11):=-1.447182447679387e-11;
DAN(12):=-4.4261541328000695e-13;
DAN(13):=4.424264496060864e-13;
DAN(14):=-6.138744911938371e-14;
DAN(15):=-5.159127712706641e-15;
DAN(16):=2.5039160264365163e-15;
DAN(17):=-1.4456449599913898e-16;
DAN(18):=-5.772285926076793e-17;
DAN(19):=1.0509489396965041e-17;
DAN(20):=-2.984829601057637e-19;
DAN(21):=-2.7466074284149757e-19;
DAN(22):=7.314845072502751e-20;
DAN(23):=1.5397501179808952e-22;
DAN(24):=0.;
DAN(25):=0.;
DBN(1):=-0.0042923438435735;
DBN(2):=0.00021791378621024795;
DBN(3):=0.00008211499671272027;
DBN(4):=-9.294389673533813e-6;
DBN(5):=-5.079774526104112e-7;
DBN(6):=2.1139313062627526e-7;
DBN(7):=-2.0388970595219676e-8;
DBN(8):=-2.29940758712421e-9;
DBN(9):=9.6889886221242e-10;
DBN(10):=-4.9679879227888535e-11;
DBN(11):=-1.406671943084948e-11;
DBN(12):=2.8163816961828453e-12;
DBN(13):=-1.677183835725091e-13;
DBN(14):=-5.678868964822446e-14;
DBN(15):=1.3795447987588035e-14;
DBN(16):=3.2602077248549906e-17;
DBN(17):=-3.9333149423065704e-16;
DBN(18):=0.;
DBN(19):=0.;
DBN(20):=0.;
DBN(21):=0.;
DBN(22):=0.;
DBN(23):=0.;
DBN(24):=0.;
DBN(25):=0.;
A0:=A0+D4*DA0;
LOOP J 1 ORDER;
AN(J):=AN(J)+D4*DAN(J);
BN(J):=BN(J)+D4*DBN(J);
ENDLOOP;
ENDPROCEDURE;
PROCEDURE PERTURBCOEFF1A D1 A0 AN BN;
VARIABLE DA0 1;
VARIABLE DAN 1 100;
VARIABLE DBN 1 100;
VARIABLE J 1;
DA0:=-0.1457272552503937;
DAN(1):=0.025058962293321888;
DAN(2):=-0.0036216136671772424;
DAN(3):=0.0003985949190492816;
DAN(4):=-0.000018419993360822243;
DAN(5):=-2.8664175790197326e-6;
DAN(6):=1.3787075675833576e-6;
DAN(7):=-3.458854290082477e-7;
DAN(8):=6.838622220065129e-8;
DAN(9):=-1.0703797221547866e-8;
DAN(10):=1.2843096263238308e-9;
DAN(11):=-7.923827347064175e-11;
DAN(12):=-1.3559545945705499e-11;
DAN(13):=6.099638567443595e-12;
DAN(14):=-1.4996276738563107e-12;
DAN(15):=2.8788614920481876e-13;
DAN(16):=-4.554121712341895e-14;
DAN(17):=5.957119298892319e-15;
DAN(18):=-4.809799256796403e-16;
DAN(19):=-3.362653182396087e-17;
DAN(20):=2.605121449114396e-17;
DAN(21):=-7.359761543042948e-18;
DAN(22):=1.5305597039056104e-18;
DAN(23):=-2.5754173236529335e-19;
DAN(24):=0.;
DAN(25):=0.;
DBN(1):=2.458682462646829e-9;
DBN(2):=4.122710183712213e-8;
DBN(3):=-1.2323836864824485e-8;
DBN(4):=1.4081242705799559e-9;
DBN(5):=6.823121238914533e-11;
DBN(6):=-7.347556262436924e-11;
DBN(7):=1.9973997528413176e-11;
DBN(8):=-3.4773837646727866e-12;
DBN(9):=3.065834101124757e-13;
DBN(10):=3.942083825263193e-14;
DBN(11):=-2.408392142215011e-14;
DBN(12):=6.055270081822473e-15;
DBN(13):=-9.443113231016931e-16;
DBN(14):=7.179758323192199e-17;
DBN(15):=9.733684996243084e-18;
DBN(16):=-5.076093940229622e-18;
DBN(17):=1.1479052383101426e-18;
DBN(18):=0.;
DBN(19):=0.;
DBN(20):=0.;
DBN(21):=0.;
DBN(22):=0.;
DBN(23):=0.;
DBN(24):=0.;
DBN(25):=0.;
A0:=A0+D1*DA0;
LOOP J 1 ORDER;
AN(J):=AN(J)+D1*DAN(J);
BN(J):=BN(J)+D1*DBN(J);
ENDLOOP;
ENDPROCEDURE;
PROCEDURE PERTURBCOEFF2A D2 A0 AN BN;
VARIABLE DA0 1;
VARIABLE DAN 1 100;
VARIABLE DBN 1 100;
VARIABLE J 1;
DA0:=0.025060395967371016;
DAN(1):=-0.0006775690471413472;
DAN(2):=-0.0006618391253027938;
DAN(3):=0.00005195106628073963;
DAN(4):=7.348217955337336e-6;
DAN(5):=-1.5369031461450678e-6;
DAN(6):=3.2883674344008985e-8;
DAN(7):=2.6547600828730453e-8;
DAN(8):=-5.667104170575023e-9;
DAN(9):=-6.739759238787533e-12;
DAN(10):=1.4399862883772376e-10;
DAN(11):=-1.5715953490553942e-11;
DAN(12):=-4.035898584304069e-13;
DAN(13):=4.74392480381199e-13;
DAN(14):=-6.891464453450467e-14;
DAN(15):=-5.248139044132027e-15;
DAN(16):=2.766403270740668e-15;
DAN(17):=-1.7354796392027693e-16;
DAN(18):=-6.041314261014754e-17;
DAN(19):=1.1837265214714574e-17;
DAN(20):=-4.93772131097328e-19;
DAN(21):=-2.934010450195449e-19;
DAN(22):=8.345103485350077e-20;
DAN(23):=-2.847190636774604e-21;
DAN(24):=0.;
DAN(25):=0.;
DBN(1):=0.0043650738374104905;
DBN(2):=-0.00022559666117456616;
DBN(3):=-0.0000832902281804432;
DBN(4):=9.633654058863035e-6;
DBN(5):=4.939493162234669e-7;
DBN(6):=-2.1868670127496532e-7;
DBN(7):=2.187743137922035e-8;