There are a symbolic matrix and a real number list. I'm going to replace the symbols of the matrix with all the elements of the list, and then to get the Eigenvalues
. I have used the ParallelMap
to speed up. I want to know if there is a more efficient program. Can I compile the codes to speed up? Thank you.
u[x_]:=N@{{2+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),3/2+1/2 (2-4 x+x^2),7/3,5/4+1/6 (6-18 x+9 x^2-x^3),11/5,7/6+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),8/7+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),9/8+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),10/9+1/24 (24-96 x+72 x^2-16 x^3+x^4),11/10+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),12/11+1/24 (24-96 x+72 x^2-16 x^3+x^4),13/12+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),27/13,15/14+1/24 (24-96 x+72 x^2-16 x^3+x^4),16/15+1/24 (24-96 x+72 x^2-16 x^3+x^4),17/16+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),18/17+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),37/18,20/19+1/6 (6-18 x+9 x^2-x^3),41/20-x},{3+1/24 (24-96 x+72 x^2-16 x^3+x^4),5/2+1/24 (24-96 x+72 x^2-16 x^3+x^4),7/3+1/24 (24-96 x+72 x^2-16 x^3+x^4),9/4+1/24 (24-96 x+72 x^2-16 x^3+x^4),11/5+1/2 (2-4 x+x^2),19/6-x,15/7+1/2 (2-4 x+x^2),17/8+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),19/9+1/6 (6-18 x+9 x^2-x^3),21/10+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),23/11+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),25/12+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),27/13+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),29/14+1/6 (6-18 x+9 x^2-x^3),46/15,33/16+1/6 (6-18 x+9 x^2-x^3),35/17+1/6 (6-18 x+9 x^2-x^3),55/18-x,58/19-x,41/20+1/6 (6-18 x+9 x^2-x^3)},{5,7/2+1/2 (2-4 x+x^2),10/3+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),17/4,16/5+1/24 (24-96 x+72 x^2-16 x^3+x^4),19/6+1/2 (2-4 x+x^2),22/7+1/6 (6-18 x+9 x^2-x^3),25/8+1/2 (2-4 x+x^2),28/9+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),41/10-x,34/11+1/2 (2-4 x+x^2),37/12+1/2 (2-4 x+x^2),53/13-x,43/14+1/2 (2-4 x+x^2),46/15+1/6 (6-18 x+9 x^2-x^3),65/16,52/17+1/6 (6-18 x+9 x^2-x^3),73/18-x,58/19+1/24 (24-96 x+72 x^2-16 x^3+x^4),61/20+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6)},{6,9/2+1/2 (2-4 x+x^2),13/3+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),17/4+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),26/5,25/6+1/24 (24-96 x+72 x^2-16 x^3+x^4),36/7-x,41/8-x,46/9-x,41/10+1/2 (2-4 x+x^2),45/11+1/24 (24-96 x+72 x^2-16 x^3+x^4),49/12+1/24 (24-96 x+72 x^2-16 x^3+x^4),66/13-x,57/14+1/24 (24-96 x+72 x^2-16 x^3+x^4),76/15,65/16+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),69/17+1/24 (24-96 x+72 x^2-16 x^3+x^4),91/18-x,96/19-x,81/20+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6)},{6+1/2 (2-4 x+x^2),11/2+1/6 (6-18 x+9 x^2-x^3),19/3,21/4+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),26/5+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),31/6+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),36/7+1/6 (6-18 x+9 x^2-x^3),49/8,46/9+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),61/10-x,56/11+1/6 (6-18 x+9 x^2-x^3),61/12+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),79/13,85/14,91/15-x,81/16+1/6 (6-18 x+9 x^2-x^3),86/17+1/6 (6-18 x+9 x^2-x^3),109/18-x,96/19+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),101/20+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5)},{8,13/2+1/24 (24-96 x+72 x^2-16 x^3+x^4),19/3+1/6 (6-18 x+9 x^2-x^3),29/4-x,31/5+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),37/6+1/2 (2-4 x+x^2),43/7+1/2 (2-4 x+x^2),49/8+1/6 (6-18 x+9 x^2-x^3),55/9+1/6 (6-18 x+9 x^2-x^3),61/10+1/2 (2-4 x+x^2),67/11+1/2 (2-4 x+x^2),73/12+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),92/13-x,99/14,106/15-x,97/16+1/24 (24-96 x+72 x^2-16 x^3+x^4),120/17,109/18+1/24 (24-96 x+72 x^2-16 x^3+x^4),115/19+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),121/20+1/24 (24-96 x+72 x^2-16 x^3+x^4)},{9-x,15/2+1/2 (2-4 x+x^2),22/3+1/24 (24-96 x+72 x^2-16 x^3+x^4),29/4+1/24 (24-96 x+72 x^2-16 x^3+x^4),41/5-x,43/6+1/6 (6-18 x+9 x^2-x^3),57/7,57/8+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),73/9-x,71/10+1/2 (2-4 x+x^2),89/11,85/12+1/6 (6-18 x+9 x^2-x^3),92/13+1/6 (6-18 x+9 x^2-x^3),99/14+1/24 (24-96 x+72 x^2-16 x^3+x^4),106/15+1/6 (6-18 x+9 x^2-x^3),113/16+1/2 (2-4 x+x^2),120/17+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),127/18+1/24 (24-96 x+72 x^2-16 x^3+x^4),153/19,161/20},{9+1/2 (2-4 x+x^2),17/2+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),25/3+1/2 (2-4 x+x^2),33/4+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),46/5-x,55/6,64/7,65/8+1/2 (2-4 x+x^2),73/9+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),81/10+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),89/11+1/24 (24-96 x+72 x^2-16 x^3+x^4),109/12,105/13+1/6 (6-18 x+9 x^2-x^3),113/14+1/6 (6-18 x+9 x^2-x^3),121/15+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),129/16+1/6 (6-18 x+9 x^2-x^3),154/17,163/18-x,172/19-x,161/20+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6)},{10+1/2 (2-4 x+x^2),19/2+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),28/3+1/2 (2-4 x+x^2),41/4-x,51/5,55/6+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),71/7-x,81/8-x,91/9,101/10,100/11+1/2 (2-4 x+x^2),109/12+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),118/13+1/2 (2-4 x+x^2),127/14+1/6 (6-18 x+9 x^2-x^3),151/15,145/16+1/2 (2-4 x+x^2),154/17+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),181/18,191/19-x,201/20},{12-x,23/2,31/3+1/6 (6-18 x+9 x^2-x^3),41/4+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),51/5+1/6 (6-18 x+9 x^2-x^3),61/6+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),78/7-x,89/8-x,91/9+1/24 (24-96 x+72 x^2-16 x^3+x^4),111/10,122/11-x,121/12+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),131/13+1/24 (24-96 x+72 x^2-16 x^3+x^4),141/14+1/24 (24-96 x+72 x^2-16 x^3+x^4),166/15,161/16+1/6 (6-18 x+9 x^2-x^3),171/17+1/24 (24-96 x+72 x^2-16 x^3+x^4),181/18+1/2 (2-4 x+x^2),191/19+1/6 (6-18 x+9 x^2-x^3),201/20+1/6 (6-18 x+9 x^2-x^3)},{13-x,25/2-x,37/3-x,45/4+1/6 (6-18 x+9 x^2-x^3),61/5,73/6-x,78/7+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),89/8+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),100/9+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),111/10+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),133/11-x,145/12-x,157/13-x,155/14+1/2 (2-4 x+x^2),166/15+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),177/16+1/24 (24-96 x+72 x^2-16 x^3+x^4),188/17+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),199/18+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),210/19+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),241/20},{13+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),27/2-x,40/3-x,49/4+1/24 (24-96 x+72 x^2-16 x^3+x^4),66/5-x,79/6-x,85/7+1/24 (24-96 x+72 x^2-16 x^3+x^4),105/8-x,109/9+1/24 (24-96 x+72 x^2-16 x^3+x^4),121/10+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),133/11+1/6 (6-18 x+9 x^2-x^3),145/12+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),170/13,169/14+1/6 (6-18 x+9 x^2-x^3),181/15+1/2 (2-4 x+x^2),193/16+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),222/17,235/18,229/19+1/2 (2-4 x+x^2),241/20+1/24 (24-96 x+72 x^2-16 x^3+x^4)},{15,27/2+1/2 (2-4 x+x^2),40/3+1/24 (24-96 x+72 x^2-16 x^3+x^4),53/4+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),66/5+1/24 (24-96 x+72 x^2-16 x^3+x^4),79/6+1/2 (2-4 x+x^2),92/7+1/6 (6-18 x+9 x^2-x^3),113/8,118/9+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),141/10-x,144/11+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),157/12+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),170/13+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),183/14+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),211/15-x,225/16,222/17+1/24 (24-96 x+72 x^2-16 x^3+x^4),253/18,248/19+1/2 (2-4 x+x^2),281/20},{16-x,29/2+1/24 (24-96 x+72 x^2-16 x^3+x^4),43/3+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),57/4+1/24 (24-96 x+72 x^2-16 x^3+x^4),76/5,85/6+1/24 (24-96 x+72 x^2-16 x^3+x^4),99/7+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),121/8,127/9+1/6 (6-18 x+9 x^2-x^3),141/10+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),155/11+1/24 (24-96 x+72 x^2-16 x^3+x^4),169/12+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),183/13+1/24 (24-96 x+72 x^2-16 x^3+x^4),197/14+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),211/15+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),241/16,256/17-x,253/18+1/24 (24-96 x+72 x^2-16 x^3+x^4),267/19+1/2 (2-4 x+x^2),281/20+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6)},{16+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),31/2+1/24 (24-96 x+72 x^2-16 x^3+x^4),46/3+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),61/4+1/24 (24-96 x+72 x^2-16 x^3+x^4),76/5+1/24 (24-96 x+72 x^2-16 x^3+x^4),91/6+1/24 (24-96 x+72 x^2-16 x^3+x^4),106/7+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),129/8,136/9+1/6 (6-18 x+9 x^2-x^3),151/10+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),166/11+1/2 (2-4 x+x^2),181/12+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),209/13-x,211/14+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),226/15+1/2 (2-4 x+x^2),241/16+1/24 (24-96 x+72 x^2-16 x^3+x^4),273/17-x,271/18+1/6 (6-18 x+9 x^2-x^3),286/19+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),321/20-x},{18,33/2+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),49/3+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),69/4,81/5+1/6 (6-18 x+9 x^2-x^3),97/6+1/24 (24-96 x+72 x^2-16 x^3+x^4),113/7+1/24 (24-96 x+72 x^2-16 x^3+x^4),129/8+1/6 (6-18 x+9 x^2-x^3),145/9+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),161/10+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),188/11-x,205/12,209/13+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),225/14+1/6 (6-18 x+9 x^2-x^3),241/15+1/24 (24-96 x+72 x^2-16 x^3+x^4),257/16+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),273/17+1/2 (2-4 x+x^2),289/18+1/2 (2-4 x+x^2),305/19+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),341/20-x},{19,37/2-x,52/3+1/6 (6-18 x+9 x^2-x^3),73/4-x,86/5+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),103/6+1/6 (6-18 x+9 x^2-x^3),120/7+1/24 (24-96 x+72 x^2-16 x^3+x^4),137/8+1/24 (24-96 x+72 x^2-16 x^3+x^4),154/9+1/6 (6-18 x+9 x^2-x^3),171/10+1/2 (2-4 x+x^2),188/11+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),205/12+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),222/13+1/24 (24-96 x+72 x^2-16 x^3+x^4),253/14-x,271/15,273/16+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),290/17+1/2 (2-4 x+x^2),325/18,324/19+1/24 (24-96 x+72 x^2-16 x^3+x^4),341/20+1/2 (2-4 x+x^2)},{19+1/24 (24-96 x+72 x^2-16 x^3+x^4),37/2+1/2 (2-4 x+x^2),55/3+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),77/4-x,91/5+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),115/6,127/7+1/24 (24-96 x+72 x^2-16 x^3+x^4),145/8+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),163/9+1/6 (6-18 x+9 x^2-x^3),191/10,199/11+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),217/12+1/6 (6-18 x+9 x^2-x^3),235/13+1/24 (24-96 x+72 x^2-16 x^3+x^4),253/14+1/2 (2-4 x+x^2),286/15,289/16+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),324/17-x,325/18+1/24 (24-96 x+72 x^2-16 x^3+x^4),343/19+1/6 (6-18 x+9 x^2-x^3),361/20+1/2 (2-4 x+x^2)},{20+1/24 (24-96 x+72 x^2-16 x^3+x^4),39/2+1/2 (2-4 x+x^2),58/3+1/2 (2-4 x+x^2),77/4+1/6 (6-18 x+9 x^2-x^3),101/5-x,121/6-x,141/7-x,153/8+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),172/9+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),191/10+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),210/11+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),229/12+1/2 (2-4 x+x^2),248/13+1/2 (2-4 x+x^2),267/14+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),301/15-x,305/16+1/2 (2-4 x+x^2),324/17+1/2 (2-4 x+x^2),361/18,381/19-x,401/20},{21+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),41/2+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),61/3+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),81/4+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),106/5,121/6+1/6 (6-18 x+9 x^2-x^3),141/7+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),161/8+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),190/9-x,201/10+1/24 (24-96 x+72 x^2-16 x^3+x^4),221/11+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),253/12,261/13+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5),281/14+1/720 (720-4320 x+5400 x^2-2400 x^3+450 x^4-36 x^5+x^6),316/15-x,337/16,341/17+1/2 (2-4 x+x^2),361/18+1/24 (24-96 x+72 x^2-16 x^3+x^4),381/19+1/24 (24-96 x+72 x^2-16 x^3+x^4),401/20+1/120 (120-600 x+600 x^2-200 x^3+25 x^4-x^5)}};
wCeiling=2*Pi*180;
number=8800;
w=Range[0.,wCeiling,wCeiling/number];
Map[Eigenvalues[u[#]]&,N@w];//AbsoluteTiming
(*{13.6987,Null}*)
ParallelMap[Eigenvalues[u[#]]&,N@w];//AbsoluteTiming
(*{4.39281,Null}*)