Cody

# Problem 615. Nilpotent matrix

Solution 493179

Submitted on 28 Aug 2014 by Abdullah Caliskan
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% x = 1; y_correct = false; assert(isequal(isnilpotent(x),y_correct))

A = 1 A = 1 A = 1 A = 1 A = 1 A = 1 A = 1 A = 1 A = 1

2   Pass
%% x = gallery('chebspec',5,0); y_correct = true; assert(isequal(isnilpotent(x),y_correct))

A = 17.0000 -28.4853 18.0000 -11.5147 5.0000 9.2426 -14.0000 6.0000 -2.0000 0.7574 -1.0000 4.0000 -6.0000 4.0000 -1.0000 0.7574 -2.0000 6.0000 -14.0000 9.2426 5.0000 -11.5147 18.0000 -28.4853 17.0000 A = 1.0e-11 * -0.2231 0.3638 -0.2728 0.2160 -0.0966 -0.1577 0.2444 -0.1762 0.1251 -0.0568 -0.0298 0.0227 -0.0057 -0.0227 0.0227 0.0341 -0.1023 0.1364 -0.2160 0.1421 0.0199 -0.1080 0.2160 -0.3752 0.2274 A = 1.0e-48 * -0.0160 0.0260 -0.0374 0.0440 -0.0267 0.0087 -0.0056 -0.0362 0.0608 -0.0260 0.0030 0.0147 -0.0608 0.1148 -0.0770 -0.0164 0.1129 -0.2626 0.4728 -0.3062 0.0084 0.1499 -0.4674 0.8479 -0.4971 A = 1.0e-244 * -0.0241 0.0191 0.0400 -0.0804 0.0224 -0.0236 0.0714 -0.1138 0.1958 -0.1380 -0.0891 0.0863 0.1019 -0.2148 0.0350 -0.3317 0.3439 0.3131 -0.6808 0.0611 -0.5114 0.7229 -0.0762 -0.0466 -0.4903 A = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 tf = 1

3   Pass
%% x = gallery('chebspec',3,0); y_correct = true; assert(isequal(isnilpotent(x),y_correct))

A = 1.0000 -2.0000 1.0000 1.0000 -2.0000 1.0000 1.0000 -2.0000 1.0000 A = 1.0e-15 * 0.0000 -0.0000 -0.0000 -0.2220 0.4441 -0.2220 -0.4441 0.8882 -0.4441 A = 1.0e-91 * 0.1918 -0.3835 0.1918 -0.1342 0.2685 -0.0959 -0.3835 0.7670 -0.3068 A = 0 0 0 0 0 0 0 0 0 tf = 1

4   Pass
%% x = [1 0 0;0 2 0; 0 0 -3]; y_correct = false; assert(isequal(isnilpotent(x),y_correct))

A = 1 0 0 0 4 0 0 0 9 A = 1 0 0 0 64 0 0 0 729 A = 1.0e+11 * 0.0000 0 0 0 0.0002 0 0 0 2.8243 A = 1.0e+57 * 0.0000 0 0 0 0.0000 0 0 0 1.7970 A = 1.0e+216 * 0.0000 0 0 0 5.5157 0 0 0 Inf A = NaN NaN NaN NaN NaN NaN NaN NaN NaN A = NaN NaN NaN NaN NaN NaN NaN NaN NaN A = NaN NaN NaN NaN NaN NaN NaN NaN NaN A = NaN NaN NaN NaN NaN NaN NaN NaN NaN

5   Pass
%% x = [6 -9; 4 -6]; y_correct = true; assert(isequal(isnilpotent(x),y_correct))

A = 0 0 0 0 tf = 1

6   Pass
%% x = rand(50); y_correct = false; assert(isequal(isnilpotent(x),y_correct))

