{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-04-06T14:01:22.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":"2026-04-06T00: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":60748,"title":"Extend the digamma function to negative arguments","description":"While solving one of Ramon Villamangca’s problems, I needed the value of , where  is the digamma function. However, MATLAB’s function psi does not work for negative arguments. \r\nWrite a function that extends the digamma function to negative arguments. ","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 72px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 36px; transform-origin: 407px 36px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWhile solving one of Ramon Villamangca’s problems, I needed the value of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHMAAAAkCAYAAAC6yAWpAAAAAXNSR0IArs4c6QAAB21JREFUeF7tmwWobkUUhddTscVuxHiK3aAY2C0GInZhYHc3KnbrsxW7QMXAwEAFFexC7EYFW2yx5oM9ct65c2bmxP3//17vAfG9e+dM7DV777XXPm+cxp5RY4Fxo+YkYwfRGJjdXYLpJc0l6S1J/3Q3bf5M/QaT9VeU9JmkT/O3PZAjD5Y0o6STJP3VcoeTSFpT0suSvs2dq59gTiZpT9vsbf26zbmGSowDxCslXSDp6Y7mnFvSoe6CXCjp45w5+wUmQB4o6XNJIx1I7LyCpEMk7e3O9V2O4TPHzC7pyFxA+wXmNpJWtY3+nHmwQR2GDY+V9Iuk84chwqzi8jD2OkpS1Fb9AHMhO/Thkt7sI0IzS9pV0uSSTm2xjzklXepAPFHSaxXzMGY7SRuaF5MHn5B0naSnJP0ZWX9Sd1GOsMtyUeyy9BpMNsahf5V0VgdEoQkGgLiLpP0lzSvpBEmnNJnI3lnXgNov4DnYd33LpQtXrEFOxLNjXje/pMssh75Rtddeg7m4EQVyS9UtbmHX6KtTSNrZGYU8RM6GfU7XEky8+gxJGPiawOqLSrpV0jPmhe87L57NsdTNHHhEppnsnYPcn2NehxNw4fDgSrbcazAx4LKS9nW37MfhQq1iXgzCQ9kwq6RbXIhbpyWYeMzF5jFvl9bl8hC+v3KX5txAKF1d0vUWHR6VtJNj919EbEIEANBt3aX8MDSul2BSVF8t6SVJp/cYyPJyhNqbLQS2CbNbSAIUctrvpUUIq8eYB34ZOK9POccbiJtIejFilwWN+Z8s6d5+g7mUpDskHVa1mR4C3AWYUxmRe6DiPJtaBAiFX39UvO1h+wvsPlajemcgpBNqh6hMvfRMNk5YSd3AXmDaBZjk/9OstqRebvJQdsBmX5e0lUmBVfP4/DxLVZoqg7mcbXBlSQ8Zy3q3NPvGz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EypXvOCvtKsghKSb1xPaBSMG6OBlfMgafEJieOu9jdSaboe2yuQF4twGBIfj5nYH2T2zjNIfprnPLU2E5ZYA6v4cFrmRhHiMDDA/eArCPG7kIeR1g4Bk31JDvNjLC4hvQqb1SP4aIIeEdRQ1hgZxZ+VR1TYjzhBX+wwDUVDx8Skgj9QMn80HPQ+JAatP8HlkP0YEwniNj5cw5nGPwDHqTeEYVWx+O9b13E0kgTtHokdMCI/GSG/n0gfifmy9SlwiFaTG78akQNxyGyp2zK/kud73iOGp7GDR8JClQpMAs1p0piazuZv3HTlBuPr2oW3fVXa/peJQvOAS9y16SNoBECycdJYHkcCkw+bcTfF6xhrE4AO36mcOATPXyul43d7628l3uOsVx5PcFXG8YyS87aqXAJLc96D71+GlAvhBoYpg27/jvdEgtTeS7NmvXfjcFpm+e0miOSXW1Fx4hL2CfRayZPqiR4z9TxsDkVi7pGOwMrqD93rTatv+6aYRgODK3mfLMkXmq/+mux8AcRcD/C0IJrjQP7pcZAAAAAElFTkSuQmCC\" width=\"57.5\" height=\"18\" style=\"width: 57.5px; height: 18px;\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, where \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAkCAYAAAA5DDySAAAAAXNSR0IArs4c6QAABVxJREFUaEPtmXWobUUUxn8Pxe7AQFH/ELG7E8HGArEVUbEDWxG7WzF4FiI2qBiIYqCICibYhd3Y2O38ZA2M++199j6ee8958By43MPZs2fW+uZba31rzgSm8DFhCvef/wEYMQM8gFWBj4APxsCWxYGpgRe7rjVKBmjo3sBXwM3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D6wdwuqzmr1lnaXPEHiozrYqADME2jpm4+K11Y+h7BQTqsJMv4WB64NeGmPotJUlGXNNOPVUjUHaM0uwyJsiS6pCRgc8iByGOQ/YXpunTo6Gp7qkQHuYvlcLeJ0Q8iWdzzVd9JXEUtxmRnBE3oSk4rsySp9qrG24n/liwVjTLq0cywF3AHOk5sVQUdm5Rz7dVeK5ekBGfB9luu70DWfvHrTPw6sddQCowZXAlhx1gApMhLcKpzVQQLza8vvbGtBv2jPHtA1KNWR8Js0VXN4UmzA/LRYyF3mjZKWSBX5uuk43+8seQ0j2dAbAicae9PJv9bhq9vsL02Xmg8mAt1NWfauuv26jQDw3K9vEGGJ1DUzHZRqn+fvAqcEOGdw4utwHiKSx/kT01Lm7G8RI91VpLpEE1iV9MqhtX8PHnGHj9FLb5DYASl1QVoW2dbs8d28TlC20V1aNNO2yWMzReaW7FevlLu+1AVBq8H2iNHZZt58584bz3/bzUsNcW2iB7NxttgFgrN4b2XbYNzljgEf7Em0AKITs7fvV3+07TyYzegFg+7t0yvyzAd/EL67j+UPGSCBpY8BIjBrmplM8AH8D16w7NEWP2T8AAAAASUVORK5CYII=\" width=\"32\" height=\"18\" style=\"width: 32px; height: 18px;\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is the digamma function. However, MATLAB’s function \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003epsi\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e does not work for negative arguments. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that extends the digamma function to negative arguments. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = newpsi(x)\r\n  y = -psi(abs(x));\r\nend","test_suite":"%%\r\nx = -1/2;\r\ny = newpsi(x);\r\ny_correct = 0.0364899739785765;\r\nassert(abs(y-y_correct)\u003c1e-13)\r\n\r\n%%\r\nx = -1/3;\r\ny = newpsi(x);\r\ny_correct = 1.68176558421341;\r\nassert(abs(y-y_correct)\u003c1e-13)\r\n\r\n%%\r\nx = -1/4;\r\ny = newpsi(x);\r\ny_correct = 2.91413912021353;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -1/5;\r\ny = newpsi(x);\r\ny_correct = 4.03499143329386;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -2/7;\r\ny = newpsi(x);\r\ny_correct = 2.31981855966050;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -3/8;\r\ny = newpsi(x);\r\ny_correct = 1.21395790209010;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -4/9;\r\ny = newpsi(x);\r\ny_correct = 0.537183359660484;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -5/11;\r\ny = newpsi(x);\r\ny_correct = 0.444812910020638;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -17/13;\r\ny = newpsi(x);\r\ny_correct = 2.77268958155960;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -37/19;\r\ny = newpsi(x);\r\ny_correct = -17.9247506862983;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -exp(1);\r\ny = newpsi(x);\r\ny_correct = -1.39770931071902;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -pi;\r\ny = newpsi(x);\r\ny_correct = 7.88595238538549;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -sqrt(73);\r\ny = newpsi(x);\r\ny_correct = 1.76552281819428;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -sqrt(273);\r\ny = newpsi(x);\r\ny_correct = 2.61015605350263;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -sqrt(7073);\r\ny = newpsi(x);\r\ny_correct = 13.9912915572908;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = 1;\r\ny = newpsi(x);\r\ny_correct = -0.577215664901532;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = sqrt(7073);\r\ny = newpsi(x);\r\ny_correct = 4.426062993434546;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -[293/37 263/47 233/67 223/97 193/107 173/127 163/137];\r\ny = arrayfun(@newpsi,x);\r\ns = sum(y);\r\np = prod(y);\r\ns_correct = -0.500409630494963;\r\np_correct = 1714.480727245714;\r\nassert(abs(s-s_correct)\u003c1e-11)\r\nassert(abs(p-p_correct)\u003c1e-8)","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":46909,"edited_by":46909,"edited_at":"2024-10-13T04:37:44.000Z","deleted_by":null,"deleted_at":null,"solvers_count":6,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2024-10-13T04:28:19.000Z","updated_at":"2025-10-02T13:47:28.000Z","published_at":"2024-10-13T04:37:44.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhile solving one of Ramon Villamangca’s problems, I needed the value of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\psi(-1/2)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, where \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\psi(x)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e is the digamma function. However, MATLAB’s function \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\u003epsi\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e does not work for negative arguments. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that extends the digamma function to negative arguments. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":2449,"title":"Back to the future II","description":"See test suite","description_html":"\u003cp\u003eSee test suite\u003c/p\u003e","function_template":"function y = your_solution()\r\n  y = 5;\r\nend","test_suite":"%%\r\n% Create necessary files\r\nfid = fopen('myfunction.m', 'w');fprintf(fid, 'function [a, b]=myfunction(), a=now; b=@()1;');fclose(fid);\r\nrehash;\r\n\r\n% Execute my function 10 times\r\ny=cell(10,1);\r\nfor iter=1:10\r\n[x y{iter}]=myfunction();\r\nend\r\n\r\n% Ouch! I have overwritten the value of \"x\"\r\n% Your task is to recover the value of the 3rd \"x\"\r\n\r\nx3=your_solution();\r\n\r\n% Clean the working directory (just in case)\r\n!/bin/rm checksolution.*\r\n\r\n% Build the solution checker checksolution.p\r\n!/bin/echo \"7630302e30307630302e30300005001cafeb3fb50000002c000000b7000000d0ef156cd482f6727568c9cb0434da4ffad9a709bcec12d21f8ccf6a6c736d54e232a2d8ed0f6c4af6e41cc8816d0521bc25f8f51890e51c1b4b151fd6b9731f0a501974f4c3b7fc8831644a60d74f49599303f43d51c9ce82b407b10a500ddd2e02933868a8815ce645d02a48c2c7fb5de99f2bc5fa313693cfc79482545e1aba66aa34776b8e2a46a370f472bfb3e2332bbf0ccc4043646014651579160c1ef8694310327422bee0059f02d33326f7b77b41cf2f273e4e\" | /usr/bin/xxd -ps -r \u003e checksolution.p\r\nrehash;\r\n\r\n% Check how you have done\r\nif checksolution(x3) else fail{'☠'}, end","published":true,"deleted":false,"likes_count":0,"comments_count":5,"created_by":5925,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":13,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-07-19T08:53:14.000Z","updated_at":"2025-12-04T13:49:22.000Z","published_at":"2014-07-19T09:16:05.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eSee test suite\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":2450,"title":"Back to the Future III","description":"Marty McFly and Doc Brown are \"back\" again. See the test suite to see what they are up to.","description_html":"\u003cp\u003eMarty McFly and Doc Brown are \"back\" again. See the test suite to see what they are up to.\u003c/p\u003e","function_template":"function y = your_solution()\r\n  y = 'use the flux capacitor';\r\nend","test_suite":"%%\r\n% Create necessary files\r\nfid = fopen('myfunction.m', 'w');fprintf(fid, 'function [a, b]=myfunction(), a=now; b=@()1;');fclose(fid);\r\nrehash;\r\n\r\n% Execute my function 10 times\r\ny=cell(10,1);\r\nfor iter=1:10\r\n[x y{iter}]=myfunction();\r\nend\r\n\r\n% Ouch! I have overwritten the value of \"x\"\r\n% Your task is to recover the value of the 3rd \"x\"\r\n\r\nx3=your_solution();\r\n\r\n% Clean the working directory (just in case)\r\n!/bin/rm checksolution.*\r\n\r\n% Build the solution checker checksolution.p\r\n!/bin/echo \"7630302e30307630302e30300005001cafeb3fb50000002c000000b7000000d0ef156cd482f6727568c9cb0434da4ffad9a709bcec12d21f8ccf6a6c736d54e232a2d8ed0f6c4af6e41cc8816d0521bc25f8f51890e51c1b4b151fd6b9731f0a501974f4c3b7fc8831644a60d74f49599303f43d51c9ce82b407b10a500ddd2e02933868a8815ce645d02a48c2c7fb5de99f2bc5fa313693cfc79482545e1aba66aa34776b8e2a46a370f472bfb3e2332bbf0ccc4043646014651579160c1ef8694310327422bee0059f02d33326f7b77b41cf2f273e4e\" | /usr/bin/xxd -ps -r \u003e checksolution.p\r\n\r\n% Check how you have done\r\nif checksolution(x3) else 'WRONG'+'ANSWER', end\r\n\r\n%{  \r\n\r\n \"I would prefer even to fail with honor than win by cheating.\"\r\n\r\n                                                                Sophocles\r\n\r\n%}\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":5925,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":12,"test_suite_updated_at":"2014-07-19T20:22:59.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-07-19T20:11:02.000Z","updated_at":"2025-11-22T20:19:29.000Z","published_at":"2014-07-19T20:16:20.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eMarty McFly and Doc Brown are \\\"back\\\" again. See the test suite to see what they are up to.\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":2448,"title":"Back to the future","description":"See test suite\r\n\r\nSee also:\r\nhttp://www.mathworks.com/matlabcentral/cody/problems/2449-back-to-the-future-ii","description_html":"\u003cp\u003eSee test suite\u003c/p\u003e\u003cp\u003eSee also: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/2449-back-to-the-future-ii\"\u003ehttp://www.mathworks.com/matlabcentral/cody/problems/2449-back-to-the-future-ii\u003c/a\u003e\u003c/p\u003e","function_template":"function y = your_solution(x)\r\n  y = x;\r\nend","test_suite":"%%\r\n% Create necessary files\r\nfid = fopen('myfunction.m', 'w');fprintf(fid, 'function [a, b]=myfunction(), a=rand; b=@()1;');fclose(fid);\r\nrehash;\r\n\r\n% Execute my function 10 times\r\ny=cell(10,1);\r\nfor iter=1:10\r\n[x y{iter}]=myfunction();\r\nend\r\n\r\n% Ouch! I have overwritten the value of \"x\"\r\n% Your task is to recover the value of the 3rd \"x\"\r\n\r\n% Now I am downloading my secret solver\r\nurlwrite('https://github.com/masdeseiscaracteres/files4codygame/blob/master/my_secret_solver.p?raw=true','my_secret_solver.p');\r\nrehash;\r\n\r\n% I compare your solution with my secret solver to see how you have done\r\nif my_secret_solver~=your_solution, fail{-1}, end","published":true,"deleted":false,"likes_count":2,"comments_count":4,"created_by":5925,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":14,"test_suite_updated_at":"2014-07-18T19:16:07.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-07-18T18:11:07.000Z","updated_at":"2014-07-19T09:20:01.000Z","published_at":"2014-07-18T19:12: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\u003eSee 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\u003eSee also:\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://www.mathworks.com/matlabcentral/cody/problems/2449-back-to-the-future-ii\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://www.mathworks.com/matlabcentral/cody/problems/2449-back-to-the-future-ii\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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":60748,"title":"Extend the digamma function to negative arguments","description":"While solving one of Ramon Villamangca’s problems, I needed the value of , where  is the digamma function. However, MATLAB’s function psi does not work for negative arguments. \r\nWrite a function that extends the digamma function to negative arguments. ","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 72px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 36px; transform-origin: 407px 36px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWhile solving one of Ramon Villamangca’s problems, I needed the value of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHMAAAAkCAYAAAC6yAWpAAAAAXNSR0IArs4c6QAAB21JREFUeF7tmwWobkUUhddTscVuxHiK3aAY2C0GInZhYHc3KnbrsxW7QMXAwEAFFexC7EYFW2yx5oM9ct65c2bmxP3//17vAfG9e+dM7DV777XXPm+cxp5RY4Fxo+YkYwfRGJjdXYLpJc0l6S1J/3Q3bf5M/QaT9VeU9JmkT/O3PZAjD5Y0o6STJP3VcoeTSFpT0suSvs2dq59gTiZpT9vsbf26zbmGSowDxCslXSDp6Y7mnFvSoe6CXCjp45w5+wUmQB4o6XNJIx1I7LyCpEMk7e3O9V2O4TPHzC7pyFxA+wXmNpJWtY3+nHmwQR2GDY+V9Iuk84chwqzi8jD2OkpS1Fb9AHMhO/Thkt7sI0IzS9pV0uSSTm2xjzklXepAPFHSaxXzMGY7SRuaF5MHn5B0naSnJP0ZWX9Sd1GOsMtyUeyy9BpMNsahf5V0VgdEoQkGgLiLpP0lzSvpBEmnNJnI3lnXgNov4DnYd33LpQtXrEFOxLNjXje/pMssh75Rtddeg7m4EQVyS9UtbmHX6KtTSNrZGYU8RM6GfU7XEky8+gxJGPiawOqLSrpV0jPmhe87L57NsdTNHHhEppnsnYPcn2NehxNw4fDgSrbcazAx4LKS9nW37MfhQq1iXgzCQ9kwq6RbXIhbpyWYeMzF5jFvl9bl8hC+v3KX5txAKF1d0vUWHR6VtJNj919EbEIEANBt3aX8MDSul2BSVF8t6SVJp/cYyPJyhNqbLQS2CbNbSAIUctrvpUUIq8eYB34ZOK9POccbiJtIejFilwWN+Z8s6d5+g7mUpDskHVa1mR4C3AWYUxmRe6DiPJtaBAiFX39UvO1h+wvsPlajemcgpBNqh6hMvfRMNk5YSd3AXmDaBZjk/9OstqRebvJQdsBmX5e0lUmBVfP4/DxLVZoqg7mcbXB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+fASxA++evA5MLUX7EKEypXvOCvtKsghKSb1xPaBSMG6OBlfMgafEJieOu9jdSaboe2yuQF4twGBIfj5nYH2T2zjNIfprnPLU2E5ZYA6v4cFrmRhHiMDDA/eArCPG7kIeR1g4Bk31JDvNjLC4hvQqb1SP4aIIeEdRQ1hgZxZ+VR1TYjzhBX+wwDUVDx8Skgj9QMn80HPQ+JAatP8HlkP0YEwniNj5cw5nGPwDHqTeEYVWx+O9b13E0kgTtHokdMCI/GSG/n0gfifmy9SlwiFaTG78akQNxyGyp2zK/kud73iOGp7GDR8JClQpMAs1p0piazuZv3HTlBuPr2oW3fVXa/peJQvOAS9y16SNoBECycdJYHkcCkw+bcTfF6xhrE4AO36mcOATPXyul43d7628l3uOsVx5PcFXG8YyS87aqXAJLc96D71+GlAvhBoYpg27/jvdEgtTeS7NmvXfjcFpm+e0miOSXW1Fx4hL2CfRayZPqiR4z9TxsDkVi7pGOwMrqD93rTatv+6aYRgODK3mfLMkXmq/+mux8AcRcD/C0IJrjQP7pcZAAAAAElFTkSuQmCC\" width=\"57.5\" height=\"18\" style=\"width: 57.5px; height: 18px;\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, where \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAkCAYAAAA5DDySAAAAAXNSR0IArs4c6QAABVxJREFUaEPtmXWobUUUxn8Pxe7AQFH/ELG7E8HGArEVUbEDWxG7WzF4FiI2qBiIYqCICibYhd3Y2O38ZA2M++199j6ee8958By43MPZs2fW+uZba31rzgSm8DFhCvef/wEYMQM8gFWBj4APxsCWxYGpgRe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5lVQesPlYamWgvYVVRD6wdwuqzmr1lnaXPEHiozrYqADME2jpm4+K11Y+h7BQTqsJMv4WB64NeGmPotJUlGXNNOPVUjUHaM0uwyJsiS6pCRgc8iByGOQ/YXpunTo6Gp7qkQHuYvlcLeJ0Q8iWdzzVd9JXEUtxmRnBE3oSk4rsySp9qrG24n/liwVjTLq0cywF3AHOk5sVQUdm5Rz7dVeK5ekBGfB9luu70DWfvHrTPw6sddQCowZXAlhx1gApMhLcKpzVQQLza8vvbGtBv2jPHtA1KNWR8Js0VXN4UmzA/LRYyF3mjZKWSBX5uuk43+8seQ0j2dAbAicae9PJv9bhq9vsL02Xmg8mAt1NWfauuv26jQDw3K9vEGGJ1DUzHZRqn+fvAqcEOGdw4utwHiKSx/kT01Lm7G8RI91VpLpEE1iV9MqhtX8PHnGHj9FLb5DYASl1QVoW2dbs8d28TlC20V1aNNO2yWMzReaW7FevlLu+1AVBq8H2iNHZZt58584bz3/bzUsNcW2iB7NxttgFgrN4b2XbYNzljgEf7Em0AKITs7fvV3+07TyYzegFg+7t0yvyzAd/EL67j+UPGSCBpY8BIjBrmplM8AH8D16w7NEWP2T8AAAAASUVORK5CYII=\" width=\"32\" height=\"18\" style=\"width: 32px; height: 18px;\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is the digamma function. However, MATLAB’s function \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003epsi\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e does not work for negative arguments. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that extends the digamma function to negative arguments. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = newpsi(x)\r\n  y = -psi(abs(x));\r\nend","test_suite":"%%\r\nx = -1/2;\r\ny = newpsi(x);\r\ny_correct = 0.0364899739785765;\r\nassert(abs(y-y_correct)\u003c1e-13)\r\n\r\n%%\r\nx = -1/3;\r\ny = newpsi(x);\r\ny_correct = 1.68176558421341;\r\nassert(abs(y-y_correct)\u003c1e-13)\r\n\r\n%%\r\nx = -1/4;\r\ny = newpsi(x);\r\ny_correct = 2.91413912021353;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -1/5;\r\ny = newpsi(x);\r\ny_correct = 4.03499143329386;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -2/7;\r\ny = newpsi(x);\r\ny_correct = 2.31981855966050;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -3/8;\r\ny = newpsi(x);\r\ny_correct = 1.21395790209010;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -4/9;\r\ny = newpsi(x);\r\ny_correct = 0.537183359660484;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -5/11;\r\ny = newpsi(x);\r\ny_correct = 0.444812910020638;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -17/13;\r\ny = newpsi(x);\r\ny_correct = 2.77268958155960;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -37/19;\r\ny = newpsi(x);\r\ny_correct = -17.9247506862983;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -exp(1);\r\ny = newpsi(x);\r\ny_correct = -1.39770931071902;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -pi;\r\ny = newpsi(x);\r\ny_correct = 7.88595238538549;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -sqrt(73);\r\ny = newpsi(x);\r\ny_correct = 1.76552281819428;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -sqrt(273);\r\ny = newpsi(x);\r\ny_correct = 2.61015605350263;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -sqrt(7073);\r\ny = newpsi(x);\r\ny_correct = 13.9912915572908;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = 1;\r\ny = newpsi(x);\r\ny_correct = -0.577215664901532;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = sqrt(7073);\r\ny = newpsi(x);\r\ny_correct = 4.426062993434546;\r\nassert(abs(y-y_correct)\u003c1e-11)\r\n\r\n%%\r\nx = -[293/37 263/47 233/67 223/97 193/107 173/127 163/137];\r\ny = arrayfun(@newpsi,x);\r\ns = sum(y);\r\np = prod(y);\r\ns_correct = -0.500409630494963;\r\np_correct = 1714.480727245714;\r\nassert(abs(s-s_correct)\u003c1e-11)\r\nassert(abs(p-p_correct)\u003c1e-8)","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":46909,"edited_by":46909,"edited_at":"2024-10-13T04:37:44.000Z","deleted_by":null,"deleted_at":null,"solvers_count":6,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2024-10-13T04:28:19.000Z","updated_at":"2025-10-02T13:47:28.000Z","published_at":"2024-10-13T04:37:44.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhile solving one of Ramon Villamangca’s problems, I needed the value of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\psi(-1/2)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, where \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\psi(x)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e is the digamma function. However, MATLAB’s function \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\u003epsi\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e does not work for negative arguments. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that extends the digamma function to negative arguments. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":2449,"title":"Back to the future II","description":"See test suite","description_html":"\u003cp\u003eSee test suite\u003c/p\u003e","function_template":"function y = your_solution()\r\n  y = 5;\r\nend","test_suite":"%%\r\n% Create necessary files\r\nfid = fopen('myfunction.m', 'w');fprintf(fid, 'function [a, b]=myfunction(), a=now; b=@()1;');fclose(fid);\r\nrehash;\r\n\r\n% Execute my function 10 times\r\ny=cell(10,1);\r\nfor iter=1:10\r\n[x y{iter}]=myfunction();\r\nend\r\n\r\n% Ouch! I have overwritten the value of \"x\"\r\n% Your task is to recover the value of the 3rd \"x\"\r\n\r\nx3=your_solution();\r\n\r\n% Clean the working directory (just in case)\r\n!/bin/rm checksolution.*\r\n\r\n% Build the solution checker checksolution.p\r\n!/bin/echo \"7630302e30307630302e30300005001cafeb3fb50000002c000000b7000000d0ef156cd482f6727568c9cb0434da4ffad9a709bcec12d21f8ccf6a6c736d54e232a2d8ed0f6c4af6e41cc8816d0521bc25f8f51890e51c1b4b151fd6b9731f0a501974f4c3b7fc8831644a60d74f49599303f43d51c9ce82b407b10a500ddd2e02933868a8815ce645d02a48c2c7fb5de99f2bc5fa313693cfc79482545e1aba66aa34776b8e2a46a370f472bfb3e2332bbf0ccc4043646014651579160c1ef8694310327422bee0059f02d33326f7b77b41cf2f273e4e\" | /usr/bin/xxd -ps -r \u003e checksolution.p\r\nrehash;\r\n\r\n% Check how you have done\r\nif checksolution(x3) else fail{'☠'}, end","published":true,"deleted":false,"likes_count":0,"comments_count":5,"created_by":5925,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":13,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-07-19T08:53:14.000Z","updated_at":"2025-12-04T13:49:22.000Z","published_at":"2014-07-19T09:16:05.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eSee test suite\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":2450,"title":"Back to the Future III","description":"Marty McFly and Doc Brown are \"back\" again. See the test suite to see what they are up to.","description_html":"\u003cp\u003eMarty McFly and Doc Brown are \"back\" again. See the test suite to see what they are up to.\u003c/p\u003e","function_template":"function y = your_solution()\r\n  y = 'use the flux capacitor';\r\nend","test_suite":"%%\r\n% Create necessary files\r\nfid = fopen('myfunction.m', 'w');fprintf(fid, 'function [a, b]=myfunction(), a=now; b=@()1;');fclose(fid);\r\nrehash;\r\n\r\n% Execute my function 10 times\r\ny=cell(10,1);\r\nfor iter=1:10\r\n[x y{iter}]=myfunction();\r\nend\r\n\r\n% Ouch! I have overwritten the value of \"x\"\r\n% Your task is to recover the value of the 3rd \"x\"\r\n\r\nx3=your_solution();\r\n\r\n% Clean the working directory (just in case)\r\n!/bin/rm checksolution.*\r\n\r\n% Build the solution checker checksolution.p\r\n!/bin/echo \"7630302e30307630302e30300005001cafeb3fb50000002c000000b7000000d0ef156cd482f6727568c9cb0434da4ffad9a709bcec12d21f8ccf6a6c736d54e232a2d8ed0f6c4af6e41cc8816d0521bc25f8f51890e51c1b4b151fd6b9731f0a501974f4c3b7fc8831644a60d74f49599303f43d51c9ce82b407b10a500ddd2e02933868a8815ce645d02a48c2c7fb5de99f2bc5fa313693cfc79482545e1aba66aa34776b8e2a46a370f472bfb3e2332bbf0ccc4043646014651579160c1ef8694310327422bee0059f02d33326f7b77b41cf2f273e4e\" | /usr/bin/xxd -ps -r \u003e checksolution.p\r\n\r\n% Check how you have done\r\nif checksolution(x3) else 'WRONG'+'ANSWER', end\r\n\r\n%{  \r\n\r\n \"I would prefer even to fail with honor than win by cheating.\"\r\n\r\n                                                                Sophocles\r\n\r\n%}\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":5925,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":12,"test_suite_updated_at":"2014-07-19T20:22:59.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-07-19T20:11:02.000Z","updated_at":"2025-11-22T20:19:29.000Z","published_at":"2014-07-19T20:16:20.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eMarty McFly and Doc Brown are \\\"back\\\" again. See the test suite to see what they are up to.\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":2448,"title":"Back to the future","description":"See test suite\r\n\r\nSee also:\r\nhttp://www.mathworks.com/matlabcentral/cody/problems/2449-back-to-the-future-ii","description_html":"\u003cp\u003eSee test suite\u003c/p\u003e\u003cp\u003eSee also: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/2449-back-to-the-future-ii\"\u003ehttp://www.mathworks.com/matlabcentral/cody/problems/2449-back-to-the-future-ii\u003c/a\u003e\u003c/p\u003e","function_template":"function y = your_solution(x)\r\n  y = x;\r\nend","test_suite":"%%\r\n% Create necessary files\r\nfid = fopen('myfunction.m', 'w');fprintf(fid, 'function [a, b]=myfunction(), a=rand; b=@()1;');fclose(fid);\r\nrehash;\r\n\r\n% Execute my function 10 times\r\ny=cell(10,1);\r\nfor iter=1:10\r\n[x y{iter}]=myfunction();\r\nend\r\n\r\n% Ouch! I have overwritten the value of \"x\"\r\n% Your task is to recover the value of the 3rd \"x\"\r\n\r\n% Now I am downloading my secret solver\r\nurlwrite('https://github.com/masdeseiscaracteres/files4codygame/blob/master/my_secret_solver.p?raw=true','my_secret_solver.p');\r\nrehash;\r\n\r\n% I compare your solution with my secret solver to see how you have done\r\nif my_secret_solver~=your_solution, fail{-1}, end","published":true,"deleted":false,"likes_count":2,"comments_count":4,"created_by":5925,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":14,"test_suite_updated_at":"2014-07-18T19:16:07.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-07-18T18:11:07.000Z","updated_at":"2014-07-19T09:20:01.000Z","published_at":"2014-07-18T19:12: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\u003eSee 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\u003eSee also:\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://www.mathworks.com/matlabcentral/cody/problems/2449-back-to-the-future-ii\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://www.mathworks.com/matlabcentral/cody/problems/2449-back-to-the-future-ii\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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":"tag:\"reflection\"","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":"tag:\"reflection\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"reflection\"","","\"","reflection","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f9c693d2db0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f9c693d2d10\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f9c693d1eb0\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f9c693d3030\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f9c693d2f90\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f9c693d2ef0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f9c693d2e50\u003e":"tag:\"reflection\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f9c693d2e50\u003e":"tag:\"reflection\""},"queried_facets":{}},"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":"cody-search","password":"78X075ddcV44","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":"tag:\"reflection\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"reflection\"","","\"","reflection","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f9c693d2db0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f9c693d2d10\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f9c693d1eb0\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f9c693d3030\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f9c693d2f90\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f9c693d2ef0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f9c693d2e50\u003e":"tag:\"reflection\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f9c693d2e50\u003e":"tag:\"reflection\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":60748,"difficulty_rating":"medium"},{"id":2449,"difficulty_rating":"medium"},{"id":2450,"difficulty_rating":"medium"},{"id":2448,"difficulty_rating":"medium-hard"}]}}