{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2025-12-14T01:33:56.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2025-12-14T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":1465,"title":"Generalized Laguerre polynomials","description":"Given an integer _n_ \u0026ge; 0 and a scalar _a_, generate the _n_-th \u003chttp://en.wikipedia.org/wiki/Laguerre_polynomials#Generalized_Laguerre_polynomials Generalized Laguerre polynomial\u003e of association degree _a_.\r\n\r\nFor simplicity, assume that _a_ is a non-negative integer.\r\n\r\n*Examples*:\r\n\r\n genLaguerrePoly(0,1)\r\n ans =\r\n     1 \r\n\r\n genLaguerrePoly(1,1)\r\n ans =\r\n     -1    2 \r\n\r\n genLaguerrePoly(2,1)\r\n ans =\r\n     0.5  -3    3\r\n\r\nNeither *string operations* nor *interpolations* are allowed!\r\n","description_html":"\u003cp\u003eGiven an integer \u003ci\u003en\u003c/i\u003e \u0026ge; 0 and a scalar \u003ci\u003ea\u003c/i\u003e, generate the \u003ci\u003en\u003c/i\u003e-th \u003ca href = \"http://en.wikipedia.org/wiki/Laguerre_polynomials#Generalized_Laguerre_polynomials\"\u003eGeneralized Laguerre polynomial\u003c/a\u003e of association degree \u003ci\u003ea\u003c/i\u003e.\u003c/p\u003e\u003cp\u003eFor simplicity, assume that \u003ci\u003ea\u003c/i\u003e is a non-negative integer.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples\u003c/b\u003e:\u003c/p\u003e\u003cpre\u003e genLaguerrePoly(0,1)\r\n ans =\r\n     1 \u003c/pre\u003e\u003cpre\u003e genLaguerrePoly(1,1)\r\n ans =\r\n     -1    2 \u003c/pre\u003e\u003cpre\u003e genLaguerrePoly(2,1)\r\n ans =\r\n     0.5  -3    3\u003c/pre\u003e\u003cp\u003eNeither \u003cb\u003estring operations\u003c/b\u003e nor \u003cb\u003einterpolations\u003c/b\u003e are allowed!\u003c/p\u003e","function_template":"function P = genLaguerrePoly(n,a)\r\n  P = n*a;\r\nend","test_suite":"%%\r\nuser_solution = fileread('genLaguerrePoly.m');\r\nassert(isempty(strfind(user_solution,'regexp')));\r\nassert(isempty(strfind(user_solution,'2str')));\r\nassert(isempty(strfind(user_solution,'str2')));\r\nassert(isempty(strfind(user_solution,'interp')));\r\nassert(isempty(strfind(user_solution,'printf')));\r\nassert(isempty(strfind(user_solution,'assert')));\r\n\r\n%%\r\nn = 0;\r\na = 0;\r\nP_correct = [1]/1;\r\nassert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 1;\r\na = 0;\r\nP_correct = [-1 1]/1;\r\nassert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 2;\r\na = 0;\r\nP_correct = [1 -4 2]/2;\r\nassert(isequal(round(genLaguerrePoly(n,a)*2),round(P_correct*2)));\r\n\r\n%%\r\nn = 3;\r\na = 0;\r\nP_correct = [-1 9 -18 6]/6;\r\nassert(isequal(round(genLaguerrePoly(n,a)*6),round(P_correct*6)));\r\n\r\n%%\r\nn = 4;\r\na = 0;\r\nP_correct = [1 -16 72 -96 24]/24;\r\nassert(isequal(round(genLaguerrePoly(n,a)*24),round(P_correct*24)));\r\n\r\n%%\r\nn = 5;\r\na = 0;\r\nP_correct = [-1 25 -200 600 -600 120]/120;\r\nassert(isequal(round(genLaguerrePoly(n,a)*120),round(P_correct*120)));\r\n\r\n%%\r\nn = 6;\r\na = 0;\r\nP_correct = [1 -36 450 -2400 5400 -4320 720]/720;\r\nassert(isequal(round(genLaguerrePoly(n,a)*720),round(P_correct*720)));\r\n\r\n%%\r\nn = 0;\r\na = 1;\r\nP_correct = [1]/1;\r\nassert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 1;\r\na = 1;\r\nP_correct = [-1 2]/1;\r\nassert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 2;\r\na = 1;\r\nP_correct = [1 -6 6]/2;\r\nassert(isequal(round(genLaguerrePoly(n,a)*2),round(P_correct*2)));\r\n\r\n%%\r\nn = 3;\r\na = 1;\r\nP_correct = [-1 12 -36 24]/6;\r\nassert(isequal(round(genLaguerrePoly(n,a)*6),round(P_correct*6)));\r\n\r\n%%\r\nn = 4;\r\na = 1;\r\nP_correct = [1 -20 120 -240 120]/24;\r\nassert(isequal(round(genLaguerrePoly(n,a)*24),round(P_correct*24)));\r\n\r\n%%\r\nn = 5;\r\na = 1;\r\nP_correct = [-1 30 -300 1200 -1800 720]/120;\r\nassert(isequal(round(genLaguerrePoly(n,a)*120),round(P_correct*120)));\r\n\r\n%%\r\nn = 6;\r\na = 1;\r\nP_correct = [1 -42 630 -4200 12600 -15120 5040]/720;\r\nassert(isequal(round(genLaguerrePoly(n,a)*720),round(P_correct*720)));\r\n\r\n%%\r\nn = 0;\r\na = 2;\r\nP_correct = [1]/1;\r\nassert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 1;\r\na = 2;\r\nP_correct = [-1 3]/1;\r\nassert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 2;\r\na = 2;\r\nP_correct = [1 -8 12]/2;\r\nassert(isequal(round(genLaguerrePoly(n,a)*2),round(P_correct*2)));\r\n\r\n%%\r\nn = 3;\r\na = 2;\r\nP_correct = [-1 15 -60 60]/6;\r\nassert(isequal(round(genLaguerrePoly(n,a)*6),round(P_correct*6)));\r\n\r\n%%\r\nn = 4;\r\na = 2;\r\nP_correct = [1 -24 180 -480 360]/24;\r\nassert(isequal(round(genLaguerrePoly(n,a)*24),round(P_correct*24)));\r\n\r\n%%\r\nn = 5;\r\na = 2;\r\nP_correct = [-1 35 -420 2100 -4200 2520]/120;\r\nassert(isequal(round(genLaguerrePoly(n,a)*120),round(P_correct*120)));\r\n\r\n%%\r\nn = 6;\r\na = 2;\r\nP_correct = [1 -48 840 -6720 25200 -40320 20160]/720;\r\nassert(isequal(round(genLaguerrePoly(n,a)*720),round(P_correct*720)));\r\n\r\n%%\r\nn = 0;\r\na = 3;\r\nP_correct = [1]/1;\r\nassert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 1;\r\na = 3;\r\nP_correct = [-1 4]/1;\r\nassert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 2;\r\na = 3;\r\nP_correct = [1 -10 20]/2;\r\nassert(isequal(round(genLaguerrePoly(n,a)*2),round(P_correct*2)));\r\n\r\n%%\r\nn = 3;\r\na = 3;\r\nP_correct = [-1 18 -90 120]/6;\r\nassert(isequal(round(genLaguerrePoly(n,a)*6),round(P_correct*6)));\r\n\r\n%%\r\nn = 4;\r\na = 3;\r\nP_correct = [1 -28 252 -840 840]/24;\r\nassert(isequal(round(genLaguerrePoly(n,a)*24),round(P_correct*24)));\r\n\r\n%%\r\nn = 5;\r\na = 3;\r\nP_correct = [-1 40 -560 3360 -8400 6720]/120;\r\nassert(isequal(round(genLaguerrePoly(n,a)*120),round(P_correct*120)));\r\n\r\n%%\r\nn = 6;\r\na = 3;\r\nP_correct = [1 -54 1080 -10080 45360 -90720 60480]/720;\r\nassert(isequal(round(genLaguerrePoly(n,a)*720),round(P_correct*720)));\r\n\r\n%%\r\nn = 0;\r\na = 4;\r\nP_correct = [1]/1;\r\nassert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 1;\r\na = 4;\r\nP_correct = [-1 5]/1;\r\nassert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 2;\r\na = 4;\r\nP_correct = [1 -12 30]/2;\r\nassert(isequal(round(genLaguerrePoly(n,a)*2),round(P_correct*2)));\r\n\r\n%%\r\nn = 3;\r\na = 4;\r\nP_correct = [-1 21 -126 210]/6;\r\nassert(isequal(round(genLaguerrePoly(n,a)*6),round(P_correct*6)));\r\n\r\n%%\r\nn = 4;\r\na = 4;\r\nP_correct = [1 -32 336 -1344 1680]/24;\r\nassert(isequal(round(genLaguerrePoly(n,a)*24),round(P_correct*24)));\r\n\r\n%%\r\nn = 5;\r\na = 4;\r\nP_correct = [-1 45 -720 5040 -15120 15120]/120;\r\nassert(isequal(round(genLaguerrePoly(n,a)*120),round(P_correct*120)));\r\n\r\n%%\r\nn = 6;\r\na = 4;\r\nP_correct = [1 -60 1350 -14400 75600 -181440 151200]/720;\r\nassert(isequal(round(genLaguerrePoly(n,a)*720),round(P_correct*720)));\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":10352,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":65,"test_suite_updated_at":"2013-04-28T07:10:43.000Z","rescore_all_solutions":false,"group_id":25,"created_at":"2013-04-27T14:47:51.000Z","updated_at":"2026-02-15T03:40:37.000Z","published_at":"2013-04-27T14:58:52.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven an integer\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e ≥ 0 and a scalar\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ea\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, generate the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e-th\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Laguerre_polynomials#Generalized_Laguerre_polynomials\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGeneralized Laguerre polynomial\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e of association degree\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ea\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor simplicity, assume that\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ea\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is a non-negative integer.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ genLaguerrePoly(0,1)\\n ans =\\n     1 \\n\\n genLaguerrePoly(1,1)\\n ans =\\n     -1    2 \\n\\n genLaguerrePoly(2,1)\\n ans =\\n     0.5  -3    3]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNeither\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estring operations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e nor\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003einterpolations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are allowed!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1474,"title":"Chebyshev polynomials of the 1st Kind","description":"Given an integer _n_ \u0026ge; 0, generate the _n_-th \u003chttp://en.wikipedia.org/wiki/Chebyshev_polynomials Chebyshev polynomial of the 1st Kind\u003e.\r\n\r\n*Examples*:\r\n\r\n chebyshev1stKindPoly(0)\r\n ans =\r\n     1\r\n\r\n chebyshev1stKindPoly(1)\r\n ans =\r\n     1     0\r\n\r\n chebyshev1stKindPoly(2)\r\n ans =\r\n     2     0    -1\r\n\r\nNeither *string operations* nor *interpolations* are allowed!\r\n","description_html":"\u003cp\u003eGiven an integer \u003ci\u003en\u003c/i\u003e \u0026ge; 0, generate the \u003ci\u003en\u003c/i\u003e-th \u003ca href = \"http://en.wikipedia.org/wiki/Chebyshev_polynomials\"\u003eChebyshev polynomial of the 1st Kind\u003c/a\u003e.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples\u003c/b\u003e:\u003c/p\u003e\u003cpre\u003e chebyshev1stKindPoly(0)\r\n ans =\r\n     1\u003c/pre\u003e\u003cpre\u003e chebyshev1stKindPoly(1)\r\n ans =\r\n     1     0\u003c/pre\u003e\u003cpre\u003e chebyshev1stKindPoly(2)\r\n ans =\r\n     2     0    -1\u003c/pre\u003e\u003cp\u003eNeither \u003cb\u003estring operations\u003c/b\u003e nor \u003cb\u003einterpolations\u003c/b\u003e are allowed!\u003c/p\u003e","function_template":"function P = chebyshev1stKindPoly(n)\r\n  P = n;\r\nend","test_suite":"%%\r\nuser_solution = fileread('chebyshev1stKindPoly.m');\r\nassert(isempty(strfind(user_solution,'regexp')));\r\nassert(isempty(strfind(user_solution,'2str')));\r\nassert(isempty(strfind(user_solution,'str2')));\r\nassert(isempty(strfind(user_solution,'interp')));\r\nassert(isempty(strfind(user_solution,'printf')));\r\nassert(isempty(strfind(user_solution,'assert')));\r\n\r\n%%\r\nn = 0;\r\nP_correct = [1];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 1;\r\nP_correct = [1 0];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 2;\r\nP_correct = [2 0 -1];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 3;\r\nP_correct = [4 0 -3 0];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 4;\r\nP_correct = [8 0 -8 0 1];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 5;\r\nP_correct = [16 0 -20 0 5 0];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 6;\r\nP_correct = [32 0 -48 0 18 0 -1];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 7;\r\nP_correct = [64 0 -112 0 56 0 -7 0];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 8;\r\nP_correct = [128 0 -256 0 160 0 -32 0 1];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 9;\r\nP_correct = [256 0 -576 0 432 0 -120 0 9 0];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 10;\r\nP_correct = [512 0 -1280 0 1120 0 -400 0 50 0 -1];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 11;\r\nP_correct = [1024 0 -2816 0 2816 0 -1232 0 220 0 -11 0];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 12;\r\nP_correct = [2048 0 -6144 0 6912 0 -3584 0 840 0 -72 0 1];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 13;\r\nP_correct = [4096 0 -13312 0 16640 0 -9984 0 2912 0 -364 0 13 0];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 14;\r\nP_correct = [8192 0 -28672 0 39424 0 -26880 0 9408 0 -1568 0 98 0 -1];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 15;\r\nP_correct = [16384 0 -61440 0 92160 0 -70400 0 28800 0 -6048 0 560 0 -15 0];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":10352,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":81,"test_suite_updated_at":"2013-04-30T12:30:22.000Z","rescore_all_solutions":false,"group_id":25,"created_at":"2013-04-30T11:25:32.000Z","updated_at":"2026-04-01T10:38:08.000Z","published_at":"2013-04-30T11:27:15.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven an integer\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e ≥ 0, generate the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e-th\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Chebyshev_polynomials\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eChebyshev polynomial of the 1st Kind\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ chebyshev1stKindPoly(0)\\n ans =\\n     1\\n\\n chebyshev1stKindPoly(1)\\n ans =\\n     1     0\\n\\n chebyshev1stKindPoly(2)\\n ans =\\n     2     0    -1]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNeither\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estring operations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e nor\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003einterpolations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are allowed!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1475,"title":"Chebyshev polynomials of the 2nd Kind","description":"Given an integer _n_ \u0026ge; 0, generate the _n_-th \u003chttp://en.wikipedia.org/wiki/Chebyshev_polynomials Chebyshev polynomial of the 2nd Kind\u003e.\r\n\r\n*Examples*:\r\n\r\n chebyshev2ndKindPoly(0)\r\n ans =\r\n     1\r\n\r\n chebyshev2ndKindPoly(1)\r\n ans =\r\n     2     0\r\n\r\n chebyshev2ndKindPoly(2)\r\n ans =\r\n     4     0    -1\r\n\r\nNeither *string operations* nor *interpolations* are allowed!\r\n","description_html":"\u003cp\u003eGiven an integer \u003ci\u003en\u003c/i\u003e \u0026ge; 0, generate the \u003ci\u003en\u003c/i\u003e-th \u003ca href = \"http://en.wikipedia.org/wiki/Chebyshev_polynomials\"\u003eChebyshev polynomial of the 2nd Kind\u003c/a\u003e.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples\u003c/b\u003e:\u003c/p\u003e\u003cpre\u003e chebyshev2ndKindPoly(0)\r\n ans =\r\n     1\u003c/pre\u003e\u003cpre\u003e chebyshev2ndKindPoly(1)\r\n ans =\r\n     2     0\u003c/pre\u003e\u003cpre\u003e chebyshev2ndKindPoly(2)\r\n ans =\r\n     4     0    -1\u003c/pre\u003e\u003cp\u003eNeither \u003cb\u003estring operations\u003c/b\u003e nor \u003cb\u003einterpolations\u003c/b\u003e are allowed!\u003c/p\u003e","function_template":"function P = chebyshev2ndKindPoly(n)\r\n  P = n;\r\nend","test_suite":"%%\r\nuser_solution = fileread('chebyshev2ndKindPoly.m');\r\nassert(isempty(strfind(user_solution,'regexp')));\r\nassert(isempty(strfind(user_solution,'2str')));\r\nassert(isempty(strfind(user_solution,'str2')));\r\nassert(isempty(strfind(user_solution,'interp')));\r\nassert(isempty(strfind(user_solution,'printf')));\r\nassert(isempty(strfind(user_solution,'assert')));\r\n\r\n%%\r\nn = 0;\r\nP_correct = [1];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 1;\r\nP_correct = [2 0];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 2;\r\nP_correct = [4 0 -1];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 3;\r\nP_correct = [8 0 -4 0];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 4;\r\nP_correct = [16 0 -12 0 1];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 5;\r\nP_correct = [32 0 -32 0 6 0];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 6;\r\nP_correct = [64 0 -80 0 24 0 -1];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 7;\r\nP_correct = [128 0 -192 0 80 0 -8 0];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 8;\r\nP_correct = [256 0 -448 0 240 0 -40 0 1];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 9;\r\nP_correct = [512 0 -1024 0 672 0 -160 0 10 0];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 10;\r\nP_correct = [1024 0 -2304 0 1792 0 -560 0 60 0 -1];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 11;\r\nP_correct = [2048 0 -5120 0 4608 0 -1792 0 280 0 -12 0];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 12;\r\nP_correct = [4096 0 -11264 0 11520 0 -5376 0 1120 0 -84 0 1];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 13;\r\nP_correct = [8192 0 -24576 0 28160 0 -15360 0 4032 0 -448 0 14 0];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 14;\r\nP_correct = [16384 0 -53248 0 67584 0 -42240 0 13440 0 -2016 0 112 0 -1];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 15;\r\nP_correct = [32768 0 -114688 0 159744 0 -112640 0 42240 0 -8064 0 672 0 -16 0];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":10352,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":78,"test_suite_updated_at":"2013-04-30T12:30:53.000Z","rescore_all_solutions":false,"group_id":25,"created_at":"2013-04-30T11:26:00.000Z","updated_at":"2026-02-15T03:46:10.000Z","published_at":"2013-04-30T11:27:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven an integer\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e ≥ 0, generate the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e-th\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Chebyshev_polynomials\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eChebyshev polynomial of the 2nd Kind\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ chebyshev2ndKindPoly(0)\\n ans =\\n     1\\n\\n chebyshev2ndKindPoly(1)\\n ans =\\n     2     0\\n\\n chebyshev2ndKindPoly(2)\\n ans =\\n     4     0    -1]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNeither\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estring operations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e nor\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003einterpolations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are allowed!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1464,"title":"Laguerre polynomials","description":"Given an integer _n_ \u0026ge; 0, generate the _n_-th \u003chttp://en.wikipedia.org/wiki/Laguerre_polynomials Laguerre polynomial\u003e.\r\n\r\n*Examples*:\r\n\r\n laguerrePoly(0)\r\n ans =\r\n     1 \r\n\r\n laguerrePoly(1)\r\n ans =\r\n     -1     1 \r\n\r\n laguerrePoly(2)\r\n ans =\r\n     0.5   -2     1\r\n\r\nNeither *string operations* nor *interpolations* are allowed!\r\n","description_html":"\u003cp\u003eGiven an integer \u003ci\u003en\u003c/i\u003e \u0026ge; 0, generate the \u003ci\u003en\u003c/i\u003e-th \u003ca href = \"http://en.wikipedia.org/wiki/Laguerre_polynomials\"\u003eLaguerre polynomial\u003c/a\u003e.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples\u003c/b\u003e:\u003c/p\u003e\u003cpre\u003e laguerrePoly(0)\r\n ans =\r\n     1 \u003c/pre\u003e\u003cpre\u003e laguerrePoly(1)\r\n ans =\r\n     -1     1 \u003c/pre\u003e\u003cpre\u003e laguerrePoly(2)\r\n ans =\r\n     0.5   -2     1\u003c/pre\u003e\u003cp\u003eNeither \u003cb\u003estring operations\u003c/b\u003e nor \u003cb\u003einterpolations\u003c/b\u003e are allowed!\u003c/p\u003e","function_template":"function P = laguerrePoly(n)\r\n  P = n;\r\nend","test_suite":"%%\r\nuser_solution = fileread('laguerrePoly.m');\r\nassert(isempty(strfind(user_solution,'regexp')));\r\nassert(isempty(strfind(user_solution,'2str')));\r\nassert(isempty(strfind(user_solution,'str2')));\r\nassert(isempty(strfind(user_solution,'interp')));\r\nassert(isempty(strfind(user_solution,'printf')));\r\nassert(isempty(strfind(user_solution,'assert')));\r\n\r\n%%\r\nn = 0;\r\nP_correct = [1]/1;\r\nassert(isequal(round(laguerrePoly(n)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 1;\r\nP_correct = [-1 1]/1;\r\nassert(isequal(round(laguerrePoly(n)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 2;\r\nP_correct = [1 -4 2]/2;\r\nassert(isequal(round(laguerrePoly(n)*2),round(P_correct*2)));\r\n\r\n%%\r\nn = 3;\r\nP_correct = [-1 9 -18 6]/6;\r\nassert(isequal(round(laguerrePoly(n)*6),round(P_correct*6)));\r\n\r\n%%\r\nn = 4;\r\nP_correct = [1 -16 72 -96 24]/24;\r\nassert(isequal(round(laguerrePoly(n)*24),round(P_correct*24)));\r\n\r\n%%\r\nn = 5;\r\nP_correct = [-1 25 -200 600 -600 120]/120;\r\nassert(isequal(round(laguerrePoly(n)*120),round(P_correct*120)));\r\n\r\n%%\r\nn = 6;\r\nP_correct = [1 -36 450 -2400 5400 -4320 720]/720;\r\nassert(isequal(round(laguerrePoly(n)*720),round(P_correct*720)));\r\n\r\n%%\r\nn = 7;\r\nP_correct = [-1 49 -882 7350 -29400 52920 -35280 5040]/5040;\r\nassert(isequal(round(laguerrePoly(n)*5040),round(P_correct*5040)));\r\n\r\n%%\r\nn = 8;\r\nP_correct = [1 -64 1568 -18816 117600 -376320 564480 -322560 40320]/40320;\r\nassert(isequal(round(laguerrePoly(n)*40320),round(P_correct*40320)));\r\n\r\n%%\r\nn = 9;\r\nP_correct = [-1 81 -2592 42336 -381024 1905120 -5080320 6531840 -3265920 362880]/362880;\r\nassert(isequal(round(laguerrePoly(n)*362880),round(P_correct*362880)));\r\n\r\n%%\r\nn = 10;\r\nP_correct = [1 -100 4050 -86400 1058400 -7620480 31752000 -72576000 81648000 -36288000 3628800]/3628800;\r\nassert(isequal(round(laguerrePoly(n)*3628800),round(P_correct*3628800)));\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":10352,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":85,"test_suite_updated_at":"2013-04-28T07:10:18.000Z","rescore_all_solutions":false,"group_id":25,"created_at":"2013-04-27T14:28:54.000Z","updated_at":"2026-02-15T03:37:58.000Z","published_at":"2013-04-27T14:30:51.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven an integer\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e ≥ 0, generate the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e-th\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Laguerre_polynomials\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eLaguerre polynomial\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ laguerrePoly(0)\\n ans =\\n     1 \\n\\n laguerrePoly(1)\\n ans =\\n     -1     1 \\n\\n laguerrePoly(2)\\n ans =\\n     0.5   -2     1]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNeither\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estring operations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e nor\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003einterpolations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are allowed!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":481,"title":"Rosenbrock's Banana Function and its derivatives","description":"Write a function to return the value of \u003chttp://en.wikipedia.org/wiki/Rosenbrock_function Rosenbrock's two-dimensional banana function\u003e, as well as it's gradient (column) vector and Hessian matrix, given a vector of it's two independent variables _x1_ and _x2_. Here's the Rosenbrock function: \r\n\r\n 100*[(x2-x1^2)^2] + (1-x1)^2","description_html":"\u003cp\u003eWrite a function to return the value of \u003ca href=\"http://en.wikipedia.org/wiki/Rosenbrock_function\"\u003eRosenbrock's two-dimensional banana function\u003c/a\u003e, as well as it's gradient (column) vector and Hessian matrix, given a vector of it's two independent variables \u003ci\u003ex1\u003c/i\u003e and \u003ci\u003ex2\u003c/i\u003e. Here's the Rosenbrock function:\u003c/p\u003e\u003cpre\u003e 100*[(x2-x1^2)^2] + (1-x1)^2\u003c/pre\u003e","function_template":"function [value,gradient,Hessian] = Rosenbrock_banana(x)\r\n  value = x;\r\n  gradient = [0; 0];\r\n  Hessian = [0, 0; 0, 0]\r\nend","test_suite":"%%\r\nassert(isempty(regexp(fileread('Rosenbrock_banana.m'),'assert.m')))\r\n%%\r\nx = [0; 0];\r\nassert(isequal(Rosenbrock_banana(x),1))\r\n%%\r\nx = [1; 1];\r\nassert(isequal(Rosenbrock_banana(x),0))\r\n%%\r\nx = [1; -1];\r\nassert(isequal(Rosenbrock_banana(x),400))\r\n%%\r\nx = [-1; 0.5];\r\nassert(isequal(Rosenbrock_banana(x),29))\r\n%%\r\nx = [0; 0];\r\n[~,grad]=Rosenbrock_banana(x);\r\nassert(isequal(grad,[-2; 0]))\r\n%%\r\nx = [0; 0];\r\n[~,~,Hess]=Rosenbrock_banana(x);\r\nassert(isequal(Hess,diag([2, 200])))\r\n%%\r\nx = [1; 1];\r\n[~,grad]=Rosenbrock_banana(x);\r\nassert(isequal(grad,[0; 0]))\r\n%%\r\nx = [1; 1];\r\n[~,~,Hess]=Rosenbrock_banana(x);\r\nassert(isequal(Hess,[802, -400; -400, 200]))\r\n%%\r\nx = [-1.9; 2];\r\ncorrect_value = 267.6200;\r\ncorrect_grad = -1e3*[1.2294; 0.3220];\r\ncorrect_Hess = [3534, 760; 760, 200];\r\n[val,grad,Hess]=Rosenbrock_banana(x);\r\nassert(isequal(str2num(num2str(val)),correct_value))\r\nassert(isequal(str2num(num2str(grad)),correct_grad))\r\nassert(all(max(abs(Hess-correct_Hess)\u003c1e-8)))","published":true,"deleted":false,"likes_count":2,"comments_count":2,"created_by":279,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":166,"test_suite_updated_at":"2013-08-25T01:30:52.000Z","rescore_all_solutions":false,"group_id":25,"created_at":"2012-03-12T05:01:12.000Z","updated_at":"2026-03-29T19:32:52.000Z","published_at":"2012-03-12T21:14:57.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to return the value of\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Rosenbrock_function\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRosenbrock's two-dimensional banana function\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, as well as it's gradient (column) vector and Hessian matrix, given a vector of it's two independent variables\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex1\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. Here's the Rosenbrock function:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 100*[(x2-x1^2)^2] + (1-x1)^2]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1473,"title":"Legendre polynomials","description":"Given an integer _n_ \u0026ge; 0, generate the _n_-th \u003chttp://en.wikipedia.org/wiki/Legendre_polynomials Legendre polynomial\u003e.\r\n\r\n*Examples*:\r\n\r\n legendrePoly(0)\r\n ans =\r\n     1\r\n\r\n legendrePoly(1)\r\n ans =\r\n     1     0\r\n\r\n legendrePoly(2)\r\n ans =\r\n     1.5   0   -0.5\r\n\r\nNeither *string operations* nor *interpolations* are allowed!\r\n","description_html":"\u003cp\u003eGiven an integer \u003ci\u003en\u003c/i\u003e \u0026ge; 0, generate the \u003ci\u003en\u003c/i\u003e-th \u003ca href = \"http://en.wikipedia.org/wiki/Legendre_polynomials\"\u003eLegendre polynomial\u003c/a\u003e.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples\u003c/b\u003e:\u003c/p\u003e\u003cpre\u003e legendrePoly(0)\r\n ans =\r\n     1\u003c/pre\u003e\u003cpre\u003e legendrePoly(1)\r\n ans =\r\n     1     0\u003c/pre\u003e\u003cpre\u003e legendrePoly(2)\r\n ans =\r\n     1.5   0   -0.5\u003c/pre\u003e\u003cp\u003eNeither \u003cb\u003estring operations\u003c/b\u003e nor \u003cb\u003einterpolations\u003c/b\u003e are allowed!\u003c/p\u003e","function_template":"function P = legendrePoly(n)\r\n  P = n;\r\nend","test_suite":"%%\r\nuser_solution = fileread('legendrePoly.m');\r\nassert(isempty(strfind(user_solution,'regexp')));\r\nassert(isempty(strfind(user_solution,'2str')));\r\nassert(isempty(strfind(user_solution,'str2')));\r\nassert(isempty(strfind(user_solution,'interp')));\r\nassert(isempty(strfind(user_solution,'printf')));\r\nassert(isempty(strfind(user_solution,'assert')));\r\n\r\n%%\r\nn = 0;\r\nP_correct = [1]/1;\r\nassert(isequal(round(legendrePoly(n)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 1;\r\nP_correct = [1 0]/1;\r\nassert(isequal(round(legendrePoly(n)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 2;\r\nP_correct = [3 0 -1]/2;\r\nassert(isequal(round(legendrePoly(n)*2),round(P_correct*2)));\r\n\r\n%%\r\nn = 3;\r\nP_correct = [5 0 -3 0]/2;\r\nassert(isequal(round(legendrePoly(n)*2),round(P_correct*2)));\r\n\r\n%%\r\nn = 4;\r\nP_correct = [35 0 -30 0 3]/8;\r\nassert(isequal(round(legendrePoly(n)*8),round(P_correct*8)));\r\n\r\n%%\r\nn = 5;\r\nP_correct = [63 0 -70 0 15 0]/8;\r\nassert(isequal(round(legendrePoly(n)*8),round(P_correct*8)));\r\n\r\n%%\r\nn = 6;\r\nP_correct = [231 0 -315 0 105 0 -5]/16;\r\nassert(isequal(round(legendrePoly(n)*16),round(P_correct*16)));\r\n\r\n%%\r\nn = 7;\r\nP_correct = [429 0 -693 0 315 0 -35 0]/16;\r\nassert(isequal(round(legendrePoly(n)*16),round(P_correct*16)));\r\n\r\n%%\r\nn = 8;\r\nP_correct = [6435 0 -12012 0 6930 0 -1260 0 35]/128;\r\nassert(isequal(round(legendrePoly(n)*128),round(P_correct*128)));\r\n\r\n%%\r\nn = 9;\r\nP_correct = [12155 0 -25740 0 18018 0 -4620 0 315 0]/128;\r\nassert(isequal(round(legendrePoly(n)*128),round(P_correct*128)));\r\n\r\n%%\r\nn = 10;\r\nP_correct = [46189 0 -109395 0 90090 0 -30030 0 3465 0 -63]/256;\r\nassert(isequal(round(legendrePoly(n)*256),round(P_correct*256)));\r\n\r\n%%\r\nn = 11;\r\nP_correct = [88179 0 -230945 0 218790 0 -90090 0 15015 0 -693 0]/256;\r\nassert(isequal(round(legendrePoly(n)*256),round(P_correct*256)));\r\n\r\n%%\r\nn = 12;\r\nP_correct = [676039 0 -1939938 0 2078505 0 -1021020 0 225225 0 -18018 0 231]/1024;\r\nassert(isequal(round(legendrePoly(n)*1024),round(P_correct*1024)));\r\n\r\n%%\r\nn = 13;\r\nP_correct = [1300075 0 -4056234 0 4849845 0 -2771340 0 765765 0 -90090 0 3003 0]/1024;\r\nassert(isequal(round(legendrePoly(n)*1024),round(P_correct*1024)));\r\n\r\n%%\r\nn = 14;\r\nP_correct = [5014575 0 -16900975 0 22309287 0 -14549535 0 4849845 0 -765765 0 45045 0 -429]/2048;\r\nassert(isequal(round(legendrePoly(n)*2048),round(P_correct*2048)));\r\n\r\n%%\r\nn = 15;\r\nP_correct = [9694845 0 -35102025 0 50702925 0 -37182145 0 14549535 0 -2909907 0 255255 0 -6435 0]/2048;\r\nassert(isequal(round(legendrePoly(n)*2048),round(P_correct*2048)));\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":10352,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":73,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":25,"created_at":"2013-04-30T10:43:53.000Z","updated_at":"2026-04-01T10:26:23.000Z","published_at":"2013-04-30T10:45:41.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven an integer\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e ≥ 0, generate the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e-th\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Legendre_polynomials\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eLegendre polynomial\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ legendrePoly(0)\\n ans =\\n     1\\n\\n legendrePoly(1)\\n ans =\\n     1     0\\n\\n legendrePoly(2)\\n ans =\\n     1.5   0   -0.5]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNeither\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estring operations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e nor\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003einterpolations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are allowed!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":2383,"title":"Kepler's Equation","description":"Solve \u003chttp://en.wikipedia.org/wiki/Kepler's_equation Kepler's Equation\u003e. \r\n\r\nNote that the solution is rounded down to 5 decimal places at the test suite.\r\n\r\nInputs:\r\n\r\n* M    mean anomaly [rad]\r\n* e    eccentricity [1]\r\n\r\nOutputs:\r\n\r\n* E    eccentric anomaly [rad]","description_html":"\u003cp\u003eSolve \u003ca href = \"http://en.wikipedia.org/wiki/Kepler's_equation\"\u003eKepler's Equation\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eNote that the solution is rounded down to 5 decimal places at the test suite.\u003c/p\u003e\u003cp\u003eInputs:\u003c/p\u003e\u003cul\u003e\u003cli\u003eM    mean anomaly [rad]\u003c/li\u003e\u003cli\u003ee    eccentricity [1]\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eOutputs:\u003c/p\u003e\u003cul\u003e\u003cli\u003eE    eccentric anomaly [rad]\u003c/li\u003e\u003c/ul\u003e","function_template":"function E = kepler(M, e)\r\n    E = M;\r\nend","test_suite":"%%\r\nM = pi/2;\r\ne = 0;\r\nassert(isequal(round(kepler(M, e)*1e5)/1e5, 1.5708))\r\n%%\r\nM = pi/2;\r\ne = 0.8;\r\nassert(isequal(round(kepler(M, e)*1e5)/1e5, 2.21193))\r\n%%\r\nM = pi/3;\r\ne = 0.1;\r\nassert(isequal(round(kepler(M, e)*1e5)/1e5, 1.13798))\r\n%%\r\nM = 0.1;\r\ne = 0.2;\r\nassert(isequal(round(kepler(M, e)*1e5)/1e5, 0.12492))","published":true,"deleted":false,"likes_count":8,"comments_count":0,"created_by":20319,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":170,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":25,"created_at":"2014-06-23T15:06:25.000Z","updated_at":"2026-02-15T03:48:51.000Z","published_at":"2014-06-23T15:08:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSolve\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Kepler's_equation\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eKepler's Equation\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNote that the solution is rounded down to 5 decimal places at the test suite.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInputs:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eM mean anomaly [rad]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ee eccentricity [1]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOutputs:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eE eccentric anomaly [rad]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1304,"title":"Hermite Polynomials","description":"Return the _n_-th \u003chttp://en.wikipedia.org/wiki/Hermite_polynomials Hermite polynomial\u003e of the physicists' type.\r\n\r\nAssume that _n_ is a non-negative finite integer. \r\n\r\n*Examples*:\r\n\r\n hermite_poly(0)\r\n ans = \r\n     1\r\n \r\n hermite_poly(1)\r\n ans = \r\n     2     0\r\n\r\n hermite_poly(2)\r\n ans = \r\n     4     0   -2\r\n\r\n hermite_poly(3)\r\n ans = \r\n     8     0   -12     0\r\n\r\nNeither *string operations* nor *interpolations* are allowed!\r\n","description_html":"\u003cp\u003eReturn the \u003ci\u003en\u003c/i\u003e-th \u003ca href = \"http://en.wikipedia.org/wiki/Hermite_polynomials\"\u003eHermite polynomial\u003c/a\u003e of the physicists' type.\u003c/p\u003e\u003cp\u003eAssume that \u003ci\u003en\u003c/i\u003e is a non-negative finite integer.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples\u003c/b\u003e:\u003c/p\u003e\u003cpre\u003e hermite_poly(0)\r\n ans = \r\n     1\u003c/pre\u003e\u003cpre\u003e hermite_poly(1)\r\n ans = \r\n     2     0\u003c/pre\u003e\u003cpre\u003e hermite_poly(2)\r\n ans = \r\n     4     0   -2\u003c/pre\u003e\u003cpre\u003e hermite_poly(3)\r\n ans = \r\n     8     0   -12     0\u003c/pre\u003e\u003cp\u003eNeither \u003cb\u003estring operations\u003c/b\u003e nor \u003cb\u003einterpolations\u003c/b\u003e are allowed!\u003c/p\u003e","function_template":"function p = hermite_poly(n)\r\n  p = n;\r\nend","test_suite":"%%\r\nuser_solution = fileread('hermite_poly.m');\r\nassert(isempty(strfind(user_solution,'regexp')));\r\nassert(isempty(strfind(user_solution,'2str')));\r\nassert(isempty(strfind(user_solution,'str2')));\r\nassert(isempty(strfind(user_solution,'interp')));\r\nassert(isempty(strfind(user_solution,'printf')));\r\nassert(isempty(strfind(user_solution,'assert')));\r\n\r\n%%\r\nn = 0;\r\nP_correct = [1];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 1;\r\nP_correct = [2 0];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 2;\r\nP_correct = [4 0 -2];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 3;\r\nP_correct = [8 0 -12 -0];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 4;\r\nP_correct = [16 0 -48 -0 12];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 5;\r\nP_correct = [32 0 -160 -0 120 0];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 6;\r\nP_correct = [64 0 -480 -0 720 0 -120];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 7;\r\nP_correct = [128 0 -1344 -0 3360 0 -1680 -0];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 8;\r\nP_correct = [256 0 -3584 -0 13440 0 -13440 -0 1680];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 9;\r\nP_correct = [512 0 -9216 -0 48384 0 -80640 -0 30240 0];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 10;\r\nP_correct = [1024 0 -23040 -0 161280 0 -403200 -0 302400 0 -30240];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 11;\r\nP_correct = [2048 0 -56320 -0 506880 0 -1774080 -0 2217600 0 -665280 -0];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 12;\r\nP_correct = [4096 0 -135168 -0 1520640 0 -7096320 -0 13305600 0 -7983360 -0 665280];\r\nassert(isequal(hermite_poly(n),P_correct));","published":true,"deleted":false,"likes_count":4,"comments_count":1,"created_by":10352,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":90,"test_suite_updated_at":"2013-04-28T07:05:09.000Z","rescore_all_solutions":false,"group_id":25,"created_at":"2013-02-27T09:28:44.000Z","updated_at":"2026-02-15T03:35:58.000Z","published_at":"2013-02-27T09:28:44.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReturn the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e-th\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Hermite_polynomials\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eHermite polynomial\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e of the physicists' type.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAssume that\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is a non-negative finite integer.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ hermite_poly(0)\\n ans = \\n     1\\n\\n hermite_poly(1)\\n ans = \\n     2     0\\n\\n hermite_poly(2)\\n ans = \\n     4     0   -2\\n\\n hermite_poly(3)\\n ans = \\n     8     0   -12     0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNeither\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estring operations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e nor\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003einterpolations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are allowed!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":656,"title":"Calculate Euler's phi function","description":"Compute the Euler's phi function of a large integer.\r\n\r\nFor more information about this topic please visit:\r\n\u003chttps://en.wikipedia.org/wiki/Euler%27s_totient_function Euler's totient function\u003e.\r\n\r\nWith these constraints:\r\n\r\n* n is a nonnegative integer greater than 0.\r\n* \"large integer\" means 32bit integer\r\n* vectorized Input\r\n\r\nExamples:\r\n\r\n# eulerphi(4)  =  2\r\n# eulerphi(11) = 10","description_html":"\u003cp\u003eCompute the Euler's phi function of a large integer.\u003c/p\u003e\u003cp\u003eFor more information about this topic please visit: \u003ca href = \"https://en.wikipedia.org/wiki/Euler%27s_totient_function\"\u003eEuler's totient function\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eWith these constraints:\u003c/p\u003e\u003cul\u003e\u003cli\u003en is a nonnegative integer greater than 0.\u003c/li\u003e\u003cli\u003e\"large integer\" means 32bit integer\u003c/li\u003e\u003cli\u003evectorized Input\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eExamples:\u003c/p\u003e\u003col\u003e\u003cli\u003eeulerphi(4)  =  2\u003c/li\u003e\u003cli\u003eeulerphi(11) = 10\u003c/li\u003e\u003c/ol\u003e","function_template":"function phi = eulerphi(n)\r\n  phi = n-1;\r\nend","test_suite":"%% vectorized\r\ny_correct = [ 1, 1, 2, 2, 4, 2, 6, 4, 6, 4, 10, ...\r\n              4, 12, 6, 8, 8, 16, 6, 18, 8, 12, ...\r\n             10, 22, 8, 20, 12, 18, 12, 28, 8, ...\r\n             30, 16, 20, 16, 24, 12, 36, 18, 24, ...\r\n             16, 40, 12, 42, 20, 24, 22, 46, 16, ...\r\n             42, 20, 32, 24, 52, 18, 40, 24, 36, 28, ...\r\n             58, 16, 60, 30, 36, 32, 48, 20, 66, 32, ...\r\n             44, 24, 70, 24, 72, 36, 40, 36, 60, 24, ...\r\n             78, 32, 54, 40, 82, 24, 64, 42, 56, 40, ...\r\n             88, 24, 72, 44, 60, 46, 72, 32, 96, 42, 60];\r\nassert(isequal(eulerphi(1:99),y_correct))\r\n\r\n%% int16\r\nassert(isequal(eulerphi(double(intmax('int16'))), 27000))\r\nassert(isequal(eulerphi(double(intmax('uint16'))),32768))\r\n\r\n%% int32\r\nassert(isequal(eulerphi(double(intmax('int32'))), 2147483646))\r\nassert(isequal(eulerphi(double(intmax('uint32'))),2147483648))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":1696,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":101,"test_suite_updated_at":"2012-05-04T22:38:59.000Z","rescore_all_solutions":false,"group_id":25,"created_at":"2012-05-04T18:22:28.000Z","updated_at":"2026-02-15T03:21:47.000Z","published_at":"2012-05-04T18:22:28.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCompute the Euler's phi function of a large integer.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor more information about this topic please visit:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Euler%27s_totient_function\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eEuler's totient function\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWith these constraints:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003en is a nonnegative integer greater than 0.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\"large integer\\\" means 32bit integer\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003evectorized Input\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eeulerphi(4) = 2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eeulerphi(11) = 10\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1476,"title":"Radial Zernike polynomials","description":"Given an integer _n_ \u0026ge; 0 and an integer _m_ \u0026ge; 0, generate the \u003chttp://en.wikipedia.org/wiki/Zernike_polynomials radial Zernike polynomial\u003e of radial degree _n_ and azimuthal degree _m_. You may assume that |mod(n-m,2)==0| and _m_ \u0026le; _n_.\r\n\r\n*Examples*:\r\n\r\n radialZernike(0,0)\r\n ans =\r\n     1\r\n\r\n radialZernike(1,1)\r\n ans =\r\n     1     0\r\n\r\n radialZernike(2,0)\r\n ans =\r\n     2     0    -1\r\n\r\n radialZernike(2,2)\r\n ans =\r\n     1     0     0\r\n\r\nNeither *string operations* nor *interpolations* are allowed!\r\n","description_html":"\u003cp\u003eGiven an integer \u003ci\u003en\u003c/i\u003e \u0026ge; 0 and an integer \u003ci\u003em\u003c/i\u003e \u0026ge; 0, generate the \u003ca href = \"http://en.wikipedia.org/wiki/Zernike_polynomials\"\u003eradial Zernike polynomial\u003c/a\u003e of radial degree \u003ci\u003en\u003c/i\u003e and azimuthal degree \u003ci\u003em\u003c/i\u003e. You may assume that \u003ctt\u003emod(n-m,2)==0\u003c/tt\u003e and \u003ci\u003em\u003c/i\u003e \u0026le; \u003ci\u003en\u003c/i\u003e.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples\u003c/b\u003e:\u003c/p\u003e\u003cpre\u003e radialZernike(0,0)\r\n ans =\r\n     1\u003c/pre\u003e\u003cpre\u003e radialZernike(1,1)\r\n ans =\r\n     1     0\u003c/pre\u003e\u003cpre\u003e radialZernike(2,0)\r\n ans =\r\n     2     0    -1\u003c/pre\u003e\u003cpre\u003e radialZernike(2,2)\r\n ans =\r\n     1     0     0\u003c/pre\u003e\u003cp\u003eNeither \u003cb\u003estring operations\u003c/b\u003e nor \u003cb\u003einterpolations\u003c/b\u003e are allowed!\u003c/p\u003e","function_template":"function P = radialZernike(n,m)\r\n  P = n*m;\r\nend","test_suite":"%%\r\nuser_solution = fileread('radialZernike.m');\r\nassert(isempty(strfind(user_solution,'regexp')));\r\nassert(isempty(strfind(user_solution,'2str')));\r\nassert(isempty(strfind(user_solution,'str2')));\r\nassert(isempty(strfind(user_solution,'interp')));\r\nassert(isempty(strfind(user_solution,'printf')));\r\nassert(isempty(strfind(user_solution,'assert')));\r\n\r\n%%\r\nn = 0;\r\nm = 0;\r\nP_correct = [1];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 1;\r\nm = 1;\r\nP_correct = [1 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 2;\r\nm = 0;\r\nP_correct = [2 0 -1];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 2;\r\nm = 2;\r\nP_correct = [1 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 3;\r\nm = 1;\r\nP_correct = [3 0 -2 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 3;\r\nm = 3;\r\nP_correct = [1 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 4;\r\nm = 0;\r\nP_correct = [6 0 -6 0 1];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 4;\r\nm = 2;\r\nP_correct = [4 0 -3 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 4;\r\nm = 4;\r\nP_correct = [1 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 5;\r\nm = 1;\r\nP_correct = [10 0 -12 0 3 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 5;\r\nm = 3;\r\nP_correct = [5 0 -4 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 5;\r\nm = 5;\r\nP_correct = [1 0 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 6;\r\nm = 0;\r\nP_correct = [20 0 -30 0 12 0 -1];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 6;\r\nm = 2;\r\nP_correct = [15 0 -20 0 6 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 6;\r\nm = 4;\r\nP_correct = [6 0 -5 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 6;\r\nm = 6;\r\nP_correct = [1 0 0 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 7;\r\nm = 1;\r\nP_correct = [35 0 -60 0 30 0 -4 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 7;\r\nm = 3;\r\nP_correct = [21 0 -30 0 10 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 7;\r\nm = 5;\r\nP_correct = [7 0 -6 0 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 7;\r\nm = 7;\r\nP_correct = [1 0 0 0 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 8;\r\nm = 0;\r\nP_correct = [70 0 -140 0 90 0 -20 0 1];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 8;\r\nm = 2;\r\nP_correct = [56 0 -105 0 60 0 -10 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 8;\r\nm = 4;\r\nP_correct = [28 0 -42 0 15 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 8;\r\nm = 6;\r\nP_correct = [8 0 -7 0 0 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 8;\r\nm = 8;\r\nP_correct = [1 0 0 0 0 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 9;\r\nm = 1;\r\nP_correct = [126 0 -280 0 210 0 -60 0 5 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 9;\r\nm = 3;\r\nP_correct = [84 0 -168 0 105 0 -20 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 9;\r\nm = 5;\r\nP_correct = [36 0 -56 0 21 0 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 9;\r\nm = 7;\r\nP_correct = [9 0 -8 0 0 0 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 9;\r\nm = 9;\r\nP_correct = [1 0 0 0 0 0 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":10352,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":59,"test_suite_updated_at":"2013-04-30T13:10:33.000Z","rescore_all_solutions":false,"group_id":25,"created_at":"2013-04-30T13:05:27.000Z","updated_at":"2026-02-15T03:47:35.000Z","published_at":"2013-04-30T13:10:33.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven an integer\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e ≥ 0 and an integer\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003em\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e ≥ 0, generate the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Zernike_polynomials\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eradial Zernike polynomial\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e of radial degree\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and azimuthal degree\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003em\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. You may assume that\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003emod(n-m,2)==0\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003em\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e ≤\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ radialZernike(0,0)\\n ans =\\n     1\\n\\n radialZernike(1,1)\\n ans =\\n     1     0\\n\\n radialZernike(2,0)\\n ans =\\n     2     0    -1\\n\\n radialZernike(2,2)\\n ans =\\n     1     0     0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNeither\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estring operations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e nor\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003einterpolations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are allowed!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":734,"title":"Ackermann's Function","description":"Ackermann's Function is a recursive function that is not 'primitive recursive.'\r\n\r\n\r\n\u003chttp://en.wikipedia.org/wiki/Ackermann_function Ackermann Function\u003e\r\n\r\nThe first argument drives the value extremely fast.\r\n\r\nA(m, n) =\r\n\r\n*   n + 1 if m = 0\r\n*   A(m − 1, 1) if m \u003e 0 and n = 0\r\n*   A(m − 1,A(m, n − 1)) if m \u003e 0 and n \u003e 0\r\n\r\n  \r\nA(2,4)=A(1,A(2,3)) = ... = 11.\r\n\r\n  % Range of cases\r\n  % m=0 n=0:1024\r\n  % m=1 n=0:1024\r\n  % m=2 n=0:128\r\n  % m=3 n=0:6\r\n  % m=4 n=0:1\r\n\r\nThere is some deep recusion.\r\n\r\n*\r\nInput:* m,n\r\n\r\n*Out:* Ackerman value\r\n\r\n\r\nAckermann(2,4) = 11\r\n\r\nPractical application of Ackermann's function is determining compiler recursion performance.","description_html":"\u003cp\u003eAckermann's Function is a recursive function that is not 'primitive recursive.'\u003c/p\u003e\u003cp\u003e\u003ca href=\"http://en.wikipedia.org/wiki/Ackermann_function\"\u003eAckermann Function\u003c/a\u003e\u003c/p\u003e\u003cp\u003eThe first argument drives the value extremely fast.\u003c/p\u003e\u003cp\u003eA(m, n) =\u003c/p\u003e\u003cul\u003e\u003cli\u003en + 1 if m = 0\u003c/li\u003e\u003cli\u003eA(m − 1, 1) if m \u003e 0 and n = 0\u003c/li\u003e\u003cli\u003eA(m − 1,A(m, n − 1)) if m \u003e 0 and n \u003e 0\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eA(2,4)=A(1,A(2,3)) = ... = 11.\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e% Range of cases\r\n% m=0 n=0:1024\r\n% m=1 n=0:1024\r\n% m=2 n=0:128\r\n% m=3 n=0:6\r\n% m=4 n=0:1\r\n\u003c/pre\u003e\u003cp\u003eThere is some deep recusion.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e m,n\u003c/p\u003e\u003cp\u003e\u003cb\u003eOut:\u003c/b\u003e Ackerman value\u003c/p\u003e\u003cp\u003eAckermann(2,4) = 11\u003c/p\u003e\u003cp\u003ePractical application of Ackermann's function is determining compiler recursion performance.\u003c/p\u003e","function_template":"function vAck = ackermann(m,n)\r\n set(0,'RecursionLimit',512);\r\n\r\n vAck=0;\r\n\r\nend","test_suite":"%%\r\nm=0;\r\nn=1;\r\nAck = n+1;\r\nassert(isequal(ackermann(m,n),Ack))\r\n%%\r\nm=0;\r\nn=1024;\r\nAck = n+1;\r\nassert(isequal(ackermann(m,n),Ack))\r\n%%\r\nm=0;\r\nn=randi(1024)\r\nAck = n+1;\r\nassert(isequal(ackermann(m,n),Ack))\r\n%%\r\nm=1;\r\nn=1024\r\nAck = n+2;\r\nassert(isequal(ackermann(m,n),Ack))\r\n%%\r\nm=1;\r\nn=randi(1024)\r\nAck = n+2;\r\nassert(isequal(ackermann(m,n),Ack))\r\n%%\r\nm=2;\r\nn=randi(128)\r\nAck = 2*n+3;\r\nassert(isequal(ackermann(m,n),Ack))\r\n%%\r\nm=3;\r\nn=6;\r\nAck = 509;\r\nassert(isequal(ackermann(m,n),Ack))\r\n%%\r\nm=3;\r\nn=randi(6)\r\nAck = 2^(n+3)-3;\r\nassert(isequal(ackermann(m,n),Ack))\r\n%%\r\nm=4;\r\nn=0;\r\nAck = 13;\r\nassert(isequal(ackermann(m,n),Ack))\r\n%%\r\nm=4;\r\nn=1; % Fails at RecursionLimit 1030; Create Special\r\nAck = 65533;\r\nassert(isequal(ackermann(m,n),Ack))","published":true,"deleted":false,"likes_count":4,"comments_count":2,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":80,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":25,"created_at":"2012-06-02T02:10:19.000Z","updated_at":"2026-02-15T03:26:49.000Z","published_at":"2012-06-02T02:36:59.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAckermann's Function is a recursive function that is not 'primitive recursive.'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Ackermann_function\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eAckermann Function\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe first argument drives the value extremely fast.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA(m, n) =\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003en + 1 if m = 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA(m − 1, 1) if m \u0026gt; 0 and n = 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA(m − 1,A(m, n − 1)) if m \u0026gt; 0 and n \u0026gt; 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA(2,4)=A(1,A(2,3)) = ... = 11.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[% Range of cases\\n% m=0 n=0:1024\\n% m=1 n=0:1024\\n% m=2 n=0:128\\n% m=3 n=0:6\\n% m=4 n=0:1]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere is some deep recusion.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e m,n\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOut:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Ackerman value\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAckermann(2,4) = 11\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePractical application of Ackermann's function is determining compiler recursion performance.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":1465,"title":"Generalized Laguerre polynomials","description":"Given an integer _n_ \u0026ge; 0 and a scalar _a_, generate the _n_-th \u003chttp://en.wikipedia.org/wiki/Laguerre_polynomials#Generalized_Laguerre_polynomials Generalized Laguerre polynomial\u003e of association degree _a_.\r\n\r\nFor simplicity, assume that _a_ is a non-negative integer.\r\n\r\n*Examples*:\r\n\r\n genLaguerrePoly(0,1)\r\n ans =\r\n     1 \r\n\r\n genLaguerrePoly(1,1)\r\n ans =\r\n     -1    2 \r\n\r\n genLaguerrePoly(2,1)\r\n ans =\r\n     0.5  -3    3\r\n\r\nNeither *string operations* nor *interpolations* are allowed!\r\n","description_html":"\u003cp\u003eGiven an integer \u003ci\u003en\u003c/i\u003e \u0026ge; 0 and a scalar \u003ci\u003ea\u003c/i\u003e, generate the \u003ci\u003en\u003c/i\u003e-th \u003ca href = \"http://en.wikipedia.org/wiki/Laguerre_polynomials#Generalized_Laguerre_polynomials\"\u003eGeneralized Laguerre polynomial\u003c/a\u003e of association degree \u003ci\u003ea\u003c/i\u003e.\u003c/p\u003e\u003cp\u003eFor simplicity, assume that \u003ci\u003ea\u003c/i\u003e is a non-negative integer.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples\u003c/b\u003e:\u003c/p\u003e\u003cpre\u003e genLaguerrePoly(0,1)\r\n ans =\r\n     1 \u003c/pre\u003e\u003cpre\u003e genLaguerrePoly(1,1)\r\n ans =\r\n     -1    2 \u003c/pre\u003e\u003cpre\u003e genLaguerrePoly(2,1)\r\n ans =\r\n     0.5  -3    3\u003c/pre\u003e\u003cp\u003eNeither \u003cb\u003estring operations\u003c/b\u003e nor \u003cb\u003einterpolations\u003c/b\u003e are allowed!\u003c/p\u003e","function_template":"function P = genLaguerrePoly(n,a)\r\n  P = n*a;\r\nend","test_suite":"%%\r\nuser_solution = fileread('genLaguerrePoly.m');\r\nassert(isempty(strfind(user_solution,'regexp')));\r\nassert(isempty(strfind(user_solution,'2str')));\r\nassert(isempty(strfind(user_solution,'str2')));\r\nassert(isempty(strfind(user_solution,'interp')));\r\nassert(isempty(strfind(user_solution,'printf')));\r\nassert(isempty(strfind(user_solution,'assert')));\r\n\r\n%%\r\nn = 0;\r\na = 0;\r\nP_correct = [1]/1;\r\nassert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 1;\r\na = 0;\r\nP_correct = [-1 1]/1;\r\nassert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 2;\r\na = 0;\r\nP_correct = [1 -4 2]/2;\r\nassert(isequal(round(genLaguerrePoly(n,a)*2),round(P_correct*2)));\r\n\r\n%%\r\nn = 3;\r\na = 0;\r\nP_correct = [-1 9 -18 6]/6;\r\nassert(isequal(round(genLaguerrePoly(n,a)*6),round(P_correct*6)));\r\n\r\n%%\r\nn = 4;\r\na = 0;\r\nP_correct = [1 -16 72 -96 24]/24;\r\nassert(isequal(round(genLaguerrePoly(n,a)*24),round(P_correct*24)));\r\n\r\n%%\r\nn = 5;\r\na = 0;\r\nP_correct = [-1 25 -200 600 -600 120]/120;\r\nassert(isequal(round(genLaguerrePoly(n,a)*120),round(P_correct*120)));\r\n\r\n%%\r\nn = 6;\r\na = 0;\r\nP_correct = [1 -36 450 -2400 5400 -4320 720]/720;\r\nassert(isequal(round(genLaguerrePoly(n,a)*720),round(P_correct*720)));\r\n\r\n%%\r\nn = 0;\r\na = 1;\r\nP_correct = [1]/1;\r\nassert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 1;\r\na = 1;\r\nP_correct = [-1 2]/1;\r\nassert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 2;\r\na = 1;\r\nP_correct = [1 -6 6]/2;\r\nassert(isequal(round(genLaguerrePoly(n,a)*2),round(P_correct*2)));\r\n\r\n%%\r\nn = 3;\r\na = 1;\r\nP_correct = [-1 12 -36 24]/6;\r\nassert(isequal(round(genLaguerrePoly(n,a)*6),round(P_correct*6)));\r\n\r\n%%\r\nn = 4;\r\na = 1;\r\nP_correct = [1 -20 120 -240 120]/24;\r\nassert(isequal(round(genLaguerrePoly(n,a)*24),round(P_correct*24)));\r\n\r\n%%\r\nn = 5;\r\na = 1;\r\nP_correct = [-1 30 -300 1200 -1800 720]/120;\r\nassert(isequal(round(genLaguerrePoly(n,a)*120),round(P_correct*120)));\r\n\r\n%%\r\nn = 6;\r\na = 1;\r\nP_correct = [1 -42 630 -4200 12600 -15120 5040]/720;\r\nassert(isequal(round(genLaguerrePoly(n,a)*720),round(P_correct*720)));\r\n\r\n%%\r\nn = 0;\r\na = 2;\r\nP_correct = [1]/1;\r\nassert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 1;\r\na = 2;\r\nP_correct = [-1 3]/1;\r\nassert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 2;\r\na = 2;\r\nP_correct = [1 -8 12]/2;\r\nassert(isequal(round(genLaguerrePoly(n,a)*2),round(P_correct*2)));\r\n\r\n%%\r\nn = 3;\r\na = 2;\r\nP_correct = [-1 15 -60 60]/6;\r\nassert(isequal(round(genLaguerrePoly(n,a)*6),round(P_correct*6)));\r\n\r\n%%\r\nn = 4;\r\na = 2;\r\nP_correct = [1 -24 180 -480 360]/24;\r\nassert(isequal(round(genLaguerrePoly(n,a)*24),round(P_correct*24)));\r\n\r\n%%\r\nn = 5;\r\na = 2;\r\nP_correct = [-1 35 -420 2100 -4200 2520]/120;\r\nassert(isequal(round(genLaguerrePoly(n,a)*120),round(P_correct*120)));\r\n\r\n%%\r\nn = 6;\r\na = 2;\r\nP_correct = [1 -48 840 -6720 25200 -40320 20160]/720;\r\nassert(isequal(round(genLaguerrePoly(n,a)*720),round(P_correct*720)));\r\n\r\n%%\r\nn = 0;\r\na = 3;\r\nP_correct = [1]/1;\r\nassert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 1;\r\na = 3;\r\nP_correct = [-1 4]/1;\r\nassert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 2;\r\na = 3;\r\nP_correct = [1 -10 20]/2;\r\nassert(isequal(round(genLaguerrePoly(n,a)*2),round(P_correct*2)));\r\n\r\n%%\r\nn = 3;\r\na = 3;\r\nP_correct = [-1 18 -90 120]/6;\r\nassert(isequal(round(genLaguerrePoly(n,a)*6),round(P_correct*6)));\r\n\r\n%%\r\nn = 4;\r\na = 3;\r\nP_correct = [1 -28 252 -840 840]/24;\r\nassert(isequal(round(genLaguerrePoly(n,a)*24),round(P_correct*24)));\r\n\r\n%%\r\nn = 5;\r\na = 3;\r\nP_correct = [-1 40 -560 3360 -8400 6720]/120;\r\nassert(isequal(round(genLaguerrePoly(n,a)*120),round(P_correct*120)));\r\n\r\n%%\r\nn = 6;\r\na = 3;\r\nP_correct = [1 -54 1080 -10080 45360 -90720 60480]/720;\r\nassert(isequal(round(genLaguerrePoly(n,a)*720),round(P_correct*720)));\r\n\r\n%%\r\nn = 0;\r\na = 4;\r\nP_correct = [1]/1;\r\nassert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 1;\r\na = 4;\r\nP_correct = [-1 5]/1;\r\nassert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 2;\r\na = 4;\r\nP_correct = [1 -12 30]/2;\r\nassert(isequal(round(genLaguerrePoly(n,a)*2),round(P_correct*2)));\r\n\r\n%%\r\nn = 3;\r\na = 4;\r\nP_correct = [-1 21 -126 210]/6;\r\nassert(isequal(round(genLaguerrePoly(n,a)*6),round(P_correct*6)));\r\n\r\n%%\r\nn = 4;\r\na = 4;\r\nP_correct = [1 -32 336 -1344 1680]/24;\r\nassert(isequal(round(genLaguerrePoly(n,a)*24),round(P_correct*24)));\r\n\r\n%%\r\nn = 5;\r\na = 4;\r\nP_correct = [-1 45 -720 5040 -15120 15120]/120;\r\nassert(isequal(round(genLaguerrePoly(n,a)*120),round(P_correct*120)));\r\n\r\n%%\r\nn = 6;\r\na = 4;\r\nP_correct = [1 -60 1350 -14400 75600 -181440 151200]/720;\r\nassert(isequal(round(genLaguerrePoly(n,a)*720),round(P_correct*720)));\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":10352,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":65,"test_suite_updated_at":"2013-04-28T07:10:43.000Z","rescore_all_solutions":false,"group_id":25,"created_at":"2013-04-27T14:47:51.000Z","updated_at":"2026-02-15T03:40:37.000Z","published_at":"2013-04-27T14:58:52.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven an integer\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e ≥ 0 and a scalar\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ea\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, generate the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e-th\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Laguerre_polynomials#Generalized_Laguerre_polynomials\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGeneralized Laguerre polynomial\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e of association degree\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ea\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor simplicity, assume that\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ea\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is a non-negative integer.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ genLaguerrePoly(0,1)\\n ans =\\n     1 \\n\\n genLaguerrePoly(1,1)\\n ans =\\n     -1    2 \\n\\n genLaguerrePoly(2,1)\\n ans =\\n     0.5  -3    3]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNeither\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estring operations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e nor\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003einterpolations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are allowed!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1474,"title":"Chebyshev polynomials of the 1st Kind","description":"Given an integer _n_ \u0026ge; 0, generate the _n_-th \u003chttp://en.wikipedia.org/wiki/Chebyshev_polynomials Chebyshev polynomial of the 1st Kind\u003e.\r\n\r\n*Examples*:\r\n\r\n chebyshev1stKindPoly(0)\r\n ans =\r\n     1\r\n\r\n chebyshev1stKindPoly(1)\r\n ans =\r\n     1     0\r\n\r\n chebyshev1stKindPoly(2)\r\n ans =\r\n     2     0    -1\r\n\r\nNeither *string operations* nor *interpolations* are allowed!\r\n","description_html":"\u003cp\u003eGiven an integer \u003ci\u003en\u003c/i\u003e \u0026ge; 0, generate the \u003ci\u003en\u003c/i\u003e-th \u003ca href = \"http://en.wikipedia.org/wiki/Chebyshev_polynomials\"\u003eChebyshev polynomial of the 1st Kind\u003c/a\u003e.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples\u003c/b\u003e:\u003c/p\u003e\u003cpre\u003e chebyshev1stKindPoly(0)\r\n ans =\r\n     1\u003c/pre\u003e\u003cpre\u003e chebyshev1stKindPoly(1)\r\n ans =\r\n     1     0\u003c/pre\u003e\u003cpre\u003e chebyshev1stKindPoly(2)\r\n ans =\r\n     2     0    -1\u003c/pre\u003e\u003cp\u003eNeither \u003cb\u003estring operations\u003c/b\u003e nor \u003cb\u003einterpolations\u003c/b\u003e are allowed!\u003c/p\u003e","function_template":"function P = chebyshev1stKindPoly(n)\r\n  P = n;\r\nend","test_suite":"%%\r\nuser_solution = fileread('chebyshev1stKindPoly.m');\r\nassert(isempty(strfind(user_solution,'regexp')));\r\nassert(isempty(strfind(user_solution,'2str')));\r\nassert(isempty(strfind(user_solution,'str2')));\r\nassert(isempty(strfind(user_solution,'interp')));\r\nassert(isempty(strfind(user_solution,'printf')));\r\nassert(isempty(strfind(user_solution,'assert')));\r\n\r\n%%\r\nn = 0;\r\nP_correct = [1];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 1;\r\nP_correct = [1 0];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 2;\r\nP_correct = [2 0 -1];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 3;\r\nP_correct = [4 0 -3 0];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 4;\r\nP_correct = [8 0 -8 0 1];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 5;\r\nP_correct = [16 0 -20 0 5 0];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 6;\r\nP_correct = [32 0 -48 0 18 0 -1];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 7;\r\nP_correct = [64 0 -112 0 56 0 -7 0];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 8;\r\nP_correct = [128 0 -256 0 160 0 -32 0 1];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 9;\r\nP_correct = [256 0 -576 0 432 0 -120 0 9 0];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 10;\r\nP_correct = [512 0 -1280 0 1120 0 -400 0 50 0 -1];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 11;\r\nP_correct = [1024 0 -2816 0 2816 0 -1232 0 220 0 -11 0];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 12;\r\nP_correct = [2048 0 -6144 0 6912 0 -3584 0 840 0 -72 0 1];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 13;\r\nP_correct = [4096 0 -13312 0 16640 0 -9984 0 2912 0 -364 0 13 0];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 14;\r\nP_correct = [8192 0 -28672 0 39424 0 -26880 0 9408 0 -1568 0 98 0 -1];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 15;\r\nP_correct = [16384 0 -61440 0 92160 0 -70400 0 28800 0 -6048 0 560 0 -15 0];\r\nassert(isequal(chebyshev1stKindPoly(n),P_correct));\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":10352,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":81,"test_suite_updated_at":"2013-04-30T12:30:22.000Z","rescore_all_solutions":false,"group_id":25,"created_at":"2013-04-30T11:25:32.000Z","updated_at":"2026-04-01T10:38:08.000Z","published_at":"2013-04-30T11:27:15.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven an integer\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e ≥ 0, generate the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e-th\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Chebyshev_polynomials\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eChebyshev polynomial of the 1st Kind\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ chebyshev1stKindPoly(0)\\n ans =\\n     1\\n\\n chebyshev1stKindPoly(1)\\n ans =\\n     1     0\\n\\n chebyshev1stKindPoly(2)\\n ans =\\n     2     0    -1]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNeither\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estring operations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e nor\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003einterpolations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are allowed!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1475,"title":"Chebyshev polynomials of the 2nd Kind","description":"Given an integer _n_ \u0026ge; 0, generate the _n_-th \u003chttp://en.wikipedia.org/wiki/Chebyshev_polynomials Chebyshev polynomial of the 2nd Kind\u003e.\r\n\r\n*Examples*:\r\n\r\n chebyshev2ndKindPoly(0)\r\n ans =\r\n     1\r\n\r\n chebyshev2ndKindPoly(1)\r\n ans =\r\n     2     0\r\n\r\n chebyshev2ndKindPoly(2)\r\n ans =\r\n     4     0    -1\r\n\r\nNeither *string operations* nor *interpolations* are allowed!\r\n","description_html":"\u003cp\u003eGiven an integer \u003ci\u003en\u003c/i\u003e \u0026ge; 0, generate the \u003ci\u003en\u003c/i\u003e-th \u003ca href = \"http://en.wikipedia.org/wiki/Chebyshev_polynomials\"\u003eChebyshev polynomial of the 2nd Kind\u003c/a\u003e.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples\u003c/b\u003e:\u003c/p\u003e\u003cpre\u003e chebyshev2ndKindPoly(0)\r\n ans =\r\n     1\u003c/pre\u003e\u003cpre\u003e chebyshev2ndKindPoly(1)\r\n ans =\r\n     2     0\u003c/pre\u003e\u003cpre\u003e chebyshev2ndKindPoly(2)\r\n ans =\r\n     4     0    -1\u003c/pre\u003e\u003cp\u003eNeither \u003cb\u003estring operations\u003c/b\u003e nor \u003cb\u003einterpolations\u003c/b\u003e are allowed!\u003c/p\u003e","function_template":"function P = chebyshev2ndKindPoly(n)\r\n  P = n;\r\nend","test_suite":"%%\r\nuser_solution = fileread('chebyshev2ndKindPoly.m');\r\nassert(isempty(strfind(user_solution,'regexp')));\r\nassert(isempty(strfind(user_solution,'2str')));\r\nassert(isempty(strfind(user_solution,'str2')));\r\nassert(isempty(strfind(user_solution,'interp')));\r\nassert(isempty(strfind(user_solution,'printf')));\r\nassert(isempty(strfind(user_solution,'assert')));\r\n\r\n%%\r\nn = 0;\r\nP_correct = [1];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 1;\r\nP_correct = [2 0];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 2;\r\nP_correct = [4 0 -1];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 3;\r\nP_correct = [8 0 -4 0];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 4;\r\nP_correct = [16 0 -12 0 1];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 5;\r\nP_correct = [32 0 -32 0 6 0];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 6;\r\nP_correct = [64 0 -80 0 24 0 -1];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 7;\r\nP_correct = [128 0 -192 0 80 0 -8 0];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 8;\r\nP_correct = [256 0 -448 0 240 0 -40 0 1];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 9;\r\nP_correct = [512 0 -1024 0 672 0 -160 0 10 0];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 10;\r\nP_correct = [1024 0 -2304 0 1792 0 -560 0 60 0 -1];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 11;\r\nP_correct = [2048 0 -5120 0 4608 0 -1792 0 280 0 -12 0];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 12;\r\nP_correct = [4096 0 -11264 0 11520 0 -5376 0 1120 0 -84 0 1];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 13;\r\nP_correct = [8192 0 -24576 0 28160 0 -15360 0 4032 0 -448 0 14 0];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 14;\r\nP_correct = [16384 0 -53248 0 67584 0 -42240 0 13440 0 -2016 0 112 0 -1];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n\r\n%%\r\nn = 15;\r\nP_correct = [32768 0 -114688 0 159744 0 -112640 0 42240 0 -8064 0 672 0 -16 0];\r\nassert(isequal(chebyshev2ndKindPoly(n),P_correct));\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":10352,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":78,"test_suite_updated_at":"2013-04-30T12:30:53.000Z","rescore_all_solutions":false,"group_id":25,"created_at":"2013-04-30T11:26:00.000Z","updated_at":"2026-02-15T03:46:10.000Z","published_at":"2013-04-30T11:27:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven an integer\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e ≥ 0, generate the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e-th\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Chebyshev_polynomials\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eChebyshev polynomial of the 2nd Kind\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ chebyshev2ndKindPoly(0)\\n ans =\\n     1\\n\\n chebyshev2ndKindPoly(1)\\n ans =\\n     2     0\\n\\n chebyshev2ndKindPoly(2)\\n ans =\\n     4     0    -1]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNeither\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estring operations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e nor\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003einterpolations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are allowed!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1464,"title":"Laguerre polynomials","description":"Given an integer _n_ \u0026ge; 0, generate the _n_-th \u003chttp://en.wikipedia.org/wiki/Laguerre_polynomials Laguerre polynomial\u003e.\r\n\r\n*Examples*:\r\n\r\n laguerrePoly(0)\r\n ans =\r\n     1 \r\n\r\n laguerrePoly(1)\r\n ans =\r\n     -1     1 \r\n\r\n laguerrePoly(2)\r\n ans =\r\n     0.5   -2     1\r\n\r\nNeither *string operations* nor *interpolations* are allowed!\r\n","description_html":"\u003cp\u003eGiven an integer \u003ci\u003en\u003c/i\u003e \u0026ge; 0, generate the \u003ci\u003en\u003c/i\u003e-th \u003ca href = \"http://en.wikipedia.org/wiki/Laguerre_polynomials\"\u003eLaguerre polynomial\u003c/a\u003e.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples\u003c/b\u003e:\u003c/p\u003e\u003cpre\u003e laguerrePoly(0)\r\n ans =\r\n     1 \u003c/pre\u003e\u003cpre\u003e laguerrePoly(1)\r\n ans =\r\n     -1     1 \u003c/pre\u003e\u003cpre\u003e laguerrePoly(2)\r\n ans =\r\n     0.5   -2     1\u003c/pre\u003e\u003cp\u003eNeither \u003cb\u003estring operations\u003c/b\u003e nor \u003cb\u003einterpolations\u003c/b\u003e are allowed!\u003c/p\u003e","function_template":"function P = laguerrePoly(n)\r\n  P = n;\r\nend","test_suite":"%%\r\nuser_solution = fileread('laguerrePoly.m');\r\nassert(isempty(strfind(user_solution,'regexp')));\r\nassert(isempty(strfind(user_solution,'2str')));\r\nassert(isempty(strfind(user_solution,'str2')));\r\nassert(isempty(strfind(user_solution,'interp')));\r\nassert(isempty(strfind(user_solution,'printf')));\r\nassert(isempty(strfind(user_solution,'assert')));\r\n\r\n%%\r\nn = 0;\r\nP_correct = [1]/1;\r\nassert(isequal(round(laguerrePoly(n)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 1;\r\nP_correct = [-1 1]/1;\r\nassert(isequal(round(laguerrePoly(n)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 2;\r\nP_correct = [1 -4 2]/2;\r\nassert(isequal(round(laguerrePoly(n)*2),round(P_correct*2)));\r\n\r\n%%\r\nn = 3;\r\nP_correct = [-1 9 -18 6]/6;\r\nassert(isequal(round(laguerrePoly(n)*6),round(P_correct*6)));\r\n\r\n%%\r\nn = 4;\r\nP_correct = [1 -16 72 -96 24]/24;\r\nassert(isequal(round(laguerrePoly(n)*24),round(P_correct*24)));\r\n\r\n%%\r\nn = 5;\r\nP_correct = [-1 25 -200 600 -600 120]/120;\r\nassert(isequal(round(laguerrePoly(n)*120),round(P_correct*120)));\r\n\r\n%%\r\nn = 6;\r\nP_correct = [1 -36 450 -2400 5400 -4320 720]/720;\r\nassert(isequal(round(laguerrePoly(n)*720),round(P_correct*720)));\r\n\r\n%%\r\nn = 7;\r\nP_correct = [-1 49 -882 7350 -29400 52920 -35280 5040]/5040;\r\nassert(isequal(round(laguerrePoly(n)*5040),round(P_correct*5040)));\r\n\r\n%%\r\nn = 8;\r\nP_correct = [1 -64 1568 -18816 117600 -376320 564480 -322560 40320]/40320;\r\nassert(isequal(round(laguerrePoly(n)*40320),round(P_correct*40320)));\r\n\r\n%%\r\nn = 9;\r\nP_correct = [-1 81 -2592 42336 -381024 1905120 -5080320 6531840 -3265920 362880]/362880;\r\nassert(isequal(round(laguerrePoly(n)*362880),round(P_correct*362880)));\r\n\r\n%%\r\nn = 10;\r\nP_correct = [1 -100 4050 -86400 1058400 -7620480 31752000 -72576000 81648000 -36288000 3628800]/3628800;\r\nassert(isequal(round(laguerrePoly(n)*3628800),round(P_correct*3628800)));\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":10352,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":85,"test_suite_updated_at":"2013-04-28T07:10:18.000Z","rescore_all_solutions":false,"group_id":25,"created_at":"2013-04-27T14:28:54.000Z","updated_at":"2026-02-15T03:37:58.000Z","published_at":"2013-04-27T14:30:51.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven an integer\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e ≥ 0, generate the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e-th\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Laguerre_polynomials\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eLaguerre polynomial\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ laguerrePoly(0)\\n ans =\\n     1 \\n\\n laguerrePoly(1)\\n ans =\\n     -1     1 \\n\\n laguerrePoly(2)\\n ans =\\n     0.5   -2     1]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNeither\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estring operations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e nor\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003einterpolations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are allowed!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":481,"title":"Rosenbrock's Banana Function and its derivatives","description":"Write a function to return the value of \u003chttp://en.wikipedia.org/wiki/Rosenbrock_function Rosenbrock's two-dimensional banana function\u003e, as well as it's gradient (column) vector and Hessian matrix, given a vector of it's two independent variables _x1_ and _x2_. Here's the Rosenbrock function: \r\n\r\n 100*[(x2-x1^2)^2] + (1-x1)^2","description_html":"\u003cp\u003eWrite a function to return the value of \u003ca href=\"http://en.wikipedia.org/wiki/Rosenbrock_function\"\u003eRosenbrock's two-dimensional banana function\u003c/a\u003e, as well as it's gradient (column) vector and Hessian matrix, given a vector of it's two independent variables \u003ci\u003ex1\u003c/i\u003e and \u003ci\u003ex2\u003c/i\u003e. Here's the Rosenbrock function:\u003c/p\u003e\u003cpre\u003e 100*[(x2-x1^2)^2] + (1-x1)^2\u003c/pre\u003e","function_template":"function [value,gradient,Hessian] = Rosenbrock_banana(x)\r\n  value = x;\r\n  gradient = [0; 0];\r\n  Hessian = [0, 0; 0, 0]\r\nend","test_suite":"%%\r\nassert(isempty(regexp(fileread('Rosenbrock_banana.m'),'assert.m')))\r\n%%\r\nx = [0; 0];\r\nassert(isequal(Rosenbrock_banana(x),1))\r\n%%\r\nx = [1; 1];\r\nassert(isequal(Rosenbrock_banana(x),0))\r\n%%\r\nx = [1; -1];\r\nassert(isequal(Rosenbrock_banana(x),400))\r\n%%\r\nx = [-1; 0.5];\r\nassert(isequal(Rosenbrock_banana(x),29))\r\n%%\r\nx = [0; 0];\r\n[~,grad]=Rosenbrock_banana(x);\r\nassert(isequal(grad,[-2; 0]))\r\n%%\r\nx = [0; 0];\r\n[~,~,Hess]=Rosenbrock_banana(x);\r\nassert(isequal(Hess,diag([2, 200])))\r\n%%\r\nx = [1; 1];\r\n[~,grad]=Rosenbrock_banana(x);\r\nassert(isequal(grad,[0; 0]))\r\n%%\r\nx = [1; 1];\r\n[~,~,Hess]=Rosenbrock_banana(x);\r\nassert(isequal(Hess,[802, -400; -400, 200]))\r\n%%\r\nx = [-1.9; 2];\r\ncorrect_value = 267.6200;\r\ncorrect_grad = -1e3*[1.2294; 0.3220];\r\ncorrect_Hess = [3534, 760; 760, 200];\r\n[val,grad,Hess]=Rosenbrock_banana(x);\r\nassert(isequal(str2num(num2str(val)),correct_value))\r\nassert(isequal(str2num(num2str(grad)),correct_grad))\r\nassert(all(max(abs(Hess-correct_Hess)\u003c1e-8)))","published":true,"deleted":false,"likes_count":2,"comments_count":2,"created_by":279,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":166,"test_suite_updated_at":"2013-08-25T01:30:52.000Z","rescore_all_solutions":false,"group_id":25,"created_at":"2012-03-12T05:01:12.000Z","updated_at":"2026-03-29T19:32:52.000Z","published_at":"2012-03-12T21:14:57.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to return the value of\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Rosenbrock_function\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRosenbrock's two-dimensional banana function\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, as well as it's gradient (column) vector and Hessian matrix, given a vector of it's two independent variables\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex1\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. Here's the Rosenbrock function:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 100*[(x2-x1^2)^2] + (1-x1)^2]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1473,"title":"Legendre polynomials","description":"Given an integer _n_ \u0026ge; 0, generate the _n_-th \u003chttp://en.wikipedia.org/wiki/Legendre_polynomials Legendre polynomial\u003e.\r\n\r\n*Examples*:\r\n\r\n legendrePoly(0)\r\n ans =\r\n     1\r\n\r\n legendrePoly(1)\r\n ans =\r\n     1     0\r\n\r\n legendrePoly(2)\r\n ans =\r\n     1.5   0   -0.5\r\n\r\nNeither *string operations* nor *interpolations* are allowed!\r\n","description_html":"\u003cp\u003eGiven an integer \u003ci\u003en\u003c/i\u003e \u0026ge; 0, generate the \u003ci\u003en\u003c/i\u003e-th \u003ca href = \"http://en.wikipedia.org/wiki/Legendre_polynomials\"\u003eLegendre polynomial\u003c/a\u003e.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples\u003c/b\u003e:\u003c/p\u003e\u003cpre\u003e legendrePoly(0)\r\n ans =\r\n     1\u003c/pre\u003e\u003cpre\u003e legendrePoly(1)\r\n ans =\r\n     1     0\u003c/pre\u003e\u003cpre\u003e legendrePoly(2)\r\n ans =\r\n     1.5   0   -0.5\u003c/pre\u003e\u003cp\u003eNeither \u003cb\u003estring operations\u003c/b\u003e nor \u003cb\u003einterpolations\u003c/b\u003e are allowed!\u003c/p\u003e","function_template":"function P = legendrePoly(n)\r\n  P = n;\r\nend","test_suite":"%%\r\nuser_solution = fileread('legendrePoly.m');\r\nassert(isempty(strfind(user_solution,'regexp')));\r\nassert(isempty(strfind(user_solution,'2str')));\r\nassert(isempty(strfind(user_solution,'str2')));\r\nassert(isempty(strfind(user_solution,'interp')));\r\nassert(isempty(strfind(user_solution,'printf')));\r\nassert(isempty(strfind(user_solution,'assert')));\r\n\r\n%%\r\nn = 0;\r\nP_correct = [1]/1;\r\nassert(isequal(round(legendrePoly(n)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 1;\r\nP_correct = [1 0]/1;\r\nassert(isequal(round(legendrePoly(n)*1),round(P_correct*1)));\r\n\r\n%%\r\nn = 2;\r\nP_correct = [3 0 -1]/2;\r\nassert(isequal(round(legendrePoly(n)*2),round(P_correct*2)));\r\n\r\n%%\r\nn = 3;\r\nP_correct = [5 0 -3 0]/2;\r\nassert(isequal(round(legendrePoly(n)*2),round(P_correct*2)));\r\n\r\n%%\r\nn = 4;\r\nP_correct = [35 0 -30 0 3]/8;\r\nassert(isequal(round(legendrePoly(n)*8),round(P_correct*8)));\r\n\r\n%%\r\nn = 5;\r\nP_correct = [63 0 -70 0 15 0]/8;\r\nassert(isequal(round(legendrePoly(n)*8),round(P_correct*8)));\r\n\r\n%%\r\nn = 6;\r\nP_correct = [231 0 -315 0 105 0 -5]/16;\r\nassert(isequal(round(legendrePoly(n)*16),round(P_correct*16)));\r\n\r\n%%\r\nn = 7;\r\nP_correct = [429 0 -693 0 315 0 -35 0]/16;\r\nassert(isequal(round(legendrePoly(n)*16),round(P_correct*16)));\r\n\r\n%%\r\nn = 8;\r\nP_correct = [6435 0 -12012 0 6930 0 -1260 0 35]/128;\r\nassert(isequal(round(legendrePoly(n)*128),round(P_correct*128)));\r\n\r\n%%\r\nn = 9;\r\nP_correct = [12155 0 -25740 0 18018 0 -4620 0 315 0]/128;\r\nassert(isequal(round(legendrePoly(n)*128),round(P_correct*128)));\r\n\r\n%%\r\nn = 10;\r\nP_correct = [46189 0 -109395 0 90090 0 -30030 0 3465 0 -63]/256;\r\nassert(isequal(round(legendrePoly(n)*256),round(P_correct*256)));\r\n\r\n%%\r\nn = 11;\r\nP_correct = [88179 0 -230945 0 218790 0 -90090 0 15015 0 -693 0]/256;\r\nassert(isequal(round(legendrePoly(n)*256),round(P_correct*256)));\r\n\r\n%%\r\nn = 12;\r\nP_correct = [676039 0 -1939938 0 2078505 0 -1021020 0 225225 0 -18018 0 231]/1024;\r\nassert(isequal(round(legendrePoly(n)*1024),round(P_correct*1024)));\r\n\r\n%%\r\nn = 13;\r\nP_correct = [1300075 0 -4056234 0 4849845 0 -2771340 0 765765 0 -90090 0 3003 0]/1024;\r\nassert(isequal(round(legendrePoly(n)*1024),round(P_correct*1024)));\r\n\r\n%%\r\nn = 14;\r\nP_correct = [5014575 0 -16900975 0 22309287 0 -14549535 0 4849845 0 -765765 0 45045 0 -429]/2048;\r\nassert(isequal(round(legendrePoly(n)*2048),round(P_correct*2048)));\r\n\r\n%%\r\nn = 15;\r\nP_correct = [9694845 0 -35102025 0 50702925 0 -37182145 0 14549535 0 -2909907 0 255255 0 -6435 0]/2048;\r\nassert(isequal(round(legendrePoly(n)*2048),round(P_correct*2048)));\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":10352,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":73,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":25,"created_at":"2013-04-30T10:43:53.000Z","updated_at":"2026-04-01T10:26:23.000Z","published_at":"2013-04-30T10:45:41.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven an integer\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e ≥ 0, generate the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e-th\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Legendre_polynomials\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eLegendre polynomial\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ legendrePoly(0)\\n ans =\\n     1\\n\\n legendrePoly(1)\\n ans =\\n     1     0\\n\\n legendrePoly(2)\\n ans =\\n     1.5   0   -0.5]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNeither\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estring operations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e nor\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003einterpolations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are allowed!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":2383,"title":"Kepler's Equation","description":"Solve \u003chttp://en.wikipedia.org/wiki/Kepler's_equation Kepler's Equation\u003e. \r\n\r\nNote that the solution is rounded down to 5 decimal places at the test suite.\r\n\r\nInputs:\r\n\r\n* M    mean anomaly [rad]\r\n* e    eccentricity [1]\r\n\r\nOutputs:\r\n\r\n* E    eccentric anomaly [rad]","description_html":"\u003cp\u003eSolve \u003ca href = \"http://en.wikipedia.org/wiki/Kepler's_equation\"\u003eKepler's Equation\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eNote that the solution is rounded down to 5 decimal places at the test suite.\u003c/p\u003e\u003cp\u003eInputs:\u003c/p\u003e\u003cul\u003e\u003cli\u003eM    mean anomaly [rad]\u003c/li\u003e\u003cli\u003ee    eccentricity [1]\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eOutputs:\u003c/p\u003e\u003cul\u003e\u003cli\u003eE    eccentric anomaly [rad]\u003c/li\u003e\u003c/ul\u003e","function_template":"function E = kepler(M, e)\r\n    E = M;\r\nend","test_suite":"%%\r\nM = pi/2;\r\ne = 0;\r\nassert(isequal(round(kepler(M, e)*1e5)/1e5, 1.5708))\r\n%%\r\nM = pi/2;\r\ne = 0.8;\r\nassert(isequal(round(kepler(M, e)*1e5)/1e5, 2.21193))\r\n%%\r\nM = pi/3;\r\ne = 0.1;\r\nassert(isequal(round(kepler(M, e)*1e5)/1e5, 1.13798))\r\n%%\r\nM = 0.1;\r\ne = 0.2;\r\nassert(isequal(round(kepler(M, e)*1e5)/1e5, 0.12492))","published":true,"deleted":false,"likes_count":8,"comments_count":0,"created_by":20319,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":170,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":25,"created_at":"2014-06-23T15:06:25.000Z","updated_at":"2026-02-15T03:48:51.000Z","published_at":"2014-06-23T15:08:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSolve\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Kepler's_equation\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eKepler's Equation\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNote that the solution is rounded down to 5 decimal places at the test suite.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInputs:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eM mean anomaly [rad]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ee eccentricity [1]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOutputs:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eE eccentric anomaly [rad]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1304,"title":"Hermite Polynomials","description":"Return the _n_-th \u003chttp://en.wikipedia.org/wiki/Hermite_polynomials Hermite polynomial\u003e of the physicists' type.\r\n\r\nAssume that _n_ is a non-negative finite integer. \r\n\r\n*Examples*:\r\n\r\n hermite_poly(0)\r\n ans = \r\n     1\r\n \r\n hermite_poly(1)\r\n ans = \r\n     2     0\r\n\r\n hermite_poly(2)\r\n ans = \r\n     4     0   -2\r\n\r\n hermite_poly(3)\r\n ans = \r\n     8     0   -12     0\r\n\r\nNeither *string operations* nor *interpolations* are allowed!\r\n","description_html":"\u003cp\u003eReturn the \u003ci\u003en\u003c/i\u003e-th \u003ca href = \"http://en.wikipedia.org/wiki/Hermite_polynomials\"\u003eHermite polynomial\u003c/a\u003e of the physicists' type.\u003c/p\u003e\u003cp\u003eAssume that \u003ci\u003en\u003c/i\u003e is a non-negative finite integer.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples\u003c/b\u003e:\u003c/p\u003e\u003cpre\u003e hermite_poly(0)\r\n ans = \r\n     1\u003c/pre\u003e\u003cpre\u003e hermite_poly(1)\r\n ans = \r\n     2     0\u003c/pre\u003e\u003cpre\u003e hermite_poly(2)\r\n ans = \r\n     4     0   -2\u003c/pre\u003e\u003cpre\u003e hermite_poly(3)\r\n ans = \r\n     8     0   -12     0\u003c/pre\u003e\u003cp\u003eNeither \u003cb\u003estring operations\u003c/b\u003e nor \u003cb\u003einterpolations\u003c/b\u003e are allowed!\u003c/p\u003e","function_template":"function p = hermite_poly(n)\r\n  p = n;\r\nend","test_suite":"%%\r\nuser_solution = fileread('hermite_poly.m');\r\nassert(isempty(strfind(user_solution,'regexp')));\r\nassert(isempty(strfind(user_solution,'2str')));\r\nassert(isempty(strfind(user_solution,'str2')));\r\nassert(isempty(strfind(user_solution,'interp')));\r\nassert(isempty(strfind(user_solution,'printf')));\r\nassert(isempty(strfind(user_solution,'assert')));\r\n\r\n%%\r\nn = 0;\r\nP_correct = [1];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 1;\r\nP_correct = [2 0];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 2;\r\nP_correct = [4 0 -2];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 3;\r\nP_correct = [8 0 -12 -0];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 4;\r\nP_correct = [16 0 -48 -0 12];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 5;\r\nP_correct = [32 0 -160 -0 120 0];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 6;\r\nP_correct = [64 0 -480 -0 720 0 -120];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 7;\r\nP_correct = [128 0 -1344 -0 3360 0 -1680 -0];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 8;\r\nP_correct = [256 0 -3584 -0 13440 0 -13440 -0 1680];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 9;\r\nP_correct = [512 0 -9216 -0 48384 0 -80640 -0 30240 0];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 10;\r\nP_correct = [1024 0 -23040 -0 161280 0 -403200 -0 302400 0 -30240];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 11;\r\nP_correct = [2048 0 -56320 -0 506880 0 -1774080 -0 2217600 0 -665280 -0];\r\nassert(isequal(hermite_poly(n),P_correct));\r\n\r\n%%\r\nn = 12;\r\nP_correct = [4096 0 -135168 -0 1520640 0 -7096320 -0 13305600 0 -7983360 -0 665280];\r\nassert(isequal(hermite_poly(n),P_correct));","published":true,"deleted":false,"likes_count":4,"comments_count":1,"created_by":10352,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":90,"test_suite_updated_at":"2013-04-28T07:05:09.000Z","rescore_all_solutions":false,"group_id":25,"created_at":"2013-02-27T09:28:44.000Z","updated_at":"2026-02-15T03:35:58.000Z","published_at":"2013-02-27T09:28:44.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReturn the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e-th\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Hermite_polynomials\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eHermite polynomial\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e of the physicists' type.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAssume that\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is a non-negative finite integer.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ hermite_poly(0)\\n ans = \\n     1\\n\\n hermite_poly(1)\\n ans = \\n     2     0\\n\\n hermite_poly(2)\\n ans = \\n     4     0   -2\\n\\n hermite_poly(3)\\n ans = \\n     8     0   -12     0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNeither\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estring operations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e nor\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003einterpolations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are allowed!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":656,"title":"Calculate Euler's phi function","description":"Compute the Euler's phi function of a large integer.\r\n\r\nFor more information about this topic please visit:\r\n\u003chttps://en.wikipedia.org/wiki/Euler%27s_totient_function Euler's totient function\u003e.\r\n\r\nWith these constraints:\r\n\r\n* n is a nonnegative integer greater than 0.\r\n* \"large integer\" means 32bit integer\r\n* vectorized Input\r\n\r\nExamples:\r\n\r\n# eulerphi(4)  =  2\r\n# eulerphi(11) = 10","description_html":"\u003cp\u003eCompute the Euler's phi function of a large integer.\u003c/p\u003e\u003cp\u003eFor more information about this topic please visit: \u003ca href = \"https://en.wikipedia.org/wiki/Euler%27s_totient_function\"\u003eEuler's totient function\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eWith these constraints:\u003c/p\u003e\u003cul\u003e\u003cli\u003en is a nonnegative integer greater than 0.\u003c/li\u003e\u003cli\u003e\"large integer\" means 32bit integer\u003c/li\u003e\u003cli\u003evectorized Input\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eExamples:\u003c/p\u003e\u003col\u003e\u003cli\u003eeulerphi(4)  =  2\u003c/li\u003e\u003cli\u003eeulerphi(11) = 10\u003c/li\u003e\u003c/ol\u003e","function_template":"function phi = eulerphi(n)\r\n  phi = n-1;\r\nend","test_suite":"%% vectorized\r\ny_correct = [ 1, 1, 2, 2, 4, 2, 6, 4, 6, 4, 10, ...\r\n              4, 12, 6, 8, 8, 16, 6, 18, 8, 12, ...\r\n             10, 22, 8, 20, 12, 18, 12, 28, 8, ...\r\n             30, 16, 20, 16, 24, 12, 36, 18, 24, ...\r\n             16, 40, 12, 42, 20, 24, 22, 46, 16, ...\r\n             42, 20, 32, 24, 52, 18, 40, 24, 36, 28, ...\r\n             58, 16, 60, 30, 36, 32, 48, 20, 66, 32, ...\r\n             44, 24, 70, 24, 72, 36, 40, 36, 60, 24, ...\r\n             78, 32, 54, 40, 82, 24, 64, 42, 56, 40, ...\r\n             88, 24, 72, 44, 60, 46, 72, 32, 96, 42, 60];\r\nassert(isequal(eulerphi(1:99),y_correct))\r\n\r\n%% int16\r\nassert(isequal(eulerphi(double(intmax('int16'))), 27000))\r\nassert(isequal(eulerphi(double(intmax('uint16'))),32768))\r\n\r\n%% int32\r\nassert(isequal(eulerphi(double(intmax('int32'))), 2147483646))\r\nassert(isequal(eulerphi(double(intmax('uint32'))),2147483648))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":1696,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":101,"test_suite_updated_at":"2012-05-04T22:38:59.000Z","rescore_all_solutions":false,"group_id":25,"created_at":"2012-05-04T18:22:28.000Z","updated_at":"2026-02-15T03:21:47.000Z","published_at":"2012-05-04T18:22:28.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCompute the Euler's phi function of a large integer.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor more information about this topic please visit:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Euler%27s_totient_function\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eEuler's totient function\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWith these constraints:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003en is a nonnegative integer greater than 0.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\"large integer\\\" means 32bit integer\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003evectorized Input\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eeulerphi(4) = 2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eeulerphi(11) = 10\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1476,"title":"Radial Zernike polynomials","description":"Given an integer _n_ \u0026ge; 0 and an integer _m_ \u0026ge; 0, generate the \u003chttp://en.wikipedia.org/wiki/Zernike_polynomials radial Zernike polynomial\u003e of radial degree _n_ and azimuthal degree _m_. You may assume that |mod(n-m,2)==0| and _m_ \u0026le; _n_.\r\n\r\n*Examples*:\r\n\r\n radialZernike(0,0)\r\n ans =\r\n     1\r\n\r\n radialZernike(1,1)\r\n ans =\r\n     1     0\r\n\r\n radialZernike(2,0)\r\n ans =\r\n     2     0    -1\r\n\r\n radialZernike(2,2)\r\n ans =\r\n     1     0     0\r\n\r\nNeither *string operations* nor *interpolations* are allowed!\r\n","description_html":"\u003cp\u003eGiven an integer \u003ci\u003en\u003c/i\u003e \u0026ge; 0 and an integer \u003ci\u003em\u003c/i\u003e \u0026ge; 0, generate the \u003ca href = \"http://en.wikipedia.org/wiki/Zernike_polynomials\"\u003eradial Zernike polynomial\u003c/a\u003e of radial degree \u003ci\u003en\u003c/i\u003e and azimuthal degree \u003ci\u003em\u003c/i\u003e. You may assume that \u003ctt\u003emod(n-m,2)==0\u003c/tt\u003e and \u003ci\u003em\u003c/i\u003e \u0026le; \u003ci\u003en\u003c/i\u003e.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples\u003c/b\u003e:\u003c/p\u003e\u003cpre\u003e radialZernike(0,0)\r\n ans =\r\n     1\u003c/pre\u003e\u003cpre\u003e radialZernike(1,1)\r\n ans =\r\n     1     0\u003c/pre\u003e\u003cpre\u003e radialZernike(2,0)\r\n ans =\r\n     2     0    -1\u003c/pre\u003e\u003cpre\u003e radialZernike(2,2)\r\n ans =\r\n     1     0     0\u003c/pre\u003e\u003cp\u003eNeither \u003cb\u003estring operations\u003c/b\u003e nor \u003cb\u003einterpolations\u003c/b\u003e are allowed!\u003c/p\u003e","function_template":"function P = radialZernike(n,m)\r\n  P = n*m;\r\nend","test_suite":"%%\r\nuser_solution = fileread('radialZernike.m');\r\nassert(isempty(strfind(user_solution,'regexp')));\r\nassert(isempty(strfind(user_solution,'2str')));\r\nassert(isempty(strfind(user_solution,'str2')));\r\nassert(isempty(strfind(user_solution,'interp')));\r\nassert(isempty(strfind(user_solution,'printf')));\r\nassert(isempty(strfind(user_solution,'assert')));\r\n\r\n%%\r\nn = 0;\r\nm = 0;\r\nP_correct = [1];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 1;\r\nm = 1;\r\nP_correct = [1 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 2;\r\nm = 0;\r\nP_correct = [2 0 -1];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 2;\r\nm = 2;\r\nP_correct = [1 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 3;\r\nm = 1;\r\nP_correct = [3 0 -2 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 3;\r\nm = 3;\r\nP_correct = [1 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 4;\r\nm = 0;\r\nP_correct = [6 0 -6 0 1];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 4;\r\nm = 2;\r\nP_correct = [4 0 -3 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 4;\r\nm = 4;\r\nP_correct = [1 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 5;\r\nm = 1;\r\nP_correct = [10 0 -12 0 3 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 5;\r\nm = 3;\r\nP_correct = [5 0 -4 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 5;\r\nm = 5;\r\nP_correct = [1 0 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 6;\r\nm = 0;\r\nP_correct = [20 0 -30 0 12 0 -1];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 6;\r\nm = 2;\r\nP_correct = [15 0 -20 0 6 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 6;\r\nm = 4;\r\nP_correct = [6 0 -5 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 6;\r\nm = 6;\r\nP_correct = [1 0 0 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 7;\r\nm = 1;\r\nP_correct = [35 0 -60 0 30 0 -4 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 7;\r\nm = 3;\r\nP_correct = [21 0 -30 0 10 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 7;\r\nm = 5;\r\nP_correct = [7 0 -6 0 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 7;\r\nm = 7;\r\nP_correct = [1 0 0 0 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 8;\r\nm = 0;\r\nP_correct = [70 0 -140 0 90 0 -20 0 1];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 8;\r\nm = 2;\r\nP_correct = [56 0 -105 0 60 0 -10 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 8;\r\nm = 4;\r\nP_correct = [28 0 -42 0 15 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 8;\r\nm = 6;\r\nP_correct = [8 0 -7 0 0 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 8;\r\nm = 8;\r\nP_correct = [1 0 0 0 0 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 9;\r\nm = 1;\r\nP_correct = [126 0 -280 0 210 0 -60 0 5 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 9;\r\nm = 3;\r\nP_correct = [84 0 -168 0 105 0 -20 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 9;\r\nm = 5;\r\nP_correct = [36 0 -56 0 21 0 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 9;\r\nm = 7;\r\nP_correct = [9 0 -8 0 0 0 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n\r\n%%\r\nn = 9;\r\nm = 9;\r\nP_correct = [1 0 0 0 0 0 0 0 0 0];\r\nassert(isequal(radialZernike(n,m),P_correct));\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":10352,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":59,"test_suite_updated_at":"2013-04-30T13:10:33.000Z","rescore_all_solutions":false,"group_id":25,"created_at":"2013-04-30T13:05:27.000Z","updated_at":"2026-02-15T03:47:35.000Z","published_at":"2013-04-30T13:10:33.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven an integer\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e ≥ 0 and an integer\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003em\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e ≥ 0, generate the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Zernike_polynomials\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eradial Zernike polynomial\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e of radial degree\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and azimuthal degree\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003em\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. You may assume that\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003emod(n-m,2)==0\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003em\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e ≤\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ radialZernike(0,0)\\n ans =\\n     1\\n\\n radialZernike(1,1)\\n ans =\\n     1     0\\n\\n radialZernike(2,0)\\n ans =\\n     2     0    -1\\n\\n radialZernike(2,2)\\n ans =\\n     1     0     0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNeither\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estring operations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e nor\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003einterpolations\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are allowed!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":734,"title":"Ackermann's Function","description":"Ackermann's Function is a recursive function that is not 'primitive recursive.'\r\n\r\n\r\n\u003chttp://en.wikipedia.org/wiki/Ackermann_function Ackermann Function\u003e\r\n\r\nThe first argument drives the value extremely fast.\r\n\r\nA(m, n) =\r\n\r\n*   n + 1 if m = 0\r\n*   A(m − 1, 1) if m \u003e 0 and n = 0\r\n*   A(m − 1,A(m, n − 1)) if m \u003e 0 and n \u003e 0\r\n\r\n  \r\nA(2,4)=A(1,A(2,3)) = ... = 11.\r\n\r\n  % Range of cases\r\n  % m=0 n=0:1024\r\n  % m=1 n=0:1024\r\n  % m=2 n=0:128\r\n  % m=3 n=0:6\r\n  % m=4 n=0:1\r\n\r\nThere is some deep recusion.\r\n\r\n*\r\nInput:* m,n\r\n\r\n*Out:* Ackerman value\r\n\r\n\r\nAckermann(2,4) = 11\r\n\r\nPractical application of Ackermann's function is determining compiler recursion performance.","description_html":"\u003cp\u003eAckermann's Function is a recursive function that is not 'primitive recursive.'\u003c/p\u003e\u003cp\u003e\u003ca href=\"http://en.wikipedia.org/wiki/Ackermann_function\"\u003eAckermann Function\u003c/a\u003e\u003c/p\u003e\u003cp\u003eThe first argument drives the value extremely fast.\u003c/p\u003e\u003cp\u003eA(m, n) =\u003c/p\u003e\u003cul\u003e\u003cli\u003en + 1 if m = 0\u003c/li\u003e\u003cli\u003eA(m − 1, 1) if m \u003e 0 and n = 0\u003c/li\u003e\u003cli\u003eA(m − 1,A(m, n − 1)) if m \u003e 0 and n \u003e 0\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eA(2,4)=A(1,A(2,3)) = ... = 11.\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e% Range of cases\r\n% m=0 n=0:1024\r\n% m=1 n=0:1024\r\n% m=2 n=0:128\r\n% m=3 n=0:6\r\n% m=4 n=0:1\r\n\u003c/pre\u003e\u003cp\u003eThere is some deep recusion.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e m,n\u003c/p\u003e\u003cp\u003e\u003cb\u003eOut:\u003c/b\u003e Ackerman value\u003c/p\u003e\u003cp\u003eAckermann(2,4) = 11\u003c/p\u003e\u003cp\u003ePractical application of Ackermann's function is determining compiler recursion performance.\u003c/p\u003e","function_template":"function vAck = ackermann(m,n)\r\n set(0,'RecursionLimit',512);\r\n\r\n vAck=0;\r\n\r\nend","test_suite":"%%\r\nm=0;\r\nn=1;\r\nAck = n+1;\r\nassert(isequal(ackermann(m,n),Ack))\r\n%%\r\nm=0;\r\nn=1024;\r\nAck = n+1;\r\nassert(isequal(ackermann(m,n),Ack))\r\n%%\r\nm=0;\r\nn=randi(1024)\r\nAck = n+1;\r\nassert(isequal(ackermann(m,n),Ack))\r\n%%\r\nm=1;\r\nn=1024\r\nAck = n+2;\r\nassert(isequal(ackermann(m,n),Ack))\r\n%%\r\nm=1;\r\nn=randi(1024)\r\nAck = n+2;\r\nassert(isequal(ackermann(m,n),Ack))\r\n%%\r\nm=2;\r\nn=randi(128)\r\nAck = 2*n+3;\r\nassert(isequal(ackermann(m,n),Ack))\r\n%%\r\nm=3;\r\nn=6;\r\nAck = 509;\r\nassert(isequal(ackermann(m,n),Ack))\r\n%%\r\nm=3;\r\nn=randi(6)\r\nAck = 2^(n+3)-3;\r\nassert(isequal(ackermann(m,n),Ack))\r\n%%\r\nm=4;\r\nn=0;\r\nAck = 13;\r\nassert(isequal(ackermann(m,n),Ack))\r\n%%\r\nm=4;\r\nn=1; % Fails at RecursionLimit 1030; Create Special\r\nAck = 65533;\r\nassert(isequal(ackermann(m,n),Ack))","published":true,"deleted":false,"likes_count":4,"comments_count":2,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":80,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":25,"created_at":"2012-06-02T02:10:19.000Z","updated_at":"2026-02-15T03:26:49.000Z","published_at":"2012-06-02T02:36:59.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAckermann's Function is a recursive function that is not 'primitive recursive.'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Ackermann_function\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eAckermann Function\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe first argument drives the value extremely fast.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA(m, n) =\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003en + 1 if m = 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA(m − 1, 1) if m \u0026gt; 0 and n = 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA(m − 1,A(m, n − 1)) if m \u0026gt; 0 and n \u0026gt; 0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA(2,4)=A(1,A(2,3)) = ... = 11.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[% Range of cases\\n% m=0 n=0:1024\\n% m=1 n=0:1024\\n% m=2 n=0:128\\n% m=3 n=0:6\\n% m=4 n=0:1]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere is some deep recusion.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e m,n\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOut:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Ackerman value\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAckermann(2,4) = 11\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePractical application of Ackermann's function is determining compiler recursion performance.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"term":"difficulty_rating_bin:medium group:\"Functions I\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"difficulty_rating_bin:medium group:\"Functions I\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"difficulty_rating_bin":[["difficulty_rating_bin:medium","","","medium",""]],"group":[["group:\"Functions I\"","","\"","Functions I","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fa2bba0ca98\u003e":["Functions I"],"#\u003cMathWorks::Search::Field:0x00007fa2bba0c9f8\u003e":["medium"]},"filters":{"#\u003cMathWorks::Search::Field:0x00007fa2bba0bff8\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fa2bba0cef8\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fa2bba0cd18\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fa2bba0cbd8\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fa2bba0cb38\u003e":"difficulty_rating_bin:medium group:\"Functions I\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fa2bba0cb38\u003e":"difficulty_rating_bin:medium group:\"Functions I\""},"queried_facets":{"#\u003cMathWorks::Search::Field:0x00007fa2bba0ca98\u003e":["Functions I"],"#\u003cMathWorks::Search::Field:0x00007fa2bba0c9f8\u003e":["medium"]}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"search","password":"J3bGPZzQ7asjJcCk","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"difficulty_rating_bin:medium group:\"Functions I\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"difficulty_rating_bin":[["difficulty_rating_bin:medium","","","medium",""]],"group":[["group:\"Functions I\"","","\"","Functions I","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fa2bba0ca98\u003e":["Functions I"],"#\u003cMathWorks::Search::Field:0x00007fa2bba0c9f8\u003e":["medium"]},"filters":{"#\u003cMathWorks::Search::Field:0x00007fa2bba0bff8\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fa2bba0cef8\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fa2bba0cd18\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fa2bba0cbd8\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fa2bba0cb38\u003e":"difficulty_rating_bin:medium group:\"Functions I\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fa2bba0cb38\u003e":"difficulty_rating_bin:medium group:\"Functions I\""},"queried_facets":{"#\u003cMathWorks::Search::Field:0x00007fa2bba0ca98\u003e":["Functions I"],"#\u003cMathWorks::Search::Field:0x00007fa2bba0c9f8\u003e":["medium"]}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":1465,"difficulty_rating":"easy-medium"},{"id":1474,"difficulty_rating":"easy-medium"},{"id":1475,"difficulty_rating":"easy-medium"},{"id":1464,"difficulty_rating":"easy-medium"},{"id":481,"difficulty_rating":"easy-medium"},{"id":1473,"difficulty_rating":"easy-medium"},{"id":2383,"difficulty_rating":"easy-medium"},{"id":1304,"difficulty_rating":"easy-medium"},{"id":656,"difficulty_rating":"medium"},{"id":1476,"difficulty_rating":"medium"},{"id":734,"difficulty_rating":"medium"}]}}