A = Columns 1 through 9 12.1662 13.0064 13.1244 15.9559 15.2182 14.2830 11.3101 11.4822 10.3202 10.2815 10.9246 10.3145 11.1770 11.7629 11.1385 9.9310 9.4938 9.3375 10.4403 10.3205 11.3213 12.9828 14.2365 12.3902 10.7173 11.5807 9.0122 12.0326 12.2815 11.3060 13.2555 13.4954 11.8892 10.7164 11.2013 9.6461 10.9230 11.4404 11.6981 12.6859 13.1394 13.1621 10.5852 12.7534 10.5872 11.8069 10.5588 11.4035 13.5356 13.9189 13.6789 10.4336 10.4213 11.1139 12.9500 13.2737 13.8761 14.9071 15.9677 14.3247 12.3668 13.2168 12.2713 9.9964 9.6414 10.3293 12.5283 11.3186 12.3675 10.7494 11.7410 10.2870 12.5042 11.0566 13.3331 14.4439 14.6112 13.1663 11.1577 12.0091 10.7002 13.6628 12.1397 11.7584 13.8833 14.7009 13.9511 11.3875 13.5911 10.7069 11.4507 12.1768 11.6432 13.4140 13.4683 13.3153 10.8930 12.5114 10.9449 12.3849 11.6614 13.8603 14.8908 16.0985 15.3845 11.3531 13.2215 11.5432 11.6191 13.0742 13.4120 13.5901 14.8416 13.3933 12.0234 12.8854 12.2436 11.5237 10.9951 12.6072 14.2448 14.5770 13.3165 11.5189 12.0083 9.9161 10.9517 12.1684 12.8413 13.3836 13.7855 13.3277 10.9072 13.1154 11.5536 10.6497 12.2141 11.9392 12.9812 14.1325 13.4688 11.2663 11.8396 10.4370 11.6657 12.1911 12.3516 13.6356 14.8906 13.7138 10.5906 13.5492 11.2616 12.7291 14.4343 14.3048 14.2836 16.3137 14.6247 13.2521 14.0199 11.9482 12.2525 11.9181 12.1802 14.1851 14.5192 13.2963 11.5360 12.2859 10.7157 12.0648 10.6715 12.6316 12.5005 14.5190 12.3338 10.2529 12.1573 10.1001 10.7853 10.6843 12.2744 12.1831 13.2566 12.8540 9.9643 12.8557 9.5696 12.0401 12.3479 12.4111 14.0515 14.8702 13.9156 11.4081 12.3098 11.8714 10.6965 10.2620 12.0050 11.1091 13.4788 12.7234 9.3630 11.9037 9.9673 11.5586 11.3264 13.1312 13.8873 14.5675 14.0818 11.8627 13.0201 12.0369 11.3808 12.9982 13.9940 13.2217 14.6597 15.0017 11.9270 13.1558 12.5916 12.9827 12.7581 12.7377 15.1050 15.6848 16.2703 11.8069 13.3066 11.7145 12.4444 12.7900 12.7926 14.4687 14.4654 15.2916 12.0991 13.9385 12.0002 10.6469 11.1887 10.8769 14.2268 14.5692 13.2394 11.4969 11.6044 10.2149 9.4336 9.7567 10.8145 11.6032 12.9477 11.6173 10.8662 10.3533 9.0943 12.8395 11.8025 12.3573 14.5965 15.5940 15.5431 12.2447 12.3859 11.5804 10.7944 11.0132 11.7564 11.8477 13.0226 12.5903 9.6406 10.6072 9.7691 11.7192 11.6015 12.8728 14.2374 14.3357 13.6679 11.6274 12.1857 11.9878 10.9592 10.4994 10.5142 11.2110 12.5310 12.2992 9.6722 11.3317 8.7837 13.0396 13.4177 13.5430 15.1700 16.1459 14.4808 12.2071 13.7884 12.1108 11.2418 12.2192 12.3906 14.5671 14.2946 13.0883 11.7680 12.2055 11.2676 11.2856 11.1519 10.8710 12.8558 12.9291 12.5930 11.0818 12.2442 9.7207 11.8230 11.6404 11.4659 13.3905 13.9364 14.6974 11.0680 12.3136 10.2934 11.0121 10.5513 11.4595 13.4313 13.5649 13.0667 9.8979 12.9562 10.2089 11.3088 10.2714 10.4348 13.4420 13.3247 12.9320 10.2979 10.9362 9.4762 12.9952 11.9251 13.8427 15.2991 15.8285 15.7707 12.4483 14.1333 11.7985 11.0892 11.2344 11.6504 13.9633 13.9635 13.6024 10.6975 12.8559 10.0218 11.1719 11.6411 13.2893 13.4694 14.7444 14.5133 11.1087 14.0830 11.7899 12.5391 11.7402 12.3668 14.1102 14.6374 13.3425 11.3355 13.2364 9.9107 10.9916 12.2650 11.1751 12.6060 13.6652 13.0491 10.9888 12.1121 11.5943 10.3847 10.3896 11.7082 12.4674 13.8930 12.0576 10.0281 11.3612 9.9070 10.8991 10.8461 11.1958 12.9698 12.9376 11.5181 9.7392 10.6122 10.8431 12.1122 10.3931 11.4233 12.9009 14.2554 12.7897 10.7720 10.7395 9.7947 11.6335 11.3235 12.4395 12.7888 14.2102 12.9670 9.4442 12.1682 10.7078 12.8224 11.3476 13.1538 14.9213 15.1398 14.0862 11.1360 12.6565 11.8113 9.7753 10.6767 12.0305 12.6297 13.3044 13.0603 10.6391 12.2537 10.9625 Columns 10 through 18 13.3440 13.0107 14.0549 13.2668 12.0237 14.3757 13.9891 14.7984 12.3184 11.3388 10.4988 10.9366 11.0144 11.5162 11.6638 11.0277 13.2508 9.5940 11.3138 9.9642 11.6240 11.7565 10.4210 11.6016 12.9541 13.0503 9.2620 12.5703 10.6490 11.7355 10.6699 10.7212 12.2576 13.9655 13.9399 10.4788 13.0933 12.7027 11.8526 10.9894 12.2091 12.8524 12.4676 13.5904 9.4568 12.8725 11.1953 12.1013 12.6461 11.8541 13.6142 12.6221 13.0774 10.3402 13.4054 12.1821 14.4394 13.6402 14.4411 14.9572 14.4127 15.8402 10.9325 11.8535 9.8305 11.6849 11.2412 11.2344 11.2025 12.4796 14.0926 9.3615 12.9969 12.4028 13.4689 12.5323 11.6075 13.3551 14.1273 13.5116 10.7456 14.0167 12.2846 13.5634 11.3954 12.8338 14.9134 14.2832 15.8810 11.2251 13.8531 12.4882 12.2732 12.5439 11.7516 13.2789 12.5986 14.8398 10.1846 14.0182 12.2754 13.9419 13.5022 14.3060 14.7769 15.0597 15.3982 11.4503 14.8786 12.5676 13.2332 12.9967 13.6106 13.6264 14.1718 15.0213 11.4350 13.1198 11.6880 12.4962 11.3858 12.4095 12.5438 13.1321 14.2256 10.8937 13.5515 11.2843 12.7981 12.1608 12.9941 12.3559 15.0471 14.4299 10.5353 12.6123 9.5288 12.3863 11.9536 12.0958 11.6842 13.7912 13.9671 10.3520 13.3926 11.2904 12.7892 12.9476 13.3477 15.1788 13.5782 14.8198 11.1441 14.6571 12.3350 13.1371 13.6755 12.9774 13.7174 15.6632 14.4471 11.7243 13.2563 11.5858 12.8238 12.7862 11.0422 13.6792 13.3801 15.5828 10.9516 11.3945 11.3437 12.0467 11.8599 12.3200 13.3093 14.0384 12.8877 11.6223 12.1568 11.1414 12.4885 11.4532 12.2326 11.8003 13.4534 14.9191 9.5769 13.1827 11.4124 13.1860 12.5693 13.2011 14.3448 14.2522 14.9574 10.6835 12.1832 10.1607 10.5925 11.4279 12.4592 11.9401 12.5238 13.4378 10.3627 13.7097 11.7879 12.9871 13.1603 14.3799 13.3587 14.5156 14.6968 11.9884 14.3776 11.7158 12.7348 13.4103 14.8189 13.8402 13.8871 15.9437 10.9279 14.2759 12.8118 13.9741 14.2759 13.4511 15.0835 14.4847 17.1207 12.1273 13.0794 11.7452 12.7436 12.9843 15.4565 15.3454 14.3649 16.8695 11.7883 13.3838 11.0192 12.1005 11.5750 12.6310 13.4116 12.6308 13.7066 10.4472 11.8139 9.6365 11.0761 9.5012 10.5302 10.0531 12.8864 11.7711 8.9821 12.0800 11.8174 13.3762 12.4901 11.7607 14.5476 15.6153 14.6933 10.9970 11.8385 10.7326 10.7525 11.3699 11.3379 13.0547 12.8271 12.9831 9.8837 12.9316 11.8704 12.6364 12.2412 13.8466 13.5715 13.8951 15.0740 10.8660 11.7498 10.8786 10.6995 11.5155 10.5132 12.5457 12.3482 13.8670 9.5788 14.9451 13.3940 12.5630 13.4282 13.1433 16.0954 15.4317 16.5275 12.1000 12.4194 11.9150 12.6304 12.6334 13.0735 14.2370 13.0367 15.4059 12.3119 11.7455 10.1428 11.4755 10.4885 11.7026 12.9233 12.4543 13.9432 10.0356 13.6814 11.0125 12.1644 12.8229 13.6159 13.7062 14.0163 14.6782 11.0566 12.2344 11.9743 11.2673 11.9943 12.4612 12.8895 12.1213 13.5827 10.4250 12.9786 10.5000 11.7742 10.5657 12.1680 11.7221 12.2235 12.8112 9.8353 14.6490 12.7538 14.4177 13.1834 14.4974 15.2382 16.0319 15.4105 11.5034 12.2836 11.9713 12.3702 12.1576 11.8042 13.6178 13.0089 14.6373 10.4820 12.2437 12.5179 13.0201 12.9340 13.3978 14.0341 13.5620 16.3351 10.9470 13.1826 11.9542 12.6622 13.2357 12.5745 13.5262 14.2893 15.3950 11.4124 13.1284 10.9286 11.3735 12.3747 12.1196 13.3242 12.5759 14.8894 10.8067 12.6257 10.8300 11.0094 10.8017 11.4890 13.3469 12.6955 11.7575 10.6136 12.2817 10.3930 11.6440 10.8588 12.4753 12.8665 12.9952 13.9359 9.1864 11.7995 11.1865 12.5648 11.2629 12.2525 13.0873 13.4606 13.9294 10.0410 11.7475 9.9526 11.7129 11.6330 12.9507 13.5130 12.8634 14.4818 10.3478 13.4273 11.6854 12.5547 12.1152 14.5822 15.1098 14.5022 15.4820 11.0954 11.9406 11.4010 11.6457 11.7721 11.4280 12.3480 13.1903 14.4128 10.2561 Columns 19 through 27 12.4067 12.6188 11.3586 12.0479 13.0012 12.4242 11.3674 12.7738 14.3737 10.7821 10.9587 10.3250 10.5191 9.3027 11.4173 8.7256 9.5904 11.7265 11.0043 10.8209 11.2404 10.4141 10.7996 11.3587 9.8304 11.3104 11.7158 11.2018 12.0594 10.9840 11.7961 12.2447 11.2048 9.6404 12.3819 11.6579 10.5560 11.8336 12.1696 10.8418 10.9842 12.5370 9.5782 12.0461 12.8120 10.4944 11.5246 10.6391 11.1445 11.4760 12.0445 9.5416 10.1856 12.6105 13.2187 14.2147 12.3454 11.5473 14.0312 12.4387 10.9819 13.1060 14.2525 10.4300 11.2173 11.7328 9.7114 11.0131 11.7394 9.6635 10.8707 11.7443 10.8112 12.3094 11.3848 11.6941 12.3696 12.5842 9.7555 12.4024 12.0636 12....