{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-04-16T00:12:35.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-16T00: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":54670,"title":"Solve an ODE: precocious pair’s porcine pursuit","description":"In our previous encounters with Matilda and Labrun, the scintillating siblings collected candy wrappers, amused others with card tricks, and found interesting relations involving house numbers on their street. \r\nBut now their pet pig has run away, and the pair must catch her! They start a distance  away from the pig, which runs at speed  in a direction perpendicular to the line connecting the initial positions of the pig and the siblings. Matilda and Labrun run at speed , always in a direction pointing at the current position of the pig. \r\nWrite a function that takes the distance  and the two speeds and returns the time required for Matilda and Labrun to catch their pet. Return Inf if the pair will not catch the pig, and please ignore the impracticality of reporting times to the nearest microsecond. \r\nThis problem is adapted from a problem in Advanced Mathematical Methods for Scientists and Engineers by Bender and Orzsag.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; 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: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 237.45px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 118.725px; transform-origin: 407px 118.725px; 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: pre-wrap; 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: 236.133px 7.79167px; transform-origin: 236.133px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIn our previous encounters with Matilda and Labrun, the scintillating siblings \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/53004\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ecollected candy wrappers\u003c/span\u003e\u003c/span\u003e\u003c/a\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: 3.88333px 7.79167px; transform-origin: 3.88333px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/51451\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eamused others with card tricks\u003c/span\u003e\u003c/span\u003e\u003c/a\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: 17.5px 7.79167px; transform-origin: 17.5px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, and \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/51251\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003efound interesting relations involving house numbers on their street\u003c/span\u003e\u003c/span\u003e\u003c/a\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: 3.88333px 7.79167px; transform-origin: 3.88333px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; 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 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; 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: 266.292px 7.79167px; transform-origin: 266.292px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eBut now their pet pig has run away, and the pair must catch her! They start a distance \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ed\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: 104.233px 7.79167px; transform-origin: 104.233px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e away from the pig, which runs at speed \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003eV\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: 336.5px 7.79167px; transform-origin: 336.5px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e in a direction perpendicular to the line connecting the initial positions of the pig and the siblings. Matilda and Labrun run at speed \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ev\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: 197.208px 7.79167px; transform-origin: 197.208px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, always in a direction pointing at the current position of the pig. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63.45px; 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 31.725px; text-align: left; transform-origin: 384px 31.725px; white-space: pre-wrap; 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: 122.383px 7.79167px; transform-origin: 122.383px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes the distance \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ed\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: 254.775px 7.79167px; transform-origin: 254.775px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and the two speeds and returns the time required for Matilda and Labrun to catch their pet. Return \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: 11.55px 7.79167px; transform-origin: 11.55px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 11.55px 8.25px; transform-origin: 11.55px 8.25px; \"\u003eInf\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: 311.95px 7.79167px; transform-origin: 311.95px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e if the pair will not catch the pig, and please ignore the impracticality of reporting times to the nearest microsecond. \u003c/span\u003e\u003c/span\u003e\u003c/div\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: pre-wrap; 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: 133.033px 7.79167px; transform-origin: 133.033px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis problem is adapted from a problem in \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: 194.492px 7.79167px; transform-origin: 194.492px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eAdvanced Mathematical Methods for Scientists and Engineers \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: 47.4583px 7.79167px; transform-origin: 47.4583px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eby Bender and Orzsag.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function t = pigPursuit(d,V,v)\r\n%  d = initial distance between pig and M\u0026L. The pig runs perpendicular to the line connecting the initial positions\r\n%  V = pig speed\r\n%  v = M\u0026L speed\r\n%  t = time till capture\r\n\r\n  y = hypot(d/V,d/v);\r\nend","test_suite":"%%\r\nd = 5;                      %  Distance (m)\r\nV = 4;                      %  Pig speed (m/s)\r\nv = 4.1;                    %  M\u0026L speed (m/s)\r\nt_correct = 25.308642;      %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 5;                      %  Distance (m)\r\nV = 4;                      %  Pig speed (m/s)\r\nv = 4.5;                    %  M\u0026L speed (m/s)\r\nt_correct = 5.294118;       %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 5;                      %  Distance (m)\r\nV = 5;                      %  Pig speed (m/s)\r\nv = 5.1;                    %  M\u0026L speed (m/s)\r\nt_correct = 25.247525;      %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 5;                      %  Distance (m)\r\nV = 5;                      %  Pig speed (m/s)\r\nv = 5.2;                    %  M\u0026L speed (m/s)\r\nt_correct = 12.745098;      %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 10;                     %  Distance (m)\r\nV = 4;                      %  Pig speed (m/s)\r\nv = 5;                      %  M\u0026L speed (m/s)\r\nt_correct = 5.555556;       %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 10;                     %  Distance (m)\r\nV = 4;                      %  Pig speed (m/s)\r\nv = 4.3;                    %  M\u0026L speed (m/s)\r\nt_correct = 17.269076;      %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 10;                     %  Distance (m)\r\nV = 5;                      %  Pig speed (m/s)\r\nv = 5.5;                    %  M\u0026L speed (m/s)\r\nt_correct = 10.476190;      %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 10;                     %  Distance (m)\r\nV = 5;                      %  Pig speed (m/s)\r\nv = 6;                      %  M\u0026L speed (m/s)\r\nt_correct = 5.454545;       %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 20;                     %  Distance (m)\r\nV = 4;                      %  Pig speed (m/s)\r\nv = 5;                      %  M\u0026L speed (m/s)\r\nt_correct = 11.111111;      %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 20;                     %  Distance (m)\r\nV = 4;                      %  Pig speed (m/s)\r\nv = 6;                      %  M\u0026L speed (m/s)\r\nt_correct = 6;              %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 20;                     %  Distance (m)\r\nV = 5;                      %  Pig speed (m/s)\r\nv = 5.01;                   %  M\u0026L speed (m/s)\r\nt_correct = 1000.999001;    %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 20;                     %  Distance (m)\r\nV = 5;                      %  Pig speed (m/s)\r\nv = 5.001;                  %  M\u0026L speed (m/s)\r\nt_correct = 10000.9999;     %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 100*rand;\r\nV = 6*rand;\r\nv = V;\r\nassert(isinf(pigPursuit(d,V,v)))\r\n\r\n%%\r\nd = 100*rand;\r\nV = 6*rand;\r\nv = V*rand;\r\nassert(isinf(pigPursuit(d,V,v)))\r\n\r\n%%\r\nfiletext = fileread('pigPursuit.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'regexp') || contains(filetext, 'import'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":46909,"edited_by":46909,"edited_at":"2022-05-24T14:38:30.000Z","deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":"2022-05-24T14:38:30.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-05-24T14:03:33.000Z","updated_at":"2022-05-24T14:38:30.000Z","published_at":"2022-05-24T14:05:54.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\u003eIn our previous encounters with Matilda and Labrun, the scintillating siblings \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/53004\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ecollected candy wrappers\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\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/51451\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eamused others with card tricks\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/51251\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efound interesting relations involving house numbers on their street\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eBut now their pet pig has run away, and the pair must catch her! They start a distance \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\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"d\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ed\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e away from the pig, which runs at speed \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\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"V\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eV\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e in a direction perpendicular to the line connecting the initial positions of the pig and the siblings. Matilda and Labrun run at speed \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\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"v\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ev\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, always in a direction pointing at the current position of the pig. \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 takes the distance \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\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"d\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ed\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e and the two speeds and returns the time required for Matilda and Labrun to catch their pet. Return \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\u003eInf\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e if the pair will not catch the pig, and please ignore the impracticality of reporting times to the nearest microsecond. \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\u003eThis problem is adapted from a problem in \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eAdvanced Mathematical Methods for Scientists and Engineers \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eby Bender and Orzsag.\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":50928,"title":"Solve an ODE: separable equation","description":"Solve the following ordinary differential equation:\r\n\r\nwith the initial condition .The test suite will ask for the value of the solution  at point . Functions such as ode45, ode23, and ode15S are not allowed. ","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; 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: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 118px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407.5px 59px; transform-origin: 407.5px 59px; vertical-align: baseline; \"\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space: pre-wrap; 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: 150.433px 7.66667px; transform-origin: 150.433px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSolve the following ordinary differential equation:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 36px; 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: 384.5px 18px; text-align: left; transform-origin: 384.5px 18px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"vertical-align:-15px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAABICAYAAAA6cC0vAAALoUlEQVR4Xu2dWeh9VRXH9VXILH0SkT9aoKAojm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rtyIC3H52pQJNe+RxX7w88BIFfNr75UtxsCwYcroU3HJHB0i7bLM6hc1COQOVTcrMILEi+EijHPl3eN+WNWEviUnz6m59jbll1P0qTFmZnogI/i0Ea17ePvMV7FTbs5HwHkfa9j7Gf2iU/wz27g+TMa4YdGu404g5l0M1vgucLfBvBC1D0lb3fKQe3zbq8NeZ5+8LffVIKiegEowlzf6AsntapgKBY1eK0ATwCCDR8ctOAZIi+gPLc/yiXmO3iTU/It+gzS1M8oy8ps9FpR7Ra9crtRqfqWY3P1ftn6llyMxqrKHKUSSnRcv0sQesKoOc4aCFUjzObOIOA5rjn5BfArB9H/4grmjhQ5x99o3aS0U3pIYYoc71qTAN84qGzerfElBtcjTD0T1/1+zcTc7yAgcOxwzQGYAlWLVpDP1XJkcXM7NauP6x6MdbYvk5dz8hRy16rt1ipjeGhZo5HmyeU1PifTBQh5mAkIuayobHHJNPiWUlXG+kkemWNAU/ypvqALzRXMPL8AIQ8EzfZUFlW5hdxScKqFWAitNRza6xNd9Q7LFyCUDQ9gIHzG+2bACaG5OEWWv91sVL1/IGiOd/stagpRfaRW5vCTO0o/Opp9zwKEWjF/ch/Oo66pSuximdo2LnvcvQChh9C28ZEFCNs4qj36tAChh9C28ZEFCNs4qj369D+S4+1njZS7yQAAAABJRU5ErkJggg==\" alt=\"dy/dx = f(x)/g(y)\" style=\"width: 65px; height: 36px;\" width=\"65\" height=\"36\"\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 43px; 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: 384.5px 21.5px; text-align: left; transform-origin: 384.5px 21.5px; white-space: pre-wrap; 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: 73.9167px 7.66667px; transform-origin: 73.9167px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ewith the initial condition \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIEAAAAoCAYAAADZs5l2AAAF80lEQVR4Xu2aOas1RRCG7/cHBJdIDMQlMFJcQTTQwBVEUVExMRC3wEgUNwzcRRNxR+FLREUDA/dAQU1EEQXBwIUvMnLFH6DvI1PSp27NdE/fWc5wZ+DlnnumT3d11du1zRzYWa99r4ED+14DqwJ2VhKsJFhJsHJgZyXBSoJpSXCkFP6qcJfw7UTKf1jr/CU8MdF6i1xmqpxgDgKYQe7Uh2OF2xZpoQmEnoIEEOAD4QHhvQn2FC3xnL48tHqEWPtTkAADHCFcOxMBWBYi/iBcJnw+oxxbufTYJDhHu/5MOF74eWYNQMKHhLOE32aWZauWH5sEhAGMvy3x+HfJ8tgaFjY5OCYJzAucoiWnqgZyJ4xq4RrhhNzA/XR/TBKQC+CCyQe25TJiXiqB5kpSt0UX/8tRQgKSqpOE74NYepy+O7rlHq73o4YIpRvHSH8HnqNrndK5bdw/+vCIcG/fH848Ht38IvjcyuwT3SsSuY0ELHixcKtweDPTLfr7opsVQ3P/Q+H6hCQn6/M3Ao2hXKPmZo25QriwmfsP/T092Swu/J7m3hDG+7KR86IiDW0OQi97vSKSR3NC/KuEmwQSa643BF9lva7vCHFeb8Vy5jwBLPuiEeIn/fWZNS4fonAd1SiXz5cI7wrXCQjZdUEYcgY291oz0AgHAS4QMBzrREQs3mwzkGQVwuX2Hs2LF9nrFRkyN6cZmnE+x0r1VhXmShSRLnKuhPB1NkQ4o4Fthi7d40I0vmvDpuTnNegd4Wlh6CTOiFuydy8rBNrr9bEmyHlHvwZegUPIFXlXs1F6EIvlLF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5KlD9IgVp9knPFtbWPezdgV0iMSWGZOAgYL535VvO102SvkL2nAqcLXwivC0I+ehzrdfebBcz7YnP5nKg8NRLjP2S+0Z98Ssc9G1rEL0cBKgoUYakwxVxKMqd2FzL2SYCGGGlPMlQRjanchc68kWIihxhRzJcGY2l3I3P8CBtiHOAKD6OEAAAAASUVORK5CYII=\" style=\"width: 64.5px; height: 20px;\" width=\"64.5\" height=\"20\"\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: 156.35px 7.66667px; transform-origin: 156.35px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.The test suite will ask for the value of the solution \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ey\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: 26.8333px 7.66667px; transform-origin: 26.8333px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e at point \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ex\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: 84.675px 7.66667px; transform-origin: 84.675px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Functions such as ode45, ode23, and ode15S are not allowed. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = separableODE(x,f,g,x0,y0)\r\n%  x  = point at which the value of the solution is requested\r\n%  f  = function of x\r\n%  g  = function of y\r\n%  x0 = point at which the initial condition is specified\r\n%  y0 = value of the solution at x = x0\r\n\r\ny = y0+(x-x0)*f(x0)/g(y0);\r\nend","test_suite":"%%\r\nf = @(x) x;\r\ng = @(y) y;\r\nx0 = 0; y0 = 4; x = 4; \r\ny_correct = sqrt(32);\r\ny = separableODE(x,f,g,x0,y0);\r\nassert(abs(y-y_correct)\u003c1e-12)\r\n\r\n%%\r\nf = @(x) cos(x);\r\ng = @(y) exp(y);\r\nx0 = 0; y0 = 1; x = 7*pi; \r\ny_correct = 1;\r\ny = separableODE(x,f,g,x0,y0);\r\nassert(abs(y-y_correct)\u003c1e-12)\r\n\r\n%%\r\nf = @(x) ones(size(x));\r\ng = @(y) 1./y;\r\nx0 = 2; y0 = 3; x = 2.5; \r\ny_correct = 4.946163812100385;\r\ny = separableODE(x,f,g,x0,y0);\r\nassert(abs(y-y_correct)\u003c1e-12)\r\n\r\n%%\r\nf = @(x) sinh(x);\r\ng = @(y) cosh(y);\r\nx0 = 0; y0 = 0.881373587019543; x = 5; \r\ny_correct = 5.000090791616095;\r\ny = separableODE(x,f,g,x0,y0);\r\nassert(abs(y-y_correct)\u003c1e-12)\r\n\r\n%%\r\nf = @(x) exp(-x.^2);\r\ng = @(y) sqrt(y);\r\nx0 = 0; y0 = 4; x = 3; \r\ny_correct = 4.431659465773041;\r\ny = separableODE(x,f,g,x0,y0);\r\nassert(abs(y-y_correct)\u003c1e-12)\r\n\r\n%%\r\nf = @(x) 1./(1+x.^2);\r\ng = @(y) log(y)+1;\r\nx0 = 0; y0 = 1; x = 1; \r\ny_correct = 1.622607687386726;\r\ny = separableODE(x,f,g,x0,y0);\r\nassert(abs(y-y_correct)\u003c1e-12)\r\n\r\n%%\r\nf = @(x) tan(x);\r\ng = @(y) sec(y);\r\nx0 = asec(-1-sqrt(2)); y0 = 3*pi/4; x = 2.302554350306210; \r\ny_correct = 7*pi/8;\r\ny = separableODE(x,f,g,x0,y0);\r\nassert(abs(y-y_correct)\u003c1e-12)\r\n\t\r\n%%\r\nfiletext = fileread('separableODE.m');\r\nnoODEfns  = ~contains(filetext, 'ode45') \u0026\u0026 ~contains(filetext, 'ode7') \u0026\u0026 ~contains(filetext, 'ode8') \u0026\u0026 ~contains(filetext, 'ode2') \u0026\u0026 ~contains(filetext, 'ode1');\r\nassert(noODEfns, 'No built-in ODE solvers allowed')\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":5,"test_suite_updated_at":"2022-01-17T04:12:35.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2021-03-13T17:05:52.000Z","updated_at":"2022-01-17T04:12:35.000Z","published_at":"2021-03-13T17:09:14.000Z","restored_at":null,"restored_by":null,"spam":false,"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\u003eSolve the following ordinary differential equation:\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:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"true\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"dy/dx = f(x)/g(y)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\frac{dy}{dx}=\\\\frac{f(x)}{g(y)}\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\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\u003ewith the initial condition \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\u003ey(x_0) = y_0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e.The test suite will ask for the value of the solution \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\u003ey\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e at point \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\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Functions such as ode45, ode23, and ode15S are not allowed. \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\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":54670,"title":"Solve an ODE: precocious pair’s porcine pursuit","description":"In our previous encounters with Matilda and Labrun, the scintillating siblings collected candy wrappers, amused others with card tricks, and found interesting relations involving house numbers on their street. \r\nBut now their pet pig has run away, and the pair must catch her! They start a distance  away from the pig, which runs at speed  in a direction perpendicular to the line connecting the initial positions of the pig and the siblings. Matilda and Labrun run at speed , always in a direction pointing at the current position of the pig. \r\nWrite a function that takes the distance  and the two speeds and returns the time required for Matilda and Labrun to catch their pet. Return Inf if the pair will not catch the pig, and please ignore the impracticality of reporting times to the nearest microsecond. \r\nThis problem is adapted from a problem in Advanced Mathematical Methods for Scientists and Engineers by Bender and Orzsag.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; 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: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 237.45px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 118.725px; transform-origin: 407px 118.725px; 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: pre-wrap; 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: 236.133px 7.79167px; transform-origin: 236.133px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIn our previous encounters with Matilda and Labrun, the scintillating siblings \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/53004\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ecollected candy wrappers\u003c/span\u003e\u003c/span\u003e\u003c/a\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: 3.88333px 7.79167px; transform-origin: 3.88333px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/51451\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eamused others with card tricks\u003c/span\u003e\u003c/span\u003e\u003c/a\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: 17.5px 7.79167px; transform-origin: 17.5px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, and \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/51251\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003efound interesting relations involving house numbers on their street\u003c/span\u003e\u003c/span\u003e\u003c/a\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: 3.88333px 7.79167px; transform-origin: 3.88333px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; 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 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; 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: 266.292px 7.79167px; transform-origin: 266.292px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eBut now their pet pig has run away, and the pair must catch her! They start a distance \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ed\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: 104.233px 7.79167px; transform-origin: 104.233px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e away from the pig, which runs at speed \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003eV\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: 336.5px 7.79167px; transform-origin: 336.5px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e in a direction perpendicular to the line connecting the initial positions of the pig and the siblings. Matilda and Labrun run at speed \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ev\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: 197.208px 7.79167px; transform-origin: 197.208px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, always in a direction pointing at the current position of the pig. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63.45px; 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 31.725px; text-align: left; transform-origin: 384px 31.725px; white-space: pre-wrap; 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: 122.383px 7.79167px; transform-origin: 122.383px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes the distance \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ed\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: 254.775px 7.79167px; transform-origin: 254.775px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and the two speeds and returns the time required for Matilda and Labrun to catch their pet. Return \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: 11.55px 7.79167px; transform-origin: 11.55px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 11.55px 8.25px; transform-origin: 11.55px 8.25px; \"\u003eInf\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: 311.95px 7.79167px; transform-origin: 311.95px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e if the pair will not catch the pig, and please ignore the impracticality of reporting times to the nearest microsecond. \u003c/span\u003e\u003c/span\u003e\u003c/div\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: pre-wrap; 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: 133.033px 7.79167px; transform-origin: 133.033px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis problem is adapted from a problem in \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: 194.492px 7.79167px; transform-origin: 194.492px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eAdvanced Mathematical Methods for Scientists and Engineers \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: 47.4583px 7.79167px; transform-origin: 47.4583px 7.79167px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eby Bender and Orzsag.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function t = pigPursuit(d,V,v)\r\n%  d = initial distance between pig and M\u0026L. The pig runs perpendicular to the line connecting the initial positions\r\n%  V = pig speed\r\n%  v = M\u0026L speed\r\n%  t = time till capture\r\n\r\n  y = hypot(d/V,d/v);\r\nend","test_suite":"%%\r\nd = 5;                      %  Distance (m)\r\nV = 4;                      %  Pig speed (m/s)\r\nv = 4.1;                    %  M\u0026L speed (m/s)\r\nt_correct = 25.308642;      %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 5;                      %  Distance (m)\r\nV = 4;                      %  Pig speed (m/s)\r\nv = 4.5;                    %  M\u0026L speed (m/s)\r\nt_correct = 5.294118;       %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 5;                      %  Distance (m)\r\nV = 5;                      %  Pig speed (m/s)\r\nv = 5.1;                    %  M\u0026L speed (m/s)\r\nt_correct = 25.247525;      %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 5;                      %  Distance (m)\r\nV = 5;                      %  Pig speed (m/s)\r\nv = 5.2;                    %  M\u0026L speed (m/s)\r\nt_correct = 12.745098;      %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 10;                     %  Distance (m)\r\nV = 4;                      %  Pig speed (m/s)\r\nv = 5;                      %  M\u0026L speed (m/s)\r\nt_correct = 5.555556;       %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 10;                     %  Distance (m)\r\nV = 4;                      %  Pig speed (m/s)\r\nv = 4.3;                    %  M\u0026L speed (m/s)\r\nt_correct = 17.269076;      %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 10;                     %  Distance (m)\r\nV = 5;                      %  Pig speed (m/s)\r\nv = 5.5;                    %  M\u0026L speed (m/s)\r\nt_correct = 10.476190;      %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 10;                     %  Distance (m)\r\nV = 5;                      %  Pig speed (m/s)\r\nv = 6;                      %  M\u0026L speed (m/s)\r\nt_correct = 5.454545;       %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 20;                     %  Distance (m)\r\nV = 4;                      %  Pig speed (m/s)\r\nv = 5;                      %  M\u0026L speed (m/s)\r\nt_correct = 11.111111;      %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 20;                     %  Distance (m)\r\nV = 4;                      %  Pig speed (m/s)\r\nv = 6;                      %  M\u0026L speed (m/s)\r\nt_correct = 6;              %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 20;                     %  Distance (m)\r\nV = 5;                      %  Pig speed (m/s)\r\nv = 5.01;                   %  M\u0026L speed (m/s)\r\nt_correct = 1000.999001;    %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 20;                     %  Distance (m)\r\nV = 5;                      %  Pig speed (m/s)\r\nv = 5.001;                  %  M\u0026L speed (m/s)\r\nt_correct = 10000.9999;     %  Time (s)\r\nassert(abs(pigPursuit(d,V,v)-t_correct)\u003c1e-6)\r\n\r\n%%\r\nd = 100*rand;\r\nV = 6*rand;\r\nv = V;\r\nassert(isinf(pigPursuit(d,V,v)))\r\n\r\n%%\r\nd = 100*rand;\r\nV = 6*rand;\r\nv = V*rand;\r\nassert(isinf(pigPursuit(d,V,v)))\r\n\r\n%%\r\nfiletext = fileread('pigPursuit.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'regexp') || contains(filetext, 'import'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":46909,"edited_by":46909,"edited_at":"2022-05-24T14:38:30.000Z","deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":"2022-05-24T14:38:30.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-05-24T14:03:33.000Z","updated_at":"2022-05-24T14:38:30.000Z","published_at":"2022-05-24T14:05:54.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\u003eIn our previous encounters with Matilda and Labrun, the scintillating siblings \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/53004\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ecollected candy wrappers\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\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/51451\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eamused others with card tricks\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/51251\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efound interesting relations involving house numbers on their street\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eBut now their pet pig has run away, and the pair must catch her! They start a distance \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\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"d\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ed\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e away from the pig, which runs at speed \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\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"V\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eV\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e in a direction perpendicular to the line connecting the initial positions of the pig and the siblings. Matilda and Labrun run at speed \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\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"v\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ev\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e, always in a direction pointing at the current position of the pig. \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 takes the distance \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\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"d\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003ed\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e and the two speeds and returns the time required for Matilda and Labrun to catch their pet. Return \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\u003eInf\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e if the pair will not catch the pig, and please ignore the impracticality of reporting times to the nearest microsecond. \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\u003eThis problem is adapted from a problem in \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eAdvanced Mathematical Methods for Scientists and Engineers \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eby Bender and Orzsag.\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":50928,"title":"Solve an ODE: separable equation","description":"Solve the following ordinary differential equation:\r\n\r\nwith the initial condition .The test suite will ask for the value of the solution  at point . Functions such as ode45, ode23, and ode15S are not allowed. ","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; 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: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 118px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407.5px 59px; transform-origin: 407.5px 59px; vertical-align: baseline; \"\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space: pre-wrap; 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: 150.433px 7.66667px; transform-origin: 150.433px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSolve the following ordinary differential equation:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 36px; 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: 384.5px 18px; text-align: left; transform-origin: 384.5px 18px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"vertical-align:-15px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAABICAYAAAA6cC0vAAALoUlEQVR4Xu2dWeh9VRXH9VXILH0SkT9aoKAojmD5YA+VCaKYE/bwf5AcEQwbnIigQS0VxNRCwQdHMgJRqQQFC0HNUD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1COQOVTcrMILEi+EijHPl3eN+WNWEviUnz6m59jbll1P0qTFmZnogI/i0Ea17ePvMV7FTbs5HwHkfa9j7Gf2iU/wz27g+TMa4YdGu404g5l0M1vgucLfBvBC1D0lb3fKQe3zbq8NeZ5+8LffVIKiegEowlzf6AsntapgKBY1eK0ATwCCDR8ctOAZIi+gPLc/yiXmO3iTU/It+gzS1M8oy8ps9FpR7Ra9crtRqfqWY3P1ftn6llyMxqrKHKUSSnRcv0sQesKoOc4aCFUjzObOIOA5rjn5BfArB9H/4grmjhQ5x99o3aS0U3pIYYoc71qTAN84qGzerfElBtcjTD0T1/1+zcTc7yAgcOxwzQGYAlWLVpDP1XJkcXM7NauP6x6MdbYvk5dz8hRy16rt1ipjeGhZo5HmyeU1PifTBQh5mAkIuayobHHJNPiWUlXG+kkemWNAU/ypvqALzRXMPL8AIQ8EzfZUFlW5hdxScKqFWAitNRza6xNd9Q7LFyCUDQ9gIHzG+2bACaG5OEWWv91sVL1/IGiOd/stagpRfaRW5vCTO0o/Opp9zwKEWjF/ch/Oo66pSuximdo2LnvcvQChh9C28ZEFCNs4qj36tAChh9C28ZEFCNs4qj369D+S4+1njZS7yQAAAABJRU5ErkJggg==\" alt=\"dy/dx = f(x)/g(y)\" style=\"width: 65px; height: 36px;\" width=\"65\" height=\"36\"\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 43px; 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: 384.5px 21.5px; text-align: left; transform-origin: 384.5px 21.5px; white-space: pre-wrap; 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: 73.9167px 7.66667px; transform-origin: 73.9167px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ewith the initial condition \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIEAAAAoCAYAAADZs5l2AAAF80lEQVR4Xu2aOas1RRCG7/cHBJdIDMQlMFJcQTTQwBVEUVExMRC3wEgUNwzcRRNxR+FLREUDA/dAQU1EEQXBwIUvMnLFH6DvI1PSp27NdE/fWc5wZ+DlnnumT3d11du1zRzYWa99r4ED+14DqwJ2VhKsJFhJsHJgZyXBSoJpSXCkFP6qcJfw7UTKf1jr/CU8MdF6i1xmqpxgDgKYQe7Uh2OF2xZpoQmEnoIEEOAD4QHhvQn2FC3xnL48tHqEWPtTkAADHCFcOxMBWBYi/iBcJnw+oxxbufTYJDhHu/5MOF74eWYNQMKHhLOE32aWZauWH5sEhAGMvy3x+HfJ8tgaFjY5OCYJzAucoiWnqgZyJ4xq4RrhhNzA/XR/TBKQC+CCyQe25TJiXiqB5kpSt0UX/8tRQgKSqpOE74NYepy+O7rlHq73o4YIpRvHSH8HnqNrndK5bdw/+vCIcG/fH848Ht38IvjcyuwT3SsSuY0ELHixcKtweDPTLfr7opsVQ3P/Q+H6hCQn6/M3Ao2hXKPmZo25QriwmfsP/T092Swu/J7m3hDG+7KR86IiDW0OQi97vSKSR3NC/KuEmwQSa643BF9lva7vCHFeb8Vy5jwBLPuiEeIn/fWZNS4fonAd1SiXz5cI7wrXCQjZdUEYcgY291oz0AgHAS4QMBzrREQs3mwzkGQVwuX2Hs2LF9nrFRkyN6cZmnE+x0r1VhXmShSRLnKuhPB1NkQ4o4Fthi7d40I0vmvDpuTnNegd4Wlh6CTOiFuydy8rBNrr9bEmyHlHvwZegUPIFXlXs1F6EIvlLFEE3uDXZsbIHUf9+VoS2CllwySUJwpD1/S1shUrdaSBeEPC5FfuwLEc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C0I+ehzrdfebBcz7YnP5nKg8NRLjP2S+0Z98Ssc9G1rEL0cBKgoUYakwxVxKMqd2FzL2SYCGGGlPMlQRjanchc68kWIihxhRzJcGY2l3I3P8CBtiHOAKD6OEAAAAASUVORK5CYII=\" style=\"width: 64.5px; height: 20px;\" width=\"64.5\" height=\"20\"\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: 156.35px 7.66667px; transform-origin: 156.35px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.The test suite will ask for the value of the solution \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ey\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: 26.8333px 7.66667px; transform-origin: 26.8333px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e at point \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"font-family: \u0026quot;STIXGeneral\u0026quot;, \u0026quot;STIXGeneral-webfont\u0026quot;, serif; font-style: italic; font-weight: 400; color: rgb(0, 0, 0);\"\u003ex\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: 84.675px 7.66667px; transform-origin: 84.675px 7.66667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Functions such as ode45, ode23, and ode15S are not allowed. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = separableODE(x,f,g,x0,y0)\r\n%  x  = point at which the value of the solution is requested\r\n%  f  = function of x\r\n%  g  = function of y\r\n%  x0 = point at which the initial condition is specified\r\n%  y0 = value of the solution at x = x0\r\n\r\ny = y0+(x-x0)*f(x0)/g(y0);\r\nend","test_suite":"%%\r\nf = @(x) x;\r\ng = @(y) y;\r\nx0 = 0; y0 = 4; x = 4; \r\ny_correct = sqrt(32);\r\ny = separableODE(x,f,g,x0,y0);\r\nassert(abs(y-y_correct)\u003c1e-12)\r\n\r\n%%\r\nf = @(x) cos(x);\r\ng = @(y) exp(y);\r\nx0 = 0; y0 = 1; x = 7*pi; \r\ny_correct = 1;\r\ny = separableODE(x,f,g,x0,y0);\r\nassert(abs(y-y_correct)\u003c1e-12)\r\n\r\n%%\r\nf = @(x) ones(size(x));\r\ng = @(y) 1./y;\r\nx0 = 2; y0 = 3; x = 2.5; \r\ny_correct = 4.946163812100385;\r\ny = separableODE(x,f,g,x0,y0);\r\nassert(abs(y-y_correct)\u003c1e-12)\r\n\r\n%%\r\nf = @(x) sinh(x);\r\ng = @(y) cosh(y);\r\nx0 = 0; y0 = 0.881373587019543; x = 5; \r\ny_correct = 5.000090791616095;\r\ny = separableODE(x,f,g,x0,y0);\r\nassert(abs(y-y_correct)\u003c1e-12)\r\n\r\n%%\r\nf = @(x) exp(-x.^2);\r\ng = @(y) sqrt(y);\r\nx0 = 0; y0 = 4; x = 3; \r\ny_correct = 4.431659465773041;\r\ny = separableODE(x,f,g,x0,y0);\r\nassert(abs(y-y_correct)\u003c1e-12)\r\n\r\n%%\r\nf = @(x) 1./(1+x.^2);\r\ng = @(y) log(y)+1;\r\nx0 = 0; y0 = 1; x = 1; \r\ny_correct = 1.622607687386726;\r\ny = separableODE(x,f,g,x0,y0);\r\nassert(abs(y-y_correct)\u003c1e-12)\r\n\r\n%%\r\nf = @(x) tan(x);\r\ng = @(y) sec(y);\r\nx0 = asec(-1-sqrt(2)); y0 = 3*pi/4; x = 2.302554350306210; \r\ny_correct = 7*pi/8;\r\ny = separableODE(x,f,g,x0,y0);\r\nassert(abs(y-y_correct)\u003c1e-12)\r\n\t\r\n%%\r\nfiletext = fileread('separableODE.m');\r\nnoODEfns  = ~contains(filetext, 'ode45') \u0026\u0026 ~contains(filetext, 'ode7') \u0026\u0026 ~contains(filetext, 'ode8') \u0026\u0026 ~contains(filetext, 'ode2') \u0026\u0026 ~contains(filetext, 'ode1');\r\nassert(noODEfns, 'No built-in ODE solvers allowed')\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":5,"test_suite_updated_at":"2022-01-17T04:12:35.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2021-03-13T17:05:52.000Z","updated_at":"2022-01-17T04:12:35.000Z","published_at":"2021-03-13T17:09:14.000Z","restored_at":null,"restored_by":null,"spam":false,"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\u003eSolve the following ordinary differential equation:\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:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"true\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"dy/dx = f(x)/g(y)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\frac{dy}{dx}=\\\\frac{f(x)}{g(y)}\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\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\u003ewith the initial condition \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\u003ey(x_0) = y_0\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e.The test suite will ask for the value of the solution \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\u003ey\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e at point \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\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Functions such as ode45, ode23, and ode15S are not allowed. \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\"}]}"}],"term":"tag:\"separable\"","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:\"separable\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"separable\"","","\"","separable","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fdd4590e758\u003e":null,"#\u003cMathWorks::Search::Field:0x00007fdd4590e6b8\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fdd4590ddf8\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fdd4590e9d8\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fdd4590e938\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fdd4590e898\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fdd4590e7f8\u003e":"tag:\"separable\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fdd4590e7f8\u003e":"tag:\"separable\""},"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:\"separable\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"separable\"","","\"","separable","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fdd4590e758\u003e":null,"#\u003cMathWorks::Search::Field:0x00007fdd4590e6b8\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fdd4590ddf8\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fdd4590e9d8\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fdd4590e938\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fdd4590e898\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fdd4590e7f8\u003e":"tag:\"separable\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fdd4590e7f8\u003e":"tag:\"separable\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":54670,"difficulty_rating":"medium"},{"id":50928,"difficulty_rating":"medium"}]}}