File: sphpca.R

package info (click to toggle)
r-cran-psy 1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 284 kB
  • sloc: makefile: 2
file content (1542 lines) | stat: -rw-r--r-- 64,485 bytes parent folder | download | duplicates (2)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
#' @export
sphpca <-
  function(datafile, h=0, v=0, f=0, cx=0.75, nbsphere=2, back=FALSE, input="data",method="approx", maxiter=500, output=FALSE)
  {

    p <- dim(datafile)[2]
    one <- matrix(1, nrow=p)
    load <- matrix(nrow=p, ncol=3)
    names <- attributes(datafile)$names

    if (input=="data")
    {
      mat <- as.matrix(na.omit(datafile))
      matcorp <- cor(mat)
    }
    if (input!="data")
    {
      matcorp <- as.matrix(datafile)
    }
    decomp <- eigen(matcorp, symmetric=TRUE)
    eigenval <- decomp$values
    eigenvect <- decomp$vectors
    eigenval <- pmax(0.00001*one, eigenval)
    load <- eigenvect*sqrt(kronecker(one,t(eigenval)))
    load <- load[,1:3]

    if (method=="exact")
    {
      lo <- load
      dim(lo) <- c(3*p,1)
      fn1 <- function(tt)
      {
        dim(tt) <- c(p,3)
        stress <- 0
        for(i in 1:p) for(k in 1:3)
        {
          int <- 0
          for(m in 1:p)
          {
            int <- int + tt[m,k]*(tt[m,1]*tt[i,1]+tt[m,2]*tt[i,2]+tt[m,3]*tt[i,3]-matcorp[m,i])/sqrt(tt[m,1]^2+tt[m,2]^2+tt[m,3]^2)
          }
          stress <- stress+abs(int)
        }
        stress
      }
      opt <- optim(lo,fn1,method="BFGS",control=list(maxit=20))
      convergence <- opt$convergence
      looptim <- opt$par
      stress.optim <- fn1(looptim)
      stress.non.optim <- fn1(lo)
      load <- looptim
      dim(load) <- c(p,3)
    }

    for(i in 1:p) load[i,] <- load[i,]/sqrt(sum(load[i,]^2))

    if (method=="dist" | method=="rscal")
    {
      m.to.o <- function(w)
      {
        x <- w[1] ; y <- w[2] ; z <- w[3]
        theta <- acos(z)
        if (z==1) phi <- 0
        if (z!=1 & y>=0) phi <- acos(x/sqrt(1-z^2))
        if (z!=1 & y<0) phi <- 2*pi-acos(x/sqrt(1-z^2))
        c(theta,phi)
      }
      o.to.m <- function(w)
      {
        theta <- w[1]
        phi <- w[2]
        z <- cos(theta)
        x <- sin(theta)*cos(phi)
        y <- sin(theta)*sin(phi)
        c(x,y,z)
      }
      o <- t(apply(load,1,m.to.o))
      dim(o) <- c(2*p,1)
      if(method=="dist") d <- sqrt(2*(1-matcorp))
      if(method=="rscal") d <- pi/2*(1-matcorp)
      fn2 <- function(ov)
      {
        dim(ov) <- c(p,2)
        m <- t(apply(ov,1,o.to.m))
        stress <- 0
        for(i in 1:p) for(j in 1:p)
        {if (j<i){
          delt <- sqrt((m[i,1]-m[j,1])^2+(m[i,2]-m[j,2])^2+(m[i,3]-m[j,3])^2)
          if (method=="dist") stress <- stress + (2*asin(delt/2)-2*asin(d[i,j]/2))^2
          if (method=="rscal") stress <- stress + (2*asin(delt/2)-d[i,j])^2
        }}
        stress
      }
      opt <- optim(o,fn2,method="BFGS",control=list(maxit=maxiter))
      convergence <- opt$convergence
      ooptim <- opt$par
      denom <- 1
      if (method=="dist") denom <- sum((2*asin(d/2))^2)
      stress.optim <- fn2(ooptim)/denom
      stress.non.optim <- fn2(o)/denom
      dim(ooptim) <- c(p,2)
      load <- t(apply(ooptim,1,o.to.m))
      resid.r <- matcorp
      for(i in 1:p) for(j in 1:p)
      {
        delt <- sqrt((load[i,1]-load[j,1])^2+(load[i,2]-load[j,2])^2+(load[i,3]-load[j,3])^2)
        if (method=="dist") resid.r[i,j] <- -(d[i,j]^2-delt^2)/2
        if (method=="rscal") resid.r[i,j] <- -(d[i,j]-delt)*2/pi
      }
      matcorest <- matcorp - resid.r
      or.cor <- matcorp
      dim(or.cor) <- c(p*p,1)
      est.cor <- matcorest
      dim(est.cor) <- c(p*p,1)
      rl <- lm(or.cor~est.cor)
      resmoy <- sum(abs(resid.r))/(p*(p-1))
    }

    pi <- 3.1415926
    v <- v*pi/180
    h <- h*pi/180
    f <- f*pi/180
    rotv <- matrix(c(cos(v),sin(v),0,-sin(v),cos(v),0,0,0,1),ncol=3)
    roth <- matrix(c(cos(h),0,sin(h),0,1,0,-sin(h),0,cos(h)),ncol=3)
    rotf <- matrix(c(1,0,0,0,cos(f),sin(f),0,-sin(f),cos(f)),ncol=3)
    rot <- rotv%*%roth%*%rotf

    load <- load%*%rot

    mp1m <- rbind(c(-0.3644843,-0.9310856),
                  c(-0.3852566,-0.922069),
                  c(-0.4045085,-0.912571),
                  c(-0.422164,-0.9026292),
                  c(-0.4381533,-0.8922827),
                  c(-0.4524135,-0.8815725),
                  c(-0.4648882,-0.8705407),
                  c(-0.4755283,-0.859231),
                  c(-0.4842916,-0.8476879),
                  c(-0.4911436,-0.835957),
                  c(-0.4960574,-0.8240846),
                  c(-0.4990134,-0.8121176),
                  c(-0.5,-0.8001032),
                  c(-0.4990134,-0.7880887),
                  c(-0.4960574,-0.7761217),
                  c(-0.4911436,-0.7642493),
                  c(-0.4842916,-0.7525184),
                  c(-0.4755283,-0.7409753),
                  c(-0.4648883,-0.7296656),
                  c(-0.4524136,-0.7186338),
                  c(-0.4381534,-0.7079236),
                  c(-0.422164,-0.6975771),
                  c(-0.4045085,-0.6876353),
                  c(-0.3852567,-0.6781374),
                  c(-0.3644844,-0.6691207),
                  c(-0.3422736,-0.660621),
                  c(-0.318712,-0.6526718),
                  c(-0.2938927,-0.6453044),
                  c(-0.2679134,-0.638548),
                  c(-0.2408769,-0.6324291),
                  c(-0.2128897,-0.626972),
                  c(-0.1840623,-0.6221981),
                  c(-0.1545086,-0.6181264),
                  c(-0.124345,-0.6147728),
                  c(-0.09369071,-0.6121506),
                  c(-0.06266667,-0.6102702),
                  c(-0.03139531,-0.609139),
                  c(-5.35898e-08,-0.6087614),
                  c(0.03139521,-0.609139),
                  c(0.06266656,-0.6102702),
                  c(0.0936906,-0.6121506),
                  c(0.1243449,-0.6147728),
                  c(0.1545084,-0.6181263),
                  c(0.1840622,-0.6221981),
                  c(0.2128896,-0.626972),
                  c(0.2408768,-0.6324291),
                  c(0.2679134,-0.638548),
                  c(0.2938926,-0.6453044),
                  c(0.318712,-0.6526718),
                  c(0.3422735,-0.660621),
                  c(0.3644843,-0.6691207),
                  c(0.3852566,-0.6781373),
                  c(0.4045085,-0.6876353),
                  c(0.4221639,-0.6975771),
                  c(0.4381533,-0.7079235),
                  c(0.4524135,-0.7186338),
                  c(0.4648882,-0.7296655),
                  c(0.4755283,-0.7409753),
                  c(0.4842916,-0.7525184),
                  c(0.4911436,-0.7642493),
                  c(0.4960574,-0.7761216),
                  c(0.4990134,-0.7880887),
                  c(0.5,-0.8001031),
                  c(0.4990134,-0.8121176),
                  c(0.4960574,-0.8240846),
                  c(0.4911437,-0.835957),
                  c(0.4842916,-0.8476879),
                  c(0.4755283,-0.859231),
                  c(0.4648883,-0.8705407),
                  c(0.4524136,-0.8815725),
                  c(0.4381534,-0.8922827),
                  c(0.422164,-0.9026291),
                  c(0.4045086,-0.912571),
                  c(0.3852567,-0.922069),
                  c(0.3644844,-0.9310855))
    mp1p <- rbind(c(0.3422736,-0.9395852),
                  c(0.318712,-0.9475345),
                  c(0.2938927,-0.9549018),
                  c(0.2679134,-0.9616583),
                  c(0.2408769,-0.9677772),
                  c(0.2128897,-0.9732343),
                  c(0.1840623,-0.9780082),
                  c(0.1545085,-0.98208),
                  c(0.124345,-0.9854335),
                  c(0.09369068,-0.9880557),
                  c(0.06266664,-0.989936),
                  c(0.03139529,-0.9910673),
                  c(2.67949e-08,-0.9914449),
                  c(-0.03139523,-0.9910673),
                  c(-0.06266659,-0.989936),
                  c(-0.09369063,-0.9880557),
                  c(-0.1243449,-0.9854335),
                  c(-0.1545085,-0.98208),
                  c(-0.1840623,-0.9780082),
                  c(-0.2128896,-0.9732343),
                  c(-0.2408768,-0.9677772),
                  c(-0.2679134,-0.9616583),
                  c(-0.2938926,-0.9549018),
                  c(-0.318712,-0.9475345),
                  c(-0.3422735,-0.9395853))
    mp2m <- rbind(c(-0.8506857,-0.5240405),
                  c(-0.8591965,-0.5034769),
                  c(-0.8643165,-0.4827494),
                  c(-0.8660254,-0.4619398),
                  c(-0.8643165,-0.4411302),
                  c(-0.8591965,-0.4204027),
                  c(-0.8506857,-0.3998391),
                  c(-0.8388176,-0.3795206),
                  c(-0.8236391,-0.3595274),
                  c(-0.8052101,-0.3399383),
                  c(-0.7836032,-0.3208308),
                  c(-0.7589039,-0.3022801),
                  c(-0.7312095,-0.2843595),
                  c(-0.7006293,-0.2671398),
                  c(-0.6672841,-0.2506888),
                  c(-0.6313054,-0.2350716),
                  c(-0.5928352,-0.2203497),
                  c(-0.5520254,-0.2065812),
                  c(-0.509037,-0.1938206),
                  c(-0.4640397,-0.182118),
                  c(-0.417211,-0.1715199),
                  c(-0.3687358,-0.1620678),
                  c(-0.3188053,-0.1537992),
                  c(-0.2676167,-0.1467467),
                  c(-0.2153718,-0.1409382),
                  c(-0.1622771,-0.1363964),
                  c(-0.1085419,-0.1331395),
                  c(-0.05437828,-0.1311802),
                  c(-9.282025e-08,-0.1305262),
                  c(0.05437818,-0.1311802),
                  c(0.1085418,-0.1331395),
                  c(0.162277,-0.1363964),
                  c(0.2153718,-0.1409382),
                  c(0.2676166,-0.1467467),
                  c(0.3188052,-0.1537992),
                  c(0.3687357,-0.1620678),
                  c(0.4172109,-0.1715198),
                  c(0.4640396,-0.182118),
                  c(0.509037,-0.1938205),
                  c(0.5520254,-0.2065812),
                  c(0.5928352,-0.2203497),
                  c(0.6313053,-0.2350716),
                  c(0.667284,-0.2506888),
                  c(0.7006293,-0.2671397),
                  c(0.7312094,-0.2843595),
                  c(0.7589038,-0.30228),
                  c(0.7836032,-0.3208307),
                  c(0.80521,-0.3399383),
                  c(0.8236391,-0.3595273),
                  c(0.8388176,-0.3795205),
                  c(0.8506857,-0.399839),
                  c(0.8591965,-0.4204026),
                  c(0.8643165,-0.4411301),
                  c(0.8660254,-0.4619398),
                  c(0.8643165,-0.4827494),
                  c(0.8591965,-0.5034769),
                  c(0.8506857,-0.5240405))
    mp2p <- rbind(c(0.8388176,-0.544359),
                  c(0.8236391,-0.5643522),
                  c(0.80521,-0.5839412),
                  c(0.7836032,-0.6030488),
                  c(0.7589039,-0.6215995),
                  c(0.7312095,-0.63952),
                  c(0.7006293,-0.6567398),
                  c(0.6672841,-0.6731907),
                  c(0.6313054,-0.688808),
                  c(0.5928352,-0.7035298),
                  c(0.5520254,-0.7172983),
                  c(0.509037,-0.730059),
                  c(0.4640397,-0.7417615),
                  c(0.417211,-0.7523597),
                  c(0.3687357,-0.7618117),
                  c(0.3188053,-0.7700803),
                  c(0.2676166,-0.7771328),
                  c(0.2153718,-0.7829414),
                  c(0.162277,-0.7874831),
                  c(0.1085418,-0.79074),
                  c(0.05437823,-0.7926994),
                  c(4.641012e-08,-0.7933533),
                  c(-0.05437814,-0.7926994),
                  c(-0.1085417,-0.79074),
                  c(-0.1622769,-0.7874831),
                  c(-0.2153717,-0.7829414),
                  c(-0.2676165,-0.7771328),
                  c(-0.3188052,-0.7700803),
                  c(-0.3687356,-0.7618117),
                  c(-0.4172109,-0.7523597),
                  c(-0.4640396,-0.7417615),
                  c(-0.5090369,-0.730059),
                  c(-0.5520253,-0.7172983),
                  c(-0.5928351,-0.7035299),
                  c(-0.6313053,-0.688808),
                  c(-0.667284,-0.6731907),
                  c(-0.7006292,-0.6567398),
                  c(-0.7312094,-0.63952),
                  c(-0.7589038,-0.6215995),
                  c(-0.7836032,-0.6030488),
                  c(-0.80521,-0.5839413),
                  c(-0.8236391,-0.5643522),
                  c(-0.8388176,-0.544359))
    mp3m <- rbind(c(-0.9980267,0.02402886),
                  c(-0.9921147,0.04796292),
                  c(-0.9822873,0.07170769),
                  c(-0.9685832,0.09516947),
                  c(-0.9510565,0.1182557),
                  c(-0.9297765,0.1408751),
                  c(-0.904827,0.1629386),
                  c(-0.8763067,0.1843591),
                  c(-0.844328,0.205052),
                  c(-0.809017,0.2249356),
                  c(-0.7705133,0.2439316),
                  c(-0.7289687,0.2619648),
                  c(-0.6845472,0.2789642),
                  c(-0.637424,0.2948626),
                  c(-0.5877853,0.3095974),
                  c(-0.5358269,0.3231103),
                  c(-0.4817538,0.335348),
                  c(-0.4257794,0.3462623),
                  c(-0.3681246,0.35581),
                  c(-0.3090171,0.3639536),
                  c(-0.24869,0.3706607),
                  c(-0.1873814,0.375905),
                  c(-0.1253333,0.3796658),
                  c(-0.06279063,0.3819283),
                  c(-1.071796e-07,0.3826834),
                  c(0.06279052,0.3819283),
                  c(0.1253332,0.3796659),
                  c(0.1873813,0.3759051),
                  c(0.2486899,0.3706607),
                  c(0.309017,0.3639536),
                  c(0.3681245,0.3558101),
                  c(0.4257793,0.3462623),
                  c(0.4817537,0.335348),
                  c(0.5358268,0.3231103),
                  c(0.5877852,0.3095974),
                  c(0.637424,0.2948627),
                  c(0.6845471,0.2789642),
                  c(0.7289686,0.2619648),
                  c(0.7705132,0.2439316),
                  c(0.809017,0.2249357),
                  c(0.844328,0.205052),
                  c(0.8763067,0.1843592),
                  c(0.904827,0.1629387),
                  c(0.9297765,0.1408752),
                  c(0.9510565,0.1182557),
                  c(0.9685832,0.0951695),
                  c(0.9822872,0.07170773),
                  c(0.9921147,0.04796296),
                  c(0.9980267,0.0240289),
                  c(1,1.025396e-08))
    mp3p <- rbind(c(0.9980267,-0.02402888),
                  c(0.9921147,-0.04796294),
                  c(0.9822873,-0.07170771),
                  c(0.9685832,-0.09516949),
                  c(0.9510565,-0.1182557),
                  c(0.9297765,-0.1408752),
                  c(0.904827,-0.1629387),
                  c(0.8763067,-0.1843591),
                  c(0.844328,-0.205052),
                  c(0.809017,-0.2249357),
                  c(0.7705133,-0.2439316),
                  c(0.7289687,-0.2619648),
                  c(0.6845471,-0.2789642),
                  c(0.637424,-0.2948626),
                  c(0.5877853,-0.3095974),
                  c(0.5358268,-0.3231103),
                  c(0.4817537,-0.335348),
                  c(0.4257793,-0.3462623),
                  c(0.3681246,-0.35581),
                  c(0.309017,-0.3639536),
                  c(0.2486899,-0.3706607),
                  c(0.1873814,-0.375905),
                  c(0.1253333,-0.3796659),
                  c(0.06279057,-0.3819283),
                  c(5.358979e-08,-0.3826834),
                  c(-0.06279046,-0.3819283),
                  c(-0.1253332,-0.3796659),
                  c(-0.1873813,-0.3759051),
                  c(-0.2486898,-0.3706607),
                  c(-0.3090169,-0.3639536),
                  c(-0.3681245,-0.3558101),
                  c(-0.4257792,-0.3462623),
                  c(-0.4817536,-0.3353481),
                  c(-0.5358267,-0.3231103),
                  c(-0.5877852,-0.3095974),
                  c(-0.637424,-0.2948627),
                  c(-0.684547,-0.2789642),
                  c(-0.7289686,-0.2619649),
                  c(-0.7705132,-0.2439316),
                  c(-0.809017,-0.2249357),
                  c(-0.8443279,-0.2050521),
                  c(-0.8763066,-0.1843592),
                  c(-0.904827,-0.1629387),
                  c(-0.9297765,-0.1408752),
                  c(-0.9510565,-0.1182557),
                  c(-0.9685831,-0.09516953),
                  c(-0.9822872,-0.07170775),
                  c(-0.9921147,-0.04796298),
                  c(-0.9980267,-0.02402892),
                  c(-1,-3.076189e-08))
    mp4m <- rbind(c(-0.8388176,0.5443589),
                  c(-0.8236391,0.5643522),
                  c(-0.8052101,0.5839412),
                  c(-0.7836032,0.6030488),
                  c(-0.7589039,0.6215994),
                  c(-0.7312095,0.63952),
                  c(-0.7006293,0.6567397),
                  c(-0.6672841,0.6731907),
                  c(-0.6313054,0.688808),
                  c(-0.5928352,0.7035298),
                  c(-0.5520254,0.7172983),
                  c(-0.509037,0.730059),
                  c(-0.4640397,0.7417615),
                  c(-0.417211,0.7523597),
                  c(-0.3687358,0.7618117),
                  c(-0.3188053,0.7700803),
                  c(-0.2676167,0.7771328),
                  c(-0.2153718,0.7829414),
                  c(-0.1622771,0.7874831),
                  c(-0.1085419,0.79074),
                  c(-0.05437828,0.7926994),
                  c(-9.282025e-08,0.7933533),
                  c(0.05437818,0.7926994),
                  c(0.1085418,0.79074),
                  c(0.162277,0.7874831),
                  c(0.2153718,0.7829414),
                  c(0.2676166,0.7771328),
                  c(0.3188052,0.7700803),
                  c(0.3687357,0.7618117),
                  c(0.4172109,0.7523597),
                  c(0.4640396,0.7417615),
                  c(0.509037,0.730059),
                  c(0.5520254,0.7172983),
                  c(0.5928352,0.7035299),
                  c(0.6313053,0.688808),
                  c(0.667284,0.6731907),
                  c(0.7006293,0.6567398),
                  c(0.7312094,0.63952),
                  c(0.7589038,0.6215995),
                  c(0.7836032,0.6030488),
                  c(0.80521,0.5839412),
                  c(0.8236391,0.5643522),
                  c(0.8388176,0.544359))
    mp4p <- rbind(c(0.8506857,0.5240405),
                  c(0.8591965,0.5034769),
                  c(0.8643165,0.4827494),
                  c(0.8660254,0.4619398),
                  c(0.8643165,0.4411301),
                  c(0.8591965,0.4204026),
                  c(0.8506857,0.3998391),
                  c(0.8388176,0.3795206),
                  c(0.8236391,0.3595273),
                  c(0.80521,0.3399383),
                  c(0.7836032,0.3208307),
                  c(0.7589039,0.3022801),
                  c(0.7312095,0.2843595),
                  c(0.7006293,0.2671398),
                  c(0.6672841,0.2506888),
                  c(0.6313054,0.2350716),
                  c(0.5928352,0.2203497),
                  c(0.5520254,0.2065812),
                  c(0.509037,0.1938206),
                  c(0.4640397,0.182118),
                  c(0.417211,0.1715198),
                  c(0.3687357,0.1620678),
                  c(0.3188053,0.1537992),
                  c(0.2676166,0.1467467),
                  c(0.2153718,0.1409382),
                  c(0.162277,0.1363964),
                  c(0.1085418,0.1331395),
                  c(0.05437823,0.1311802),
                  c(4.641012e-08,0.1305262),
                  c(-0.05437814,0.1311802),
                  c(-0.1085417,0.1331395),
                  c(-0.1622769,0.1363964),
                  c(-0.2153717,0.1409382),
                  c(-0.2676165,0.1467467),
                  c(-0.3188052,0.1537992),
                  c(-0.3687356,0.1620678),
                  c(-0.4172109,0.1715198),
                  c(-0.4640396,0.182118),
                  c(-0.5090369,0.1938205),
                  c(-0.5520253,0.2065812),
                  c(-0.5928351,0.2203496),
                  c(-0.6313053,0.2350715),
                  c(-0.667284,0.2506888),
                  c(-0.7006292,0.2671397),
                  c(-0.7312094,0.2843595),
                  c(-0.7589038,0.30228),
                  c(-0.7836032,0.3208307),
                  c(-0.80521,0.3399383),
                  c(-0.8236391,0.3595273),
                  c(-0.8388176,0.3795205),
                  c(-0.8506857,0.399839),
                  c(-0.8591965,0.4204026),
                  c(-0.8643165,0.4411301),
                  c(-0.8660254,0.4619397),
                  c(-0.8643165,0.4827494),
                  c(-0.8591965,0.5034769),
                  c(-0.8506857,0.5240404))
    mp5m <- rbind(c(-0.3422736,0.9395852),
                  c(-0.318712,0.9475345),
                  c(-0.2938927,0.9549018),
                  c(-0.2679134,0.9616583),
                  c(-0.2408769,0.9677772),
                  c(-0.2128897,0.9732343),
                  c(-0.1840623,0.9780082),
                  c(-0.1545086,0.98208),
                  c(-0.124345,0.9854335),
                  c(-0.09369071,0.9880557),
                  c(-0.06266667,0.989936),
                  c(-0.03139531,0.9910673),
                  c(-5.35898e-08,0.9914449),
                  c(0.03139526,0.9910673),
                  c(0.06266662,0.989936),
                  c(0.09369066,0.9880557),
                  c(0.1243449,0.9854335),
                  c(0.1545085,0.98208),
                  c(0.1840623,0.9780082),
                  c(0.2128896,0.9732343),
                  c(0.2408768,0.9677772),
                  c(0.2679134,0.9616583),
                  c(0.2938926,0.9549018),
                  c(0.318712,0.9475345),
                  c(0.3422736,0.9395853))
    mp5p <- rbind(c(0.3644843,0.9310856),
                  c(0.3852566,0.922069),
                  c(0.4045085,0.912571),
                  c(0.422164,0.9026292),
                  c(0.4381533,0.8922827),
                  c(0.4524135,0.8815725),
                  c(0.4648883,0.8705407),
                  c(0.4755283,0.859231),
                  c(0.4842916,0.8476879),
                  c(0.4911436,0.835957),
                  c(0.4960574,0.8240846),
                  c(0.4990134,0.8121176),
                  c(0.5,0.8001031),
                  c(0.4990134,0.7880887),
                  c(0.4960574,0.7761217),
                  c(0.4911436,0.7642493),
                  c(0.4842916,0.7525184),
                  c(0.4755283,0.7409753),
                  c(0.4648883,0.7296656),
                  c(0.4524135,0.7186338),
                  c(0.4381534,0.7079236),
                  c(0.422164,0.6975771),
                  c(0.4045085,0.6876353),
                  c(0.3852566,0.6781373),
                  c(0.3644843,0.6691207),
                  c(0.3422736,0.660621),
                  c(0.318712,0.6526718),
                  c(0.2938927,0.6453044),
                  c(0.2679134,0.638548),
                  c(0.2408769,0.6324291),
                  c(0.2128897,0.626972),
                  c(0.1840623,0.6221981),
                  c(0.1545085,0.6181264),
                  c(0.124345,0.6147728),
                  c(0.09369068,0.6121506),
                  c(0.06266664,0.6102702),
                  c(0.03139529,0.609139),
                  c(2.67949e-08,0.6087614),
                  c(-0.03139523,0.609139),
                  c(-0.06266659,0.6102702),
                  c(-0.09369063,0.6121506),
                  c(-0.1243449,0.6147728),
                  c(-0.1545085,0.6181263),
                  c(-0.1840623,0.6221981),
                  c(-0.2128896,0.626972),
                  c(-0.2408768,0.6324291),
                  c(-0.2679134,0.638548),
                  c(-0.2938926,0.6453044),
                  c(-0.318712,0.6526718),
                  c(-0.3422735,0.660621),
                  c(-0.3644843,0.6691207),
                  c(-0.3852566,0.6781373),
                  c(-0.4045085,0.6876353),
                  c(-0.422164,0.6975771),
                  c(-0.4381533,0.7079236),
                  c(-0.4524135,0.7186338),
                  c(-0.4648882,0.7296655),
                  c(-0.4755283,0.7409753),
                  c(-0.4842916,0.7525184),
                  c(-0.4911436,0.7642493),
                  c(-0.4960574,0.7761216),
                  c(-0.4990134,0.7880887),
                  c(-0.5,0.8001031),
                  c(-0.4990134,0.8121176),
                  c(-0.4960574,0.8240846),
                  c(-0.4911436,0.835957),
                  c(-0.4842916,0.8476879),
                  c(-0.4755283,0.859231),
                  c(-0.4648883,0.8705407),
                  c(-0.4524136,0.8815725),
                  c(-0.4381534,0.8922827),
                  c(-0.422164,0.9026291),
                  c(-0.4045085,0.912571),
                  c(-0.3852567,0.922069),
                  c(-0.3644844,0.9310855))
    mq1m <- rbind(c(-0.08933569,-0.9959537),
                  c(-0.07561703,-0.9946018),
                  c(-0.06159996,-0.9893246),
                  c(-0.04733977,-0.980143),
                  c(-0.03289276,-0.9670934),
                  c(-0.01831593,-0.950227),
                  c(-0.003666819,-0.9296104),
                  c(0.01099676,-0.9053252),
                  c(0.02561695,-0.877467),
                  c(0.04013603,-0.8461459),
                  c(0.05449672,-0.8114854),
                  c(0.06864233,-0.7736224),
                  c(0.08251704,-0.7327062),
                  c(0.0960661,-0.6888984),
                  c(0.109236,-0.6423718),
                  c(0.1219748,-0.59331),
                  c(0.1342323,-0.5419067),
                  c(0.14596,-0.4883648),
                  c(0.1571116,-0.4328955),
                  c(0.1676432,-0.3757178),
                  c(0.1775132,-0.3170573),
                  c(0.1866827,-0.2571455),
                  c(0.1951153,-0.1962189),
                  c(0.202778,-0.1345179),
                  c(0.2096404,-0.07228599),
                  c(0.2156754,-0.009768815),
                  c(0.2208592,0.05278702),
                  c(0.2251715,0.1151344),
                  c(0.228595,0.1770274),
                  c(0.2311164,0.2382218),
                  c(0.2327257,0.298476),
                  c(0.2334166,0.3575523),
                  c(0.2331862,0.4152174),
                  c(0.2320356,0.4712439),
                  c(0.2299692,0.5254107),
                  c(0.2269952,0.5775038),
                  c(0.2231254,0.6273178),
                  c(0.2183751,0.6746561),
                  c(0.2127629,0.7193318),
                  c(0.206311,0.7611687),
                  c(0.1990449,0.8000015),
                  c(0.1909933,0.8356772),
                  c(0.1821879,0.8680547),
                  c(0.1726634,0.8970065),
                  c(0.1624576,0.9224182),
                  c(0.1516106,0.9441895),
                  c(0.1401653,0.9622346),
                  c(0.1281668,0.9764821),
                  c(0.1156625,0.986876),
                  c(0.1027018,0.993375))
    mq1p <- rbind(c(0.08933568,0.9959537),
                  c(0.07561702,0.9946018),
                  c(0.06159994,0.9893246),
                  c(0.04733976,0.980143),
                  c(0.03289274,0.9670933),
                  c(0.01831592,0.950227),
                  c(0.003666807,0.9296104),
                  c(-0.01099678,0.9053252),
                  c(-0.02561696,0.877467),
                  c(-0.04013604,0.8461458),
                  c(-0.05449673,0.8114854),
                  c(-0.06864234,0.7736223),
                  c(-0.08251705,0.7327061),
                  c(-0.09606611,0.6888983),
                  c(-0.109236,0.6423717),
                  c(-0.1219749,0.59331),
                  c(-0.1342323,0.5419067),
                  c(-0.14596,0.4883648),
                  c(-0.1571116,0.4328955),
                  c(-0.1676432,0.3757178),
                  c(-0.1775132,0.3170572),
                  c(-0.1866827,0.2571455),
                  c(-0.1951153,0.1962188),
                  c(-0.202778,0.1345178),
                  c(-0.2096404,0.07228593),
                  c(-0.2156754,0.009768761),
                  c(-0.2208592,-0.05278696),
                  c(-0.2251715,-0.1151344),
                  c(-0.228595,-0.1770274),
                  c(-0.2311164,-0.2382217),
                  c(-0.2327257,-0.298476),
                  c(-0.2334166,-0.3575522),
                  c(-0.2331862,-0.4152174),
                  c(-0.2320356,-0.4712439),
                  c(-0.2299692,-0.5254106),
                  c(-0.2269952,-0.5775038),
                  c(-0.2231254,-0.6273178),
                  c(-0.2183751,-0.6746561),
                  c(-0.2127629,-0.7193318),
                  c(-0.206311,-0.7611686),
                  c(-0.1990449,-0.8000015),
                  c(-0.1909933,-0.8356771),
                  c(-0.1821879,-0.8680547),
                  c(-0.1726635,-0.8970065),
                  c(-0.1624576,-0.9224182),
                  c(-0.1516106,-0.9441895),
                  c(-0.1401653,-0.9622346),
                  c(-0.1281668,-0.9764821),
                  c(-0.1156625,-0.986876),
                  c(-0.1027018,-0.993375))
    mq2m <- rbind(c(-0.2585898,-0.9658733),
                  c(-0.2249357,-0.9720312),
                  c(-0.1903939,-0.9743529),
                  c(-0.1551007,-0.9728293),
                  c(-0.1191954,-0.9674663),
                  c(-0.08281971,-0.9582853),
                  c(-0.04611715,-0.9453223),
                  c(-0.009232576,-0.9286285),
                  c(0.02768843,-0.9082699),
                  c(0.06450016,-0.8843268),
                  c(0.1010573,-0.8568936),
                  c(0.1372157,-0.8260786),
                  c(0.1728325,-0.7920035),
                  c(0.2077672,-0.7548028),
                  c(0.241882,-0.7146231),
                  c(0.2750422,-0.6716232),
                  c(0.3071169,-0.6259727),
                  c(0.3379796,-0.5778517),
                  c(0.3675084,-0.5274503),
                  c(0.3955868,-0.4749672),
                  c(0.422104,-0.4206096),
                  c(0.4469554,-0.3645921),
                  c(0.4700428,-0.3071358),
                  c(0.4912752,-0.2484673),
                  c(0.5105688,-0.1888182),
                  c(0.5278473,-0.1284239),
                  c(0.5430427,-0.06752279),
                  c(0.556095,-0.006355103),
                  c(0.5669526,0.05483756),
                  c(0.5755727,0.1158138),
                  c(0.5819213,0.176333),
                  c(0.5859733,0.2361563),
                  c(0.5877127,0.2950475),
                  c(0.5871327,0.3527744),
                  c(0.5842356,0.409109),
                  c(0.5790327,0.4638291),
                  c(0.5715447,0.5167186),
                  c(0.561801,0.5675689),
                  c(0.5498402,0.6161792),
                  c(0.5357094,0.6623578),
                  c(0.5194644,0.7059223),
                  c(0.5011693,0.7467009),
                  c(0.4808963,0.7845326),
                  c(0.4587255,0.8192681),
                  c(0.4347442,0.8507703),
                  c(0.4090473,0.878915),
                  c(0.381736,0.903591),
                  c(0.3529182,0.9247008),
                  c(0.3227075,0.9421613),
                  c(0.2912233,0.9559036))
    mq2p <- rbind(c(0.2585898,0.9658733),
                  c(0.2249357,0.9720312),
                  c(0.1903939,0.9743529),
                  c(0.1551007,0.9728293),
                  c(0.1191954,0.9674663),
                  c(0.08281968,0.9582853),
                  c(0.04611711,0.9453223),
                  c(0.009232545,0.9286285),
                  c(-0.02768846,0.9082699),
                  c(-0.06450019,0.8843267),
                  c(-0.1010574,0.8568936),
                  c(-0.1372157,0.8260786),
                  c(-0.1728325,0.7920035),
                  c(-0.2077673,0.7548027),
                  c(-0.241882,0.7146231),
                  c(-0.2750422,0.6716232),
                  c(-0.3071169,0.6259726),
                  c(-0.3379796,0.5778517),
                  c(-0.3675084,0.5274502),
                  c(-0.3955868,0.4749671),
                  c(-0.422104,0.4206096),
                  c(-0.4469554,0.3645921),
                  c(-0.4700428,0.3071357),
                  c(-0.4912752,0.2484672),
                  c(-0.5105688,0.1888181),
                  c(-0.5278473,0.1284238),
                  c(-0.5430427,0.06752274),
                  c(-0.556095,0.006355155),
                  c(-0.5669526,-0.05483751),
                  c(-0.5755727,-0.1158138),
                  c(-0.5819213,-0.1763329),
                  c(-0.5859733,-0.2361562),
                  c(-0.5877127,-0.2950475),
                  c(-0.5871327,-0.3527743),
                  c(-0.5842356,-0.409109),
                  c(-0.5790327,-0.463829),
                  c(-0.5715447,-0.5167185),
                  c(-0.561801,-0.5675688),
                  c(-0.5498402,-0.6161792),
                  c(-0.5357094,-0.6623577),
                  c(-0.5194644,-0.7059223),
                  c(-0.5011693,-0.7467009),
                  c(-0.4808964,-0.7845326),
                  c(-0.4587255,-0.8192681),
                  c(-0.4347443,-0.8507703),
                  c(-0.4090473,-0.878915),
                  c(-0.381736,-0.903591),
                  c(-0.3529182,-0.9247008),
                  c(-0.3227075,-0.9421613),
                  c(-0.2912233,-0.9559036))
    mq3m <- rbind(c(-0.5119424,-0.8588672),
                  c(-0.468119,-0.8819633),
                  c(-0.422448,-0.9015786),
                  c(-0.3751099,-0.9176358),
                  c(-0.3262913,-0.9300715),
                  c(-0.2761851,-0.9388367),
                  c(-0.2249888,-0.9438967),
                  c(-0.1729047,-0.9452315),
                  c(-0.1201381,-0.942836),
                  c(-0.06689744,-0.9367196),
                  c(-0.01339276,-0.9269063),
                  c(0.04016478,-0.913435),
                  c(0.09356381,-0.8963587),
                  c(0.1465936,-0.8757449),
                  c(0.1990448,-0.851675),
                  c(0.2507105,-0.8242438),
                  c(0.3013868,-0.7935598),
                  c(0.3508736,-0.759744),
                  c(0.3989757,-0.7229297),
                  c(0.4455032,-0.6832625),
                  c(0.4902725,-0.6408987),
                  c(0.5331069,-0.5960055),
                  c(0.5738374,-0.5487602),
                  c(0.6123033,-0.4993492),
                  c(0.6483526,-0.4479675),
                  c(0.6818432,-0.3948179),
                  c(0.7126429,-0.3401101),
                  c(0.74063,-0.28406),
                  c(0.7656943,-0.2268889),
                  c(0.7877368,-0.1688223),
                  c(0.8066704,-0.1100894),
                  c(0.8224204,-0.05092216),
                  c(0.8349247,0.008446087),
                  c(0.844134,0.067781),
                  c(0.8500118,0.1268484),
                  c(0.852535,0.1854152),
                  c(0.8516936,0.2432503),
                  c(0.847491,0.3001253),
                  c(0.8399438,0.3558159),
                  c(0.8290816,0.4101023),
                  c(0.8149475,0.4627701),
                  c(0.7975971,0.5136117),
                  c(0.777099,0.5624262),
                  c(0.753534,0.6090211),
                  c(0.7269952,0.6532124),
                  c(0.6975873,0.6948259),
                  c(0.6654263,0.7336972),
                  c(0.6306392,0.7696729),
                  c(0.5933632,0.802611),
                  c(0.5537455,0.8323816))
    mq3p <- rbind(c(0.5119424,0.8588672),
                  c(0.4681189,0.8819633),
                  c(0.422448,0.9015786),
                  c(0.3751098,0.9176358),
                  c(0.3262913,0.9300715),
                  c(0.276185,0.9388367),
                  c(0.2249888,0.9438967),
                  c(0.1729046,0.9452315),
                  c(0.1201381,0.942836),
                  c(0.0668974,0.9367195),
                  c(0.01339271,0.9269063),
                  c(-0.04016483,0.913435),
                  c(-0.09356386,0.8963586),
                  c(-0.1465936,0.8757449),
                  c(-0.1990449,0.851675),
                  c(-0.2507106,0.8242438),
                  c(-0.3013868,0.7935598),
                  c(-0.3508736,0.7597439),
                  c(-0.3989757,0.7229297),
                  c(-0.4455032,0.6832624),
                  c(-0.4902725,0.6408986),
                  c(-0.533107,0.5960055),
                  c(-0.5738375,0.5487602),
                  c(-0.6123033,0.4993492),
                  c(-0.6483526,0.4479674),
                  c(-0.6818432,0.3948178),
                  c(-0.7126429,0.34011),
                  c(-0.7406301,0.2840599),
                  c(-0.7656944,0.2268888),
                  c(-0.7877368,0.1688223),
                  c(-0.8066704,0.1100895),
                  c(-0.8224204,0.05092221),
                  c(-0.8349247,-0.008446036),
                  c(-0.844134,-0.06778095),
                  c(-0.8500117,-0.1268484),
                  c(-0.852535,-0.1854152),
                  c(-0.8516936,-0.2432502),
                  c(-0.847491,-0.3001253),
                  c(-0.8399438,-0.3558159),
                  c(-0.8290817,-0.4101022),
                  c(-0.8149475,-0.4627701),
                  c(-0.7975972,-0.5136116),
                  c(-0.777099,-0.5624261),
                  c(-0.7535341,-0.609021),
                  c(-0.7269953,-0.6532124),
                  c(-0.6975873,-0.6948258),
                  c(-0.6654263,-0.7336971),
                  c(-0.6306392,-0.7696728),
                  c(-0.5933632,-0.802611),
                  c(-0.5537455,-0.8323816))
    mq4m <- rbind(c(-0.8388176,0.5443589),
                  c(-0.8236391,0.5643522),
                  c(-0.8052101,0.5839412),
                  c(-0.7836032,0.6030488),
                  c(-0.7589039,0.6215994),
                  c(-0.7312095,0.63952),
                  c(-0.7006293,0.6567397),
                  c(-0.6672841,0.6731907),
                  c(-0.6313054,0.688808),
                  c(-0.5928352,0.7035298),
                  c(-0.5520254,0.7172983),
                  c(-0.509037,0.730059),
                  c(-0.4640397,0.7417615),
                  c(-0.417211,0.7523597),
                  c(-0.3687358,0.7618117),
                  c(-0.3188053,0.7700803),
                  c(-0.2676167,0.7771328),
                  c(-0.2153718,0.7829414),
                  c(-0.1622771,0.7874831),
                  c(-0.1085419,0.79074),
                  c(-0.05437828,0.7926994),
                  c(-9.282025e-08,0.7933533),
                  c(0.05437818,0.7926994),
                  c(0.1085418,0.79074),
                  c(0.162277,0.7874831),
                  c(0.2153718,0.7829414),
                  c(0.2676166,0.7771328),
                  c(0.3188052,0.7700803),
                  c(0.3687357,0.7618117),
                  c(0.4172109,0.7523597),
                  c(0.4640396,0.7417615),
                  c(0.509037,0.730059),
                  c(0.5520254,0.7172983),
                  c(0.5928352,0.7035299),
                  c(0.6313053,0.688808),
                  c(0.667284,0.6731907),
                  c(0.7006293,0.6567398),
                  c(0.7312094,0.63952),
                  c(0.7589038,0.6215995),
                  c(0.7836032,0.6030488),
                  c(0.80521,0.5839412),
                  c(0.8236391,0.5643522),
                  c(0.8388176,0.544359))
    mq4p <- rbind(c(0.8506857,0.5240405),
                  c(0.8591965,0.5034769),
                  c(0.8643165,0.4827494),
                  c(0.8660254,0.4619398),
                  c(0.8643165,0.4411301),
                  c(0.8591965,0.4204026),
                  c(0.8506857,0.3998391),
                  c(0.8388176,0.3795206),
                  c(0.8236391,0.3595273),
                  c(0.80521,0.3399383),
                  c(0.7836032,0.3208307),
                  c(0.7589039,0.3022801),
                  c(0.7312095,0.2843595),
                  c(0.7006293,0.2671398),
                  c(0.6672841,0.2506888),
                  c(0.6313054,0.2350716),
                  c(0.5928352,0.2203497),
                  c(0.5520254,0.2065812),
                  c(0.509037,0.1938206),
                  c(0.4640397,0.182118),
                  c(0.417211,0.1715198),
                  c(0.3687357,0.1620678),
                  c(0.3188053,0.1537992),
                  c(0.2676166,0.1467467),
                  c(0.2153718,0.1409382),
                  c(0.162277,0.1363964),
                  c(0.1085418,0.1331395),
                  c(0.05437823,0.1311802),
                  c(4.641012e-08,0.1305262),
                  c(-0.05437814,0.1311802),
                  c(-0.1085417,0.1331395),
                  c(-0.1622769,0.1363964),
                  c(-0.2153717,0.1409382),
                  c(-0.2676165,0.1467467),
                  c(-0.3188052,0.1537992),
                  c(-0.3687356,0.1620678),
                  c(-0.4172109,0.1715198),
                  c(-0.4640396,0.182118),
                  c(-0.5090369,0.1938205),
                  c(-0.5520253,0.2065812),
                  c(-0.5928351,0.2203496),
                  c(-0.6313053,0.2350715),
                  c(-0.667284,0.2506888),
                  c(-0.7006292,0.2671397),
                  c(-0.7312094,0.2843595),
                  c(-0.7589038,0.30228),
                  c(-0.7836032,0.3208307),
                  c(-0.80521,0.3399383),
                  c(-0.8236391,0.3595273),
                  c(-0.8388176,0.3795205),
                  c(-0.8506857,0.399839),
                  c(-0.8591965,0.4204026),
                  c(-0.8643165,0.4411301),
                  c(-0.8660254,0.4619397),
                  c(-0.8643165,0.4827494),
                  c(-0.8591965,0.5034769),
                  c(-0.8506857,0.5240404))
    mq5m <- rbind(c(-0.873215,0.4866767),
                  c(-0.8983527,0.4360888),
                  c(-0.919945,0.3837799),
                  c(-0.9379066,0.3299563),
                  c(-0.9521668,0.2748306),
                  c(-0.9626692,0.2186202),
                  c(-0.9693724,0.1615471),
                  c(-0.97225,0.1038364),
                  c(-0.9712905,0.04571585),
                  c(-0.9664977,-0.01258507),
                  c(-0.9578907,-0.07083633),
                  c(-0.9455033,-0.128808),
                  c(-0.9293844,-0.1862714),
                  c(-0.9095977,-0.2429996),
                  c(-0.8862212,-0.2987688),
                  c(-0.8593471,-0.3533589),
                  c(-0.8290817,-0.4065545),
                  c(-0.7955442,-0.4581456),
                  c(-0.7588671,-0.5079286),
                  c(-0.7191951,-0.555707),
                  c(-0.6766847,-0.6012923),
                  c(-0.6315038,-0.6445046),
                  c(-0.5838306,-0.6851733),
                  c(-0.5338533,-0.723138),
                  c(-0.4817692,-0.7582487),
                  c(-0.4277837,-0.790367),
                  c(-0.3721099,-0.8193661),
                  c(-0.3149676,-0.8451315),
                  c(-0.2565823,-0.8675616),
                  c(-0.1971843,-0.8865678),
                  c(-0.1370082,-0.902075),
                  c(-0.07629134,-0.9140223),
                  c(-0.0152734,-0.9223623),
                  c(0.04580482,-0.9270622),
                  c(0.1067023,-0.9281034),
                  c(0.1671786,-0.9254818),
                  c(0.2269952,-0.9192077),
                  c(0.2859159,-0.9093059),
                  c(0.3437082,-0.8958155),
                  c(0.4001441,-0.8787898),
                  c(0.4550008,-0.8582958),
                  c(0.5080618,-0.8344146),
                  c(0.5591177,-0.8072403),
                  c(0.6079671,-0.7768802),
                  c(0.654417,-0.7434541),
                  c(0.6982844,-0.707094),
                  c(0.7393958,-0.6679432),
                  c(0.7775893,-0.6261564),
                  c(0.8127139,-0.5818984),
                  c(0.8446311,-0.535344))
    mq5p <- rbind(c(0.873215,-0.4866768),
                  c(0.8983526,-0.4360889),
                  c(0.919945,-0.3837798),
                  c(0.9379066,-0.3299563),
                  c(0.9521668,-0.2748305),
                  c(0.9626692,-0.2186202),
                  c(0.9693724,-0.161547),
                  c(0.97225,-0.1038363),
                  c(0.9712905,-0.0457158),
                  c(0.9664977,0.01258512),
                  c(0.9578907,0.07083638),
                  c(0.9455033,0.1288081),
                  c(0.9293844,0.1862714),
                  c(0.9095976,0.2429997),
                  c(0.8862211,0.2987689),
                  c(0.8593471,0.353359),
                  c(0.8290817,0.4065546),
                  c(0.7955442,0.4581456),
                  c(0.758867,0.5079286),
                  c(0.719195,0.555707),
                  c(0.6766847,0.6012924),
                  c(0.6315038,0.6445046),
                  c(0.5838306,0.6851733),
                  c(0.5338533,0.723138),
                  c(0.4817691,0.7582487),
                  c(0.4277836,0.790367),
                  c(0.3721099,0.8193661),
                  c(0.3149676,0.8451315),
                  c(0.2565822,0.8675616),
                  c(0.1971843,0.8865678),
                  c(0.1370081,0.902075),
                  c(0.07629129,0.9140223),
                  c(0.01527335,0.9223623),
                  c(-0.04580487,0.9270622),
                  c(-0.1067023,0.9281034),
                  c(-0.1671787,0.9254817),
                  c(-0.2269952,0.9192077),
                  c(-0.2859159,0.9093059),
                  c(-0.3437083,0.8958155),
                  c(-0.4001442,0.8787898),
                  c(-0.4550008,0.8582958),
                  c(-0.5080619,0.8344146),
                  c(-0.5591178,0.8072403),
                  c(-0.6079671,0.7768802),
                  c(-0.6544171,0.743454),
                  c(-0.6982844,0.7070939),
                  c(-0.7393959,0.6679432),
                  c(-0.7775893,0.6261563),
                  c(-0.812714,0.5818984),
                  c(-0.8446311,0.5353439))
    mq6m <- rbind(c(-0.5058319,0.861663),
                  c(-0.5444786,0.8347146),
                  c(-0.5809764,0.8044718),
                  c(-0.6151813,0.7710542),
                  c(-0.6469585,0.7345936),
                  c(-0.6761824,0.6952339),
                  c(-0.7027377,0.6531304),
                  c(-0.7265196,0.6084493),
                  c(-0.7474342,0.5613669),
                  c(-0.7653991,0.512069),
                  c(-0.7803434,0.4607503),
                  c(-0.7922079,0.4076132),
                  c(-0.800946,0.3528674),
                  c(-0.8065231,0.2967291),
                  c(-0.8089172,0.2394196),
                  c(-0.8081189,0.1811653),
                  c(-0.8041313,0.122196),
                  c(-0.7969702,0.0627445),
                  c(-0.7866638,0.003045333),
                  c(-0.7732528,-0.05666585),
                  c(-0.7567902,-0.1161534),
                  c(-0.7373408,-0.1751825),
                  c(-0.7149815,-0.2335203),
                  c(-0.6898004,-0.2909365),
                  c(-0.6618971,-0.3472045),
                  c(-0.6313815,-0.4021022),
                  c(-0.5983742,-0.455413),
                  c(-0.5630053,-0.5069265),
                  c(-0.5254146,-0.5564394),
                  c(-0.4857502,-0.6037563),
                  c(-0.4441688,-0.6486905),
                  c(-0.4008345,-0.6910645),
                  c(-0.3559183,-0.7307112),
                  c(-0.3095975,-0.7674742),
                  c(-0.2620548,-0.8012083),
                  c(-0.2134778,-0.8317804),
                  c(-0.1640584,-0.8590698),
                  c(-0.1139916,-0.8829689),
                  c(-0.06347481,-0.9033833),
                  c(-0.01270755,-0.9202324),
                  c(0.03810985,-0.9334498),
                  c(0.08877686,-0.9429833),
                  c(0.1390935,-0.9487953),
                  c(0.1888612,-0.9508629),
                  c(0.2378836,-0.9491778),
                  c(0.2859671,-0.9437467),
                  c(0.3329221,-0.9345911),
                  c(0.3785631,-0.9217471),
                  c(0.4227102,-0.9052654),
                  c(0.465189,-0.885211))
    mq6p <- rbind(c(0.5058319,-0.8616631),
                  c(0.5444785,-0.8347146),
                  c(0.5809763,-0.8044719),
                  c(0.6151813,-0.7710542),
                  c(0.6469584,-0.7345936),
                  c(0.6761823,-0.6952339),
                  c(0.7027376,-0.6531304),
                  c(0.7265196,-0.6084493),
                  c(0.7474342,-0.5613669),
                  c(0.7653992,-0.512069),
                  c(0.7803434,-0.4607503),
                  c(0.7922079,-0.4076132),
                  c(0.800946,-0.3528674),
                  c(0.8065231,-0.296729),
                  c(0.8089172,-0.2394196),
                  c(0.8081189,-0.1811653),
                  c(0.8041313,-0.122196),
                  c(0.7969702,-0.06274444),
                  c(0.7866638,-0.003045282),
                  c(0.7732528,0.0566659),
                  c(0.7567901,0.1161534),
                  c(0.7373408,0.1751826),
                  c(0.7149814,0.2335204),
                  c(0.6898004,0.2909365),
                  c(0.661897,0.3472045),
                  c(0.6313815,0.4021023),
                  c(0.5983741,0.4554131),
                  c(0.5630053,0.5069266),
                  c(0.5254145,0.5564395),
                  c(0.4857502,0.6037564),
                  c(0.4441688,0.6486905),
                  c(0.4008345,0.6910645),
                  c(0.3559183,0.7307113),
                  c(0.3095974,0.7674742),
                  c(0.2620547,0.8012083),
                  c(0.2134778,0.8317804),
                  c(0.1640584,0.8590698),
                  c(0.1139915,0.8829689),
                  c(0.06347476,0.9033833),
                  c(0.01270751,0.9202324),
                  c(-0.0381099,0.9334498),
                  c(-0.0887769,0.9429833),
                  c(-0.1390935,0.9487953),
                  c(-0.1888612,0.9508629),
                  c(-0.2378836,0.9491778),
                  c(-0.2859671,0.9437467),
                  c(-0.3329221,0.9345911),
                  c(-0.3785632,0.921747),
                  c(-0.4227102,0.9052654),
                  c(-0.465189,0.885211))
    mq7m <- rbind(c(-0.2444927,0.9691744),
                  c(-0.2730048,0.9582235),
                  c(-0.3004394,0.943491),
                  c(-0.3266884,0.9250349),
                  c(-0.3516481,0.9029281),
                  c(-0.37522,0.877258),
                  c(-0.397311,0.8481256),
                  c(-0.4178341,0.8156461),
                  c(-0.4367082,0.7799476),
                  c(-0.4538587,0.741171),
                  c(-0.4692181,0.6994694),
                  c(-0.4827258,0.6550072),
                  c(-0.4943283,0.6079601),
                  c(-0.5039799,0.5585136),
                  c(-0.5116425,0.5068629),
                  c(-0.517286,0.4532119),
                  c(-0.5208879,0.3977722),
                  c(-0.5224341,0.3407627),
                  c(-0.5219186,0.2824084),
                  c(-0.5193432,0.2229395),
                  c(-0.5147183,0.1625908),
                  c(-0.5080619,0.1016005),
                  c(-0.4994005,0.04020912),
                  c(-0.4887682,-0.02134091),
                  c(-0.476207,-0.08280672),
                  c(-0.4617663,-0.1439457),
                  c(-0.4455033,-0.2045166),
                  c(-0.4274821,-0.2642804),
                  c(-0.4077738,-0.3230012),
                  c(-0.3864562,-0.3804473),
                  c(-0.3636135,-0.4363919),
                  c(-0.3393357,-0.4906142),
                  c(-0.3137188,-0.5429004),
                  c(-0.2868637,-0.5930439),
                  c(-0.2588765,-0.640847),
                  c(-0.2298676,-0.686121),
                  c(-0.1999516,-0.7286871),
                  c(-0.1692464,-0.7683774),
                  c(-0.1378733,-0.8050353),
                  c(-0.1059561,-0.8385162),
                  c(-0.07362074,-0.8686877),
                  c(-0.04099481,-0.895431),
                  c(-0.008207093,-0.9186404),
                  c(0.02461301,-0.9382243),
                  c(0.05733598,-0.9541055),
                  c(0.08983267,-0.9662213),
                  c(0.1219748,-0.9745238),
                  c(0.1536356,-0.9789804),
                  c(0.1846901,-0.9795733),
                  c(0.2150156,-0.9763004))
    mq7p <- rbind(c(0.2444926,-0.9691744),
                  c(0.2730047,-0.9582235),
                  c(0.3004394,-0.943491),
                  c(0.3266884,-0.925035),
                  c(0.3516481,-0.9029282),
                  c(0.37522,-0.877258),
                  c(0.397311,-0.8481256),
                  c(0.4178341,-0.8156461),
                  c(0.4367082,-0.7799476),
                  c(0.4538587,-0.741171),
                  c(0.4692181,-0.6994694),
                  c(0.4827257,-0.6550073),
                  c(0.4943283,-0.60796),
                  c(0.5039799,-0.5585136),
                  c(0.5116426,-0.5068629),
                  c(0.517286,-0.4532118),
                  c(0.5208879,-0.3977722),
                  c(0.5224341,-0.3407627),
                  c(0.5219186,-0.2824083),
                  c(0.5193432,-0.2229395),
                  c(0.5147182,-0.1625908),
                  c(0.5080619,-0.1016004),
                  c(0.4994005,-0.04020906),
                  c(0.4887682,0.02134097),
                  c(0.4762069,0.08280677),
                  c(0.4617663,0.1439458),
                  c(0.4455033,0.2045167),
                  c(0.4274821,0.2642805),
                  c(0.4077738,0.3230013),
                  c(0.3864562,0.3804473),
                  c(0.3636135,0.4363919),
                  c(0.3393357,0.4906143),
                  c(0.3137187,0.5429004),
                  c(0.2868637,0.593044),
                  c(0.2588765,0.640847),
                  c(0.2298676,0.686121),
                  c(0.1999516,0.7286871),
                  c(0.1692464,0.7683775),
                  c(0.1378733,0.8050354),
                  c(0.1059561,0.8385162),
                  c(0.07362071,0.8686877),
                  c(0.04099478,0.895431),
                  c(0.008207065,0.9186404),
                  c(-0.02461304,0.9382243),
                  c(-0.05733601,0.9541055),
                  c(-0.0898327,0.9662213),
                  c(-0.1219749,0.9745238),
                  c(-0.1536356,0.9789804),
                  c(-0.1846901,0.9795733),
                  c(-0.2150157,0.9763004))
    mq8m <- rbind(c(-0.06437504,0.9975677),
                  c(-0.07320037,0.9933573),
                  c(-0.0817368,0.9852266),
                  c(-0.08995066,0.9732076),
                  c(-0.09780953,0.9573479),
                  c(-0.1052824,0.9377099),
                  c(-0.1123397,0.9143712),
                  c(-0.1189537,0.8874239),
                  c(-0.1250983,0.8569744),
                  c(-0.1307491,0.8231427),
                  c(-0.1358839,0.7860625),
                  c(-0.1404825,0.74588),
                  c(-0.1445266,0.702754),
                  c(-0.1480004,0.6568544),
                  c(-0.1508901,0.6083626),
                  c(-0.1531842,0.5574698),
                  c(-0.1548739,0.504377),
                  c(-0.1559523,0.4492936),
                  c(-0.1564152,0.392437),
                  c(-0.1562609,0.3340317),
                  c(-0.1554898,0.2743081),
                  c(-0.1541051,0.213502),
                  c(-0.1521122,0.1518532),
                  c(-0.149519,0.08960517),
                  c(-0.1463357,0.02700349),
                  c(-0.1425749,-0.03570476),
                  c(-0.1382515,-0.0982721),
                  c(-0.1333824,-0.1604516),
                  c(-0.1279869,-0.2219979),
                  c(-0.1220863,-0.282668),
                  c(-0.1157038,-0.3422226),
                  c(-0.1088648,-0.4004266),
                  c(-0.1015961,-0.4570503),
                  c(-0.09392646,-0.5118702),
                  c(-0.08588613,-0.56467),
                  c(-0.07750685,-0.6152413),
                  c(-0.06882168,-0.6633846),
                  c(-0.05986491,-0.7089097),
                  c(-0.05067188,-0.7516372),
                  c(-0.04127886,-0.7913982),
                  c(-0.03172294,-0.828036),
                  c(-0.02204183,-0.8614058),
                  c(-0.01227372,-0.8913761),
                  c(-0.002457179,-0.9178286),
                  c(0.007369062,-0.9406588),
                  c(0.01716622,-0.9597767),
                  c(0.02689563,-0.9751067),
                  c(0.0365189,-0.9865885),
                  c(0.04599804,-0.9941766),
                  c(0.05529565,-0.9978412))
    mq8p <- rbind(c(0.06437504,-0.9975677),
                  c(0.07320036,-0.9933573),
                  c(0.0817368,-0.9852266),
                  c(0.08995066,-0.9732077),
                  c(0.09780952,-0.9573479),
                  c(0.1052824,-0.93771),
                  c(0.1123397,-0.9143712),
                  c(0.1189537,-0.887424),
                  c(0.1250983,-0.8569744),
                  c(0.1307491,-0.8231427),
                  c(0.1358839,-0.7860625),
                  c(0.1404825,-0.7458801),
                  c(0.1445266,-0.702754),
                  c(0.1480004,-0.6568544),
                  c(0.1508901,-0.6083626),
                  c(0.1531842,-0.5574698),
                  c(0.1548739,-0.5043769),
                  c(0.1559523,-0.4492935),
                  c(0.1564152,-0.392437),
                  c(0.1562609,-0.3340317),
                  c(0.1554898,-0.2743081),
                  c(0.1541051,-0.2135019),
                  c(0.1521122,-0.1518532),
                  c(0.149519,-0.08960512),
                  c(0.1463357,-0.02700344),
                  c(0.1425749,0.03570481),
                  c(0.1382514,0.09827215),
                  c(0.1333824,0.1604517),
                  c(0.1279869,0.2219979),
                  c(0.1220863,0.2826681),
                  c(0.1157038,0.3422227),
                  c(0.1088648,0.4004267),
                  c(0.1015961,0.4570503),
                  c(0.09392645,0.5118703),
                  c(0.08588612,0.5646701),
                  c(0.07750684,0.6152414),
                  c(0.06882167,0.6633846),
                  c(0.0598649,0.7089098),
                  c(0.05067187,0.7516372),
                  c(0.04127886,0.7913982),
                  c(0.03172294,0.828036),
                  c(0.02204182,0.8614059),
                  c(0.01227371,0.8913762),
                  c(0.002457171,0.9178286),
                  c(-0.00736907,0.9406588),
                  c(-0.01716623,0.9597767),
                  c(-0.02689564,0.9751067),
                  c(-0.03651891,0.9865885),
                  c(-0.04599805,0.9941766),
                  c(-0.05529566,0.9978412))

    if (nbsphere==2)
    {
      par(mfrow=c(1,2))
      par(pty="s")
      par(oma=c(0,0,0,0))
      par(mar=c(0,0,0,0))
      plot(cos((1:201)*pi/100),sin((1:201)*pi/100),type="l",axes=FALSE,frame.plot=FALSE,ann=FALSE,xlim=c(-1,1),ylim=c(-1,1))
      lines(mp1p[,1],mp1p[,2])
      lines(mp2p[,1],mp2p[,2])
      lines(mp3p[,1],mp3p[,2])
      lines(mp4p[,1],mp4p[,2])
      lines(mp5p[,1],mp5p[,2])
      lines(mq1p[,1],mq1p[,2])
      lines(mq2p[,1],mq2p[,2])
      lines(mq3p[,1],mq3p[,2])
      lines(mq4p[,1],mq4p[,2])
      lines(mq5p[,1],mq5p[,2])
      lines(mq6p[,1],mq6p[,2])
      lines(mq7p[,1],mq7p[,2])
      lines(mq8p[,1],mq8p[,2])
      for(i in 1:p) {if (load[i,1]>=0) symbols(x=load[i,2], y=load[i,3], circles=0.015, inches=FALSE, add=TRUE,fg="red",bg="red")}
      for(i in 1:p) {if (load[i,1]>=0) text(x=load[i,2],y=load[i,3]-0.05,labels=names[i],cex=cx)}
      plot(cos((1:201)*pi/100),sin((1:201)*pi/100),type="l",axes=FALSE,frame.plot=FALSE,ann=FALSE,xlim=c(-1,1),ylim=c(-1,1))
      lines(mp1m[,1],mp1m[,2])
      lines(mp2m[,1],mp2m[,2])
      lines(mp3m[,1],mp3m[,2])
      lines(mp4m[,1],mp4m[,2])
      lines(mp5m[,1],mp5m[,2])
      lines(-mq1m[,1],mq1m[,2])
      lines(-mq2m[,1],mq2m[,2])
      lines(-mq3m[,1],mq3m[,2])
      lines(-mq4m[,1],mq4m[,2])
      lines(-mq5m[,1],mq5m[,2])
      lines(-mq6m[,1],mq6m[,2])
      lines(-mq7m[,1],mq7m[,2])
      lines(-mq8m[,1],mq8m[,2])
      for(i in 1:p) {if (load[i,1]<=0) symbols(x=load[i,2], y=load[i,3], circles=0.015, inches=FALSE, add=TRUE,fg="red",bg="red")}
      for(i in 1:p) {if (load[i,1]<=0) text(x=load[i,2],y=load[i,3]-0.05,labels=names[i],cex=cx)}
    }

    if ((nbsphere!=2) & (back==TRUE))
    {
      par(mfrow=c(1,1))
      par(pty="s")
      par(oma=c(0,0,0,0))
      par(mar=c(0,0,0,0))
      plot(cos((1:201)*pi/100),sin((1:201)*pi/100),type="l",axes=FALSE,frame.plot=FALSE,ann=FALSE,xlim=c(-1,1),ylim=c(-1,1))
      lines(mp1p[,1],mp1p[,2])
      lines(mp2p[,1],mp2p[,2])
      lines(mp3p[,1],mp3p[,2])
      lines(mp4p[,1],mp4p[,2])
      lines(mp5p[,1],mp5p[,2])
      lines(mq1p[,1],mq1p[,2])
      lines(mq2p[,1],mq2p[,2])
      lines(mq3p[,1],mq3p[,2])
      lines(mq4p[,1],mq4p[,2])
      lines(mq5p[,1],mq5p[,2])
      lines(mq6p[,1],mq6p[,2])
      lines(mq7p[,1],mq7p[,2])
      lines(mq8p[,1],mq8p[,2])
      lines(mp1m[,1],mp1m[,2],lty=3)
      lines(mp2m[,1],mp2m[,2],lty=3)
      lines(mp3m[,1],mp3m[,2],lty=3)
      lines(mp4m[,1],mp4m[,2],lty=3)
      lines(mp5m[,1],mp5m[,2],lty=3)
      lines(-mq1m[,1],mq1m[,2],lty=3)
      lines(-mq2m[,1],mq2m[,2],lty=3)
      lines(-mq3m[,1],mq3m[,2],lty=3)
      lines(-mq4m[,1],mq4m[,2],lty=3)
      lines(-mq5m[,1],mq5m[,2],lty=3)
      lines(-mq6m[,1],mq6m[,2],lty=3)
      lines(-mq7m[,1],mq7m[,2],lty=3)
      lines(-mq8m[,1],mq8m[,2],lty=3)
      for(i in 1:p) {if (load[i,1]>=0) symbols(x=load[i,2], y=load[i,3], circles=0.015, inches=FALSE, add=TRUE,fg="red",bg="red")}
      for(i in 1:p) {if (load[i,1]>=0) text(x=load[i,2],y=load[i,3]-0.05,labels=names[i],cex=cx)}
      for(i in 1:p) {if (load[i,1]<=0) symbols(x=load[i,2], y=load[i,3], circles=0.015, inches=FALSE, add=TRUE,fg="blue",bg="white")}
      for(i in 1:p) {if (load[i,1]<=0) text(x=load[i,2],y=load[i,3]-0.05,labels=names[i],cex=cx)}
    }

    if ((nbsphere!=2) & (back==FALSE))
    {
      par(mfrow=c(1,1))
      par(pty="s")
      par(oma=c(0,0,0,0))
      par(mar=c(0,0,0,0))
      plot(cos((1:201)*pi/100),sin((1:201)*pi/100),type="l",axes=FALSE,frame.plot=FALSE,ann=FALSE,xlim=c(-1,1),ylim=c(-1,1))
      lines(mp1p[,1],mp1p[,2])
      lines(mp2p[,1],mp2p[,2])
      lines(mp3p[,1],mp3p[,2])
      lines(mp4p[,1],mp4p[,2])
      lines(mp5p[,1],mp5p[,2])
      lines(mq1p[,1],mq1p[,2])
      lines(mq2p[,1],mq2p[,2])
      lines(mq3p[,1],mq3p[,2])
      lines(mq4p[,1],mq4p[,2])
      lines(mq5p[,1],mq5p[,2])
      lines(mq6p[,1],mq6p[,2])
      lines(mq7p[,1],mq7p[,2])
      lines(mq8p[,1],mq8p[,2])
      for(i in 1:p) {if (load[i,1]>=0) symbols(x=load[i,2], y=load[i,3], circles=0.015, inches=FALSE, add=TRUE,fg="red",bg="red")}
      for(i in 1:p) {if (load[i,1]>=0) text(x=load[i,2],y=load[i,3]-0.05,labels=names[i],cex=cx)}
      for(i in 1:p) {if (load[i,1]<=0) symbols(x=load[i,2], y=load[i,3], circles=0.015, inches=FALSE, add=TRUE,fg="blue",bg="white")}
      for(i in 1:p) {if (load[i,1]<=0) text(x=load[i,2],y=load[i,3]-0.05,labels=names[i],cex=cx)}
    }

    if (output!=FALSE & method=="exact") list("stress.before.optim"=stress.non.optim,
                                              "stress.after.otpim"=stress.optim,"convergence"=convergence)
    if (output!=FALSE & method=="rscal" | method=="dist") list("stress.before.optim"=stress.non.optim,
                                                               "stress.after.optim"=stress.optim,"convergence"=convergence,
                                                               "correlations"=round(matcorp,3),"residuals"=round(resid.r,3),"mean.abs.resid"=resmoy)

  }