{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2025-12-14T01:33:56.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2025-12-14T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":321,"title":"polar inertia","description":"given locations of a set of unit masses on complex plane, find polar moment of inerta about the origin. for example output 4 if input [0 1 1+1i 0-1i] ","description_html":"\u003cp\u003egiven locations of a set of unit masses on complex plane, find polar moment of inerta about the origin. for example output 4 if input [0 1 1+1i 0-1i]\u003c/p\u003e","function_template":"function z = polatia(xy)\r\n  z = sum(abs(xy));\r\nend","test_suite":"%%\r\nxy = [0 1 1+1i 0-1i];\r\nz=round(polatia(xy)*1000)/1000;\r\nz_correct = 4;\r\nassert(isequal(z,z_correct))\r\n%%\r\nxy = [3+4i 1 1+1i 0-1i];\r\nz=round(polatia(xy)*1000)/1000;\r\nz_correct = 29;\r\nassert(isequal(z,z_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":6,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":67,"test_suite_updated_at":"2012-02-16T20:33:20.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-02-15T16:47:02.000Z","updated_at":"2026-03-04T15:35:03.000Z","published_at":"2012-02-16T20:41:14.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\u003egiven locations of a set of unit masses on complex plane, find polar moment of inerta about the origin. for example output 4 if input [0 1 1+1i 0-1i]\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":48675,"title":"Laws of motion 1","description":null,"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: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.5px; transform-origin: 407px 10.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"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: 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eGiven initial velocity 'u', acceleration 'a' , find the final velocity of an object after time 't'.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function v = your_fcn_name(u,a,t)\r\n  v = x;\r\nend","test_suite":"%%\r\nu=1;\r\na=1;\r\nt=1;\r\n\r\ny_correct = 2;\r\nassert(isequal(your_fcn_name(u,a,t),y_correct))\r\n\r\n\r\n%%\r\n\r\nu=2;\r\na=2;\r\nt=2;\r\n\r\ny_correct = 6;\r\nassert(isequal(your_fcn_name(u,a,t),y_correct))\r\n\r\n%%%%%%\r\nu=0;\r\na=1;\r\nt=2;\r\n\r\ny_correct = 2;\r\nassert(isequal(your_fcn_name(u,a,t),y_correct))\r\n\r\n\r\n%%%\r\n\r\nu=0;\r\na=10;\r\nt=6;\r\n\r\ny_correct = 60;\r\nassert(isequal(your_fcn_name(u,a,t),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":14,"comments_count":2,"created_by":644918,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":2753,"test_suite_updated_at":"2020-12-21T16:34:02.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-21T16:28:05.000Z","updated_at":"2026-04-04T04:01:00.000Z","published_at":"2020-12-21T16:29:26.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\u003eGiven initial velocity 'u', acceleration 'a' , find the final velocity of an object after time 't'.\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":48680,"title":"Laws of motion 2","description":null,"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: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.5px; transform-origin: 407px 10.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"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: 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eWith the initial speed 'u', acceleration 'a', find the distance travelled by an object in 't' secods.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function s = your_fcn_name(u,a,t)\r\n  y = x;\r\nend","test_suite":"%%\r\nu=1;\r\na=1;\r\nt=2\r\ny_correct = 4;\r\nassert(isequal(your_fcn_name(u,a,t),y_correct))\r\n%%\r\nu=0;\r\na=2;\r\nt=2\r\ny_correct = 4;\r\nassert(isequal(your_fcn_name(u,a,t),y_correct))\r\n%%\r\nu=54;\r\na=1;\r\nt=20\r\ny_correct = 1280;\r\nassert(isequal(your_fcn_name(u,a,t),y_correct))\r\n%%\r\nu=1;\r\na=2;\r\nt=1\r\ny_correct = 2;\r\nassert(isequal(your_fcn_name(u,a,t),y_correct))","published":true,"deleted":false,"likes_count":12,"comments_count":1,"created_by":644918,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":2534,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-21T16:47:29.000Z","updated_at":"2026-04-04T04:00:35.000Z","published_at":"2020-12-21T16:47:29.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\u003eWith the initial speed 'u', acceleration 'a', find the distance travelled by an object in 't' secods.\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":44936,"title":"Float like a cannonball","description":"Given gravity on earth (g=9.81 [m/s/s]) find the distance s [m] by a cannonball propelled at a speed of u [m/s] from the origin at an angle theta [deg] measured from the horizontal. Assume no air resistance or bouncing. The altitude of the release of the cannon ball is 0 m and the travel should have the appropriate sign (i.e. behind the release point would be negative).\r\nHint: Consider logical reasoning when the orientation of the firing vector would be into the ground!!","description_html":"\u003cp\u003eGiven gravity on earth (g=9.81 [m/s/s]) find the distance s [m] by a cannonball propelled at a speed of u [m/s] from the origin at an angle theta [deg] measured from the horizontal. Assume no air resistance or bouncing. The altitude of the release of the cannon ball is 0 m and the travel should have the appropriate sign (i.e. behind the release point would be negative).\r\nHint: Consider logical reasoning when the orientation of the firing vector would be into the ground!!\u003c/p\u003e","function_template":"function s = CannonBall(u,theta)\r\n%Stones taught me to fly...\r\n  s = u*theta;\r\nend","test_suite":"%%\r\nu= 100;\r\ntheta=85;\r\ny_correct = 177;\r\nassert(isequal(round(CannonBall(u,theta)),y_correct))\r\n\r\n%%\r\nu= 31.42;\r\ntheta=45;\r\ny_correct = 101;\r\nassert(isequal(round(CannonBall(u,theta)),y_correct))\r\n\r\n%%\r\nu= 31.42;\r\ntheta=-41;\r\ny_correct = 0;\r\nassert(isequal(round(CannonBall(u,theta)),y_correct))\r\n\r\n%%\r\nu= 100;\r\ntheta=30;\r\ny_correct = 883;\r\nassert(isequal(round(CannonBall(u,theta)),y_correct))\r\n\r\n%%\r\nu= -100;\r\ntheta=30;\r\ny_correct = 0;\r\nassert(isequal(round(CannonBall(u,theta)),y_correct))\r\n\r\n\r\n%%\r\nu= -100;\r\ntheta=210;\r\ny_correct = 883;\r\nassert(isequal(round(CannonBall(u,theta)),y_correct))\r\n\r\n\r\n%%\r\nu= 100;\r\ntheta=210;\r\ny_correct = 0;\r\nassert(isequal(round(CannonBall(u,theta)),y_correct))\r\n\r\n%%\r\nu= 0;\r\ntheta=40;\r\ny_correct = 0;\r\nassert(isequal(round(CannonBall(u,theta)),y_correct))\r\n\r\n%%\r\nu= 100;\r\ntheta=90;\r\ny_correct = 0;\r\nassert(isequal(round(CannonBall(u,theta)),y_correct))\r\n\r\n%%\r\nu= 100;\r\ntheta=0;\r\ny_correct = 0;\r\nassert(isequal(round(CannonBall(u,theta)),y_correct))\r\n\r\n%%\r\nfiletext = fileread('CannonBall.m');\r\nassert(isempty(strfind(filetext, 'regexp'))); assert(isempty(strfind(filetext, 'eval'))) \r\n\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":170350,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":26,"test_suite_updated_at":"2019-08-02T09:56:25.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2019-08-02T09:45:02.000Z","updated_at":"2026-01-02T13:04:50.000Z","published_at":"2019-08-02T09:45:02.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\u003eGiven gravity on earth (g=9.81 [m/s/s]) find the distance s [m] by a cannonball propelled at a speed of u [m/s] from the origin at an angle theta [deg] measured from the horizontal. Assume no air resistance or bouncing. The altitude of the release of the cannon ball is 0 m and the travel should have the appropriate sign (i.e. behind the release point would be negative). Hint: Consider logical reasoning when the orientation of the firing vector would be into the ground!!\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":433,"title":"jogging?","description":"Imagine x-y coordinate system and you are at the origin and your partner is on the x-axis at some small distance (d) away from you.  You and your partner started jogging simultaneously, left foot first. You and your partner maintained identical rate of steps per second (r) and length of every step (s). Your track and your partner's track are parallel but at angle alpha to x-axis. Please note that alpha is less than 90 degrees. At the initial moment of starting your partner appeared to be ahead of you due to the angle alpha not being 90 degrees. After you finished jogging a long distance, a photograph of your foot prints at a random location looked as if your partner was neither behind nor ahead of you. Please calculate the largest alpha (degrees) possible under these constraints.","description_html":"\u003cp\u003eImagine x-y coordinate system and you are at the origin and your partner is on the x-axis at some small distance (d) away from you.  You and your partner started jogging simultaneously, left foot first. You and your partner maintained identical rate of steps per second (r) and length of every step (s). Your track and your partner's track are parallel but at angle alpha to x-axis. Please note that alpha is less than 90 degrees. At the initial moment of starting your partner appeared to be ahead of you due to the angle alpha not being 90 degrees. After you finished jogging a long distance, a photograph of your foot prints at a random location looked as if your partner was neither behind nor ahead of you. Please calculate the largest alpha (degrees) possible under these constraints.\u003c/p\u003e","function_template":"function degrees = jogging(d,r,s)\r\ndegrees=0;\r\nend","test_suite":"%%\r\nd = 4; r = 1; s = 1; degrees_correct = 60;\r\ndegrees = round(jogging(d,r,s));\r\nassert(degrees==degrees_correct)\r\n%%\r\nd = 5; r = 1; s = 1; degrees_correct = 66;\r\ndegrees = round(jogging(d,r,s));\r\nassert(degrees==degrees_correct)\r\n%%\r\nd = 6; r = 1; s = 1; degrees_correct = 71;\r\ndegrees = round(jogging(d,r,s));\r\nassert(degrees==degrees_correct)\r\n%%\r\nd = 7; r = 1; s = 1; degrees_correct = 73;\r\ndegrees = round(jogging(d,r,s));\r\nassert(degrees==degrees_correct)\r\n%%\r\nd = 8; r = 1; s = 1; degrees_correct = 76;\r\ndegrees = round(jogging(d,r,s));\r\nassert(degrees==degrees_correct)\r\n%%\r\nd = 7; r = 1; s = 2; degrees_correct = 55;\r\ndegrees = round(jogging(d,r,s));\r\nassert(degrees==degrees_correct)\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":3,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":40,"test_suite_updated_at":"2012-03-02T10:41:06.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-03-01T21:44:31.000Z","updated_at":"2026-01-31T12:59:31.000Z","published_at":"2012-03-02T16:52:52.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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\u003eImagine x-y coordinate system and you are at the origin and your partner is on the x-axis at some small distance (d) away from you. You and your partner started jogging simultaneously, left foot first. You and your partner maintained identical rate of steps per second (r) and length of every step (s). Your track and your partner's track are parallel but at angle alpha to x-axis. Please note that alpha is less than 90 degrees. At the initial moment of starting your partner appeared to be ahead of you due to the angle alpha not being 90 degrees. After you finished jogging a long distance, a photograph of your foot prints at a random location looked as if your partner was neither behind nor ahead of you. Please calculate the largest alpha (degrees) possible under these constraints.\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":44365,"title":"An asteroid and a spacecraft","description":"\r\n\u0026#128640 Imagine a non-relativistic simple situation. \r\n\r\nAssume positions p0, p1, p2, and p3 are three dimensional Cartesian coordinates.\r\n\r\nYour spacecraft started from the position p0 at time t0. \r\n\r\nYour spacecraft is moving with a constant velocity.\r\n\r\nYour spacecraft is expected to reach a star at the location p1 at time t1.\r\n\r\nYou just heard over the radio that an asteroid has been identified at the location p2 at time t0.\r\n\r\nThe asteroid is moving with a constant velocity.\r\n\r\nThe asteroid is expected to reach another star at the location p3 at time t1. \r\n\r\nYou need to write a code 'safetrip' in MATLAB to return true if the minimum distance between your spacecraft and the asteroid will be more than the distance d during the time interval between t0 and t1, otherwise return false.","description_html":"\u003cp\u003e\u0026#128640 Imagine a non-relativistic simple situation.\u003c/p\u003e\u003cp\u003eAssume positions p0, p1, p2, and p3 are three dimensional Cartesian coordinates.\u003c/p\u003e\u003cp\u003eYour spacecraft started from the position p0 at time t0.\u003c/p\u003e\u003cp\u003eYour spacecraft is moving with a constant velocity.\u003c/p\u003e\u003cp\u003eYour spacecraft is expected to reach a star at the location p1 at time t1.\u003c/p\u003e\u003cp\u003eYou just heard over the radio that an asteroid has been identified at the location p2 at time t0.\u003c/p\u003e\u003cp\u003eThe asteroid is moving with a constant velocity.\u003c/p\u003e\u003cp\u003eThe asteroid is expected to reach another star at the location p3 at time t1.\u003c/p\u003e\u003cp\u003eYou need to write a code 'safetrip' in MATLAB to return true if the minimum distance between your spacecraft and the asteroid will be more than the distance d during the time interval between t0 and t1, otherwise return false.\u003c/p\u003e","function_template":"function ok = safetrip(d, t0, t1, p0, p1, p2, p3)\r\n    if d\u003e1000000000\r\n        ok = true;\r\n    end\r\nend","test_suite":"%%\r\np0 = [0 0 0];\r\np1 = [1 1 1];\r\np2 = [2 2 2];\r\np3 = [3 3 3];\r\nt0 = 0; \r\nt1 = 1;\r\nd = 1;\r\nok = true;\r\nassert(isequal(safetrip(d, t0, t1, p0, p1, p2, p3), ok))\r\n\r\n%%\r\np0 = [3 3 3];\r\np1 = [2 2 2];\r\np2 = [2 2 2];\r\np3 = [3 3 3];\r\nt0 = 0; \r\nt1 = 1;\r\nd = 1;\r\nok = false;\r\nassert(isequal(safetrip(d, t0, t1, p0, p1, p2, p3), ok))\r\n\r\n%%\r\np0 = [1 2 3];\r\np1 = [4 5 6];\r\np2 = [3 2 1];\r\np3 = [6 5 4];\r\nt0 = 10; \r\nt1 = 20;\r\nd = 2;\r\nok = true;\r\nassert(isequal(safetrip(d, t0, t1, p0, p1, p2, p3), ok))\r\n\r\n","published":true,"deleted":false,"likes_count":6,"comments_count":8,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":168,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":35,"created_at":"2017-10-10T02:30:44.000Z","updated_at":"2026-03-26T15:11:20.000Z","published_at":"2017-10-16T01:51:00.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\u003e\u0026amp;#128640 Imagine a non-relativistic simple situation.\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\u003eAssume positions p0, p1, p2, and p3 are three dimensional Cartesian coordinates.\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\u003eYour spacecraft started from the position p0 at time t0.\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\u003eYour spacecraft is moving with a constant velocity.\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\u003eYour spacecraft is expected to reach a star at the location p1 at time t1.\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\u003eYou just heard over the radio that an asteroid has been identified at the location p2 at time t0.\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\u003eThe asteroid is moving with a constant velocity.\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\u003eThe asteroid is expected to reach another star at the location p3 at time t1.\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\u003eYou need to write a code 'safetrip' in MATLAB to return true if the minimum distance between your spacecraft and the asteroid will be more than the distance d during the time interval between t0 and t1, otherwise return false.\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":274,"title":"Bouncing disk","description":"A disk is placed in a rectangular room with dimensions a and b in a point with coordinates x0 and y0. The disk is given a startup speed V, m/s, the angle between the speed and the x axis is phi, rad. All coordinates have metric dimensions. (See the figure below, just right-click on it and choose open in new tab). The friction factor is nu (always greater then zero). The energy loss caused by bumping the walls is negligible.\r\n\r\n\u003c\u003chttps://lh6.googleusercontent.com/nk2V7gipW9Dbsd5a1FFLvK7I-4rF2TnySfiLvEpmdZePEKn4x6BeUt5andxV_dH9zGAjfbrxbS7M4u9I0E8sVNCH6_N_wpputwU=w1600\u003e\u003e\r\n\r\nFind the resulting position of the disk.\r\nThe answer should be given with the tolerance greater than 10^-3.","description_html":"\u003cp\u003eA disk is placed in a rectangular room with dimensions a and b in a point with coordinates x0 and y0. The disk is given a startup speed V, m/s, the angle between the speed and the x axis is phi, rad. All coordinates have metric dimensions. (See the figure below, just right-click on it and choose open in new tab). The friction factor is nu (always greater then zero). The energy loss caused by bumping the walls is negligible.\u003c/p\u003e\u003cimg src=\"https://lh6.googleusercontent.com/nk2V7gipW9Dbsd5a1FFLvK7I-4rF2TnySfiLvEpmdZePEKn4x6BeUt5andxV_dH9zGAjfbrxbS7M4u9I0E8sVNCH6_N_wpputwU=w1600\"\u003e\u003cp\u003eFind the resulting position of the disk.\r\nThe answer should be given with the tolerance greater than 10^-3.\u003c/p\u003e","function_template":"function [x,y] = room_bounce(x0, y0, V, phi, a, b, nu)\r\n  \r\nend","test_suite":"%%\r\n\r\n[x,y]=room_bounce(0,0,1,0,1,1,0.1);\r\nassert(isequal(round(x*1000)/1000,0.51))\r\nassert(isequal(round(y*1000)/1000,0))\r\n\r\n%%\r\n\r\n[x,y]=room_bounce(0,0,1,0,0.5,1,0.1);\r\nassert(isequal(round(x*1000)/1000,0.49))\r\nassert(isequal(round(y*1000)/1000,0))\r\n\r\n%%\r\n\r\n[x,y]=room_bounce(0.1,0,1,pi/4,0.1,1,0.1);\r\nassert(isequal(round(x*1000)/1000,0.061))\r\nassert(isequal(round(y*1000)/1000,0.361))\r\n\r\n%%\r\n\r\n[x,y]=room_bounce(0.1,0,10,pi/10,0.3,0.6,0.1);\r\nassert(isequal(round(x*1000)/1000,0.01))\r\nassert(isequal(round(y*1000)/1000,0.155))\r\n\r\n%%\r\n\r\n[x,y]=room_bounce(1,1,10,-pi/7,2,5,0.01);\r\nassert(isequal(round(x*1000)/1000,0.366))\r\nassert(isequal(round(y*1000)/1000,0.219))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":15,"created_by":530,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":25,"test_suite_updated_at":"2012-02-07T22:03:31.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-02-06T23:14:44.000Z","updated_at":"2026-03-11T15:09:49.000Z","published_at":"2012-02-07T22:11:40.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\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/media/image1.png\"}],\"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\u003eA disk is placed in a rectangular room with dimensions a and b in a point with coordinates x0 and y0. The disk is given a startup speed V, m/s, the angle between the speed and the x axis is phi, rad. All coordinates have metric dimensions. (See the figure below, just right-click on it and choose open in new tab). The friction factor is nu (always greater then zero). The energy loss caused by bumping the walls is negligible.\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:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\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\u003eFind the resulting position of the disk. The answer should be given with the tolerance greater than 10^-3.\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\"},{\"partUri\":\"/media/image1.png\",\"contentType\":\"image/png\",\"content\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAADAFBMVEV4eHiTk5P29vaBgYGcnJzAwMC3t7eKiorS0tLt7e3b29vk5OTJycn///9vb28AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD61b95AAAAyklEQVR42q2SSQ6FIAxAWzQxkcj976lEE5R+hojQOmw+Cxa8RwcoGnhf6oNDD0AvGL8j/E2wC+JiXwSaAKbbatGkLjBrX13szynmtPXnKc2eCRiMGQtXxrq2hmZRuuXx6SVdPlPpopeC387sFMMIwdsyAMFAEcHuptW5oIaKYgjHBBoZ512snMeJ8g7o0DmA5jwKXRdqy9W6gfMzhd7iMOySlxq0qn/z4leR43HNQ8WrLtYi1Dz+pnjsmt/8ZsulwLgQOOeC4EyQHH5z1GUZiLNTtwAAAABJRU5ErkJggg==\"}]}"},{"id":323,"title":"Mechanics 1","description":"I thought I would make a mechanics problem for all those physics lovers out there. \r\n\r\nImagine two solid, rigid spheres B1 and B2 with radius R1 and R2 and mass M1 and M2.  B1 initially has its center of mass at the origin and is confined to always move along the x axis.  B2 has its center of mass located at coordinates (x2,y2) where 0\u003cx2\u003c(R1+R2) and sqrt((R1+R2)^2-x2^2)\u003cy2.  Gravity acts in the negative y direction with constant g = 9.8 in some consistent unit system.\r\n\r\nWrite a function that returns the velocity of both spheres after B2 is allowed to fall, assuming a lossless collision occurs.  Keep in mind that the answers should be two-element row vectors.  For example, if R1=1, R2=.25, M1=2, M2=4, x2=.5 and y2=6, then:\r\n\r\n  [V1,V2] = balldrop_puzz(M1,M2,R1,R2,x2,y2)\r\n\r\n  V1 = [-10.8362631979321 0]\r\n  V2 = [5.41813159896603 2.66024980473149]","description_html":"\u003cp\u003eI thought I would make a mechanics problem for all those physics lovers out there.\u003c/p\u003e\u003cp\u003eImagine two solid, rigid spheres B1 and B2 with radius R1 and R2 and mass M1 and M2.  B1 initially has its center of mass at the origin and is confined to always move along the x axis.  B2 has its center of mass located at coordinates (x2,y2) where 0\u0026lt;x2\u0026lt;(R1+R2) and sqrt((R1+R2)^2-x2^2)\u0026lt;y2.  Gravity acts in the negative y direction with constant g = 9.8 in some consistent unit system.\u003c/p\u003e\u003cp\u003eWrite a function that returns the velocity of both spheres after B2 is allowed to fall, assuming a lossless collision occurs.  Keep in mind that the answers should be two-element row vectors.  For example, if R1=1, R2=.25, M1=2, M2=4, x2=.5 and y2=6, then:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e[V1,V2] = balldrop_puzz(M1,M2,R1,R2,x2,y2)\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003eV1 = [-10.8362631979321 0]\r\nV2 = [5.41813159896603 2.66024980473149]\r\n\u003c/pre\u003e","function_template":"function [V1,V2] = balldrop_puzz(M1,M2,R1,R2,x2,y2)\r\n  V1 = [pi 0];\r\n  V2 = [pi,pi];\r\nend","test_suite":"%%\r\n[V1,V2] = balldrop_puzz(1.5,2.5,2,2,3.75,7);\r\nassert(all(abs(V1-[-4.62546938906081,0])\u003c1000*eps))\r\nassert(all(abs(V2-[2.77528163343649,-9.45403544713895])\u003c1000*eps))\r\n%%\r\n[V1,V2] = balldrop_puzz(1.5,1.75,2,3.3,2.75,5)\r\nassert(all(abs(V1-[-2.38857735374413,0])\u003c1000*eps))\r\nassert(all(abs(V2-[2.04735201749497 0.340314640435397])\u003c1000*eps))\r\n%%\r\n[V1,V2] = balldrop_puzz(1.5,1.5,2,2,2.75,3)\r\nassert(all(abs(V1-[-0.926482490085206,0])\u003c1000*eps))\r\nassert(all(abs(V2-[0.926482490085206,-0.387821095199846])\u003c1000*eps))\r\n%%\r\n[V1,V2] = balldrop_puzz(3,1,4,2,2.75,7)\r\nassert(all(abs(V1-[-1.45087063290465,0])\u003c1000*eps))\r\nassert(all(abs(V2-[4.35261189871394,2.7238062965565])\u003c1000*eps))\r\n%%\r\n[V1,V2] = balldrop_puzz(1,7,2,1,1,4)\r\nassert(all(abs(V1-[-11.8594824370299,0])\u003c1000*eps))\r\nassert(all(abs(V2-[1.69421177671855,0])\u003c1000*eps))","published":true,"deleted":false,"likes_count":3,"comments_count":6,"created_by":459,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":38,"test_suite_updated_at":"2012-02-16T19:48:02.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-02-15T22:12:53.000Z","updated_at":"2026-02-19T10:01:09.000Z","published_at":"2012-02-16T19:50:07.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\u003eI thought I would make a mechanics problem for all those physics lovers out there.\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\u003eImagine two solid, rigid spheres B1 and B2 with radius R1 and R2 and mass M1 and M2. B1 initially has its center of mass at the origin and is confined to always move along the x axis. B2 has its center of mass located at coordinates (x2,y2) where 0\u0026lt;x2\u0026lt;(R1+R2) and sqrt((R1+R2)^2-x2^2)\u0026lt;y2. Gravity acts in the negative y direction with constant g = 9.8 in some consistent unit system.\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\u003eWrite a function that returns the velocity of both spheres after B2 is allowed to fall, assuming a lossless collision occurs. Keep in mind that the answers should be two-element row vectors. For example, if R1=1, R2=.25, M1=2, M2=4, x2=.5 and y2=6, then:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[[V1,V2] = balldrop_puzz(M1,M2,R1,R2,x2,y2)\\n\\nV1 = [-10.8362631979321 0]\\nV2 = [5.41813159896603 2.66024980473149]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":321,"title":"polar inertia","description":"given locations of a set of unit masses on complex plane, find polar moment of inerta about the origin. for example output 4 if input [0 1 1+1i 0-1i] ","description_html":"\u003cp\u003egiven locations of a set of unit masses on complex plane, find polar moment of inerta about the origin. for example output 4 if input [0 1 1+1i 0-1i]\u003c/p\u003e","function_template":"function z = polatia(xy)\r\n  z = sum(abs(xy));\r\nend","test_suite":"%%\r\nxy = [0 1 1+1i 0-1i];\r\nz=round(polatia(xy)*1000)/1000;\r\nz_correct = 4;\r\nassert(isequal(z,z_correct))\r\n%%\r\nxy = [3+4i 1 1+1i 0-1i];\r\nz=round(polatia(xy)*1000)/1000;\r\nz_correct = 29;\r\nassert(isequal(z,z_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":6,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":67,"test_suite_updated_at":"2012-02-16T20:33:20.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-02-15T16:47:02.000Z","updated_at":"2026-03-04T15:35:03.000Z","published_at":"2012-02-16T20:41:14.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\u003egiven locations of a set of unit masses on complex plane, find polar moment of inerta about the origin. for example output 4 if input [0 1 1+1i 0-1i]\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":48675,"title":"Laws of motion 1","description":null,"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: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.5px; transform-origin: 407px 10.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"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: 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eGiven initial velocity 'u', acceleration 'a' , find the final velocity of an object after time 't'.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function v = your_fcn_name(u,a,t)\r\n  v = x;\r\nend","test_suite":"%%\r\nu=1;\r\na=1;\r\nt=1;\r\n\r\ny_correct = 2;\r\nassert(isequal(your_fcn_name(u,a,t),y_correct))\r\n\r\n\r\n%%\r\n\r\nu=2;\r\na=2;\r\nt=2;\r\n\r\ny_correct = 6;\r\nassert(isequal(your_fcn_name(u,a,t),y_correct))\r\n\r\n%%%%%%\r\nu=0;\r\na=1;\r\nt=2;\r\n\r\ny_correct = 2;\r\nassert(isequal(your_fcn_name(u,a,t),y_correct))\r\n\r\n\r\n%%%\r\n\r\nu=0;\r\na=10;\r\nt=6;\r\n\r\ny_correct = 60;\r\nassert(isequal(your_fcn_name(u,a,t),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":14,"comments_count":2,"created_by":644918,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":2753,"test_suite_updated_at":"2020-12-21T16:34:02.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-21T16:28:05.000Z","updated_at":"2026-04-04T04:01:00.000Z","published_at":"2020-12-21T16:29:26.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\u003eGiven initial velocity 'u', acceleration 'a' , find the final velocity of an object after time 't'.\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":48680,"title":"Laws of motion 2","description":null,"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: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.5px; transform-origin: 407px 10.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"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: 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eWith the initial speed 'u', acceleration 'a', find the distance travelled by an object in 't' secods.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function s = your_fcn_name(u,a,t)\r\n  y = x;\r\nend","test_suite":"%%\r\nu=1;\r\na=1;\r\nt=2\r\ny_correct = 4;\r\nassert(isequal(your_fcn_name(u,a,t),y_correct))\r\n%%\r\nu=0;\r\na=2;\r\nt=2\r\ny_correct = 4;\r\nassert(isequal(your_fcn_name(u,a,t),y_correct))\r\n%%\r\nu=54;\r\na=1;\r\nt=20\r\ny_correct = 1280;\r\nassert(isequal(your_fcn_name(u,a,t),y_correct))\r\n%%\r\nu=1;\r\na=2;\r\nt=1\r\ny_correct = 2;\r\nassert(isequal(your_fcn_name(u,a,t),y_correct))","published":true,"deleted":false,"likes_count":12,"comments_count":1,"created_by":644918,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":2534,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-21T16:47:29.000Z","updated_at":"2026-04-04T04:00:35.000Z","published_at":"2020-12-21T16:47:29.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\u003eWith the initial speed 'u', acceleration 'a', find the distance travelled by an object in 't' secods.\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":44936,"title":"Float like a cannonball","description":"Given gravity on earth (g=9.81 [m/s/s]) find the distance s [m] by a cannonball propelled at a speed of u [m/s] from the origin at an angle theta [deg] measured from the horizontal. Assume no air resistance or bouncing. The altitude of the release of the cannon ball is 0 m and the travel should have the appropriate sign (i.e. behind the release point would be negative).\r\nHint: Consider logical reasoning when the orientation of the firing vector would be into the ground!!","description_html":"\u003cp\u003eGiven gravity on earth (g=9.81 [m/s/s]) find the distance s [m] by a cannonball propelled at a speed of u [m/s] from the origin at an angle theta [deg] measured from the horizontal. Assume no air resistance or bouncing. The altitude of the release of the cannon ball is 0 m and the travel should have the appropriate sign (i.e. behind the release point would be negative).\r\nHint: Consider logical reasoning when the orientation of the firing vector would be into the ground!!\u003c/p\u003e","function_template":"function s = CannonBall(u,theta)\r\n%Stones taught me to fly...\r\n  s = u*theta;\r\nend","test_suite":"%%\r\nu= 100;\r\ntheta=85;\r\ny_correct = 177;\r\nassert(isequal(round(CannonBall(u,theta)),y_correct))\r\n\r\n%%\r\nu= 31.42;\r\ntheta=45;\r\ny_correct = 101;\r\nassert(isequal(round(CannonBall(u,theta)),y_correct))\r\n\r\n%%\r\nu= 31.42;\r\ntheta=-41;\r\ny_correct = 0;\r\nassert(isequal(round(CannonBall(u,theta)),y_correct))\r\n\r\n%%\r\nu= 100;\r\ntheta=30;\r\ny_correct = 883;\r\nassert(isequal(round(CannonBall(u,theta)),y_correct))\r\n\r\n%%\r\nu= -100;\r\ntheta=30;\r\ny_correct = 0;\r\nassert(isequal(round(CannonBall(u,theta)),y_correct))\r\n\r\n\r\n%%\r\nu= -100;\r\ntheta=210;\r\ny_correct = 883;\r\nassert(isequal(round(CannonBall(u,theta)),y_correct))\r\n\r\n\r\n%%\r\nu= 100;\r\ntheta=210;\r\ny_correct = 0;\r\nassert(isequal(round(CannonBall(u,theta)),y_correct))\r\n\r\n%%\r\nu= 0;\r\ntheta=40;\r\ny_correct = 0;\r\nassert(isequal(round(CannonBall(u,theta)),y_correct))\r\n\r\n%%\r\nu= 100;\r\ntheta=90;\r\ny_correct = 0;\r\nassert(isequal(round(CannonBall(u,theta)),y_correct))\r\n\r\n%%\r\nu= 100;\r\ntheta=0;\r\ny_correct = 0;\r\nassert(isequal(round(CannonBall(u,theta)),y_correct))\r\n\r\n%%\r\nfiletext = fileread('CannonBall.m');\r\nassert(isempty(strfind(filetext, 'regexp'))); assert(isempty(strfind(filetext, 'eval'))) \r\n\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":170350,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":26,"test_suite_updated_at":"2019-08-02T09:56:25.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2019-08-02T09:45:02.000Z","updated_at":"2026-01-02T13:04:50.000Z","published_at":"2019-08-02T09:45:02.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\u003eGiven gravity on earth (g=9.81 [m/s/s]) find the distance s [m] by a cannonball propelled at a speed of u [m/s] from the origin at an angle theta [deg] measured from the horizontal. Assume no air resistance or bouncing. The altitude of the release of the cannon ball is 0 m and the travel should have the appropriate sign (i.e. behind the release point would be negative). Hint: Consider logical reasoning when the orientation of the firing vector would be into the ground!!\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":433,"title":"jogging?","description":"Imagine x-y coordinate system and you are at the origin and your partner is on the x-axis at some small distance (d) away from you.  You and your partner started jogging simultaneously, left foot first. You and your partner maintained identical rate of steps per second (r) and length of every step (s). Your track and your partner's track are parallel but at angle alpha to x-axis. Please note that alpha is less than 90 degrees. At the initial moment of starting your partner appeared to be ahead of you due to the angle alpha not being 90 degrees. After you finished jogging a long distance, a photograph of your foot prints at a random location looked as if your partner was neither behind nor ahead of you. Please calculate the largest alpha (degrees) possible under these constraints.","description_html":"\u003cp\u003eImagine x-y coordinate system and you are at the origin and your partner is on the x-axis at some small distance (d) away from you.  You and your partner started jogging simultaneously, left foot first. You and your partner maintained identical rate of steps per second (r) and length of every step (s). Your track and your partner's track are parallel but at angle alpha to x-axis. Please note that alpha is less than 90 degrees. At the initial moment of starting your partner appeared to be ahead of you due to the angle alpha not being 90 degrees. After you finished jogging a long distance, a photograph of your foot prints at a random location looked as if your partner was neither behind nor ahead of you. Please calculate the largest alpha (degrees) possible under these constraints.\u003c/p\u003e","function_template":"function degrees = jogging(d,r,s)\r\ndegrees=0;\r\nend","test_suite":"%%\r\nd = 4; r = 1; s = 1; degrees_correct = 60;\r\ndegrees = round(jogging(d,r,s));\r\nassert(degrees==degrees_correct)\r\n%%\r\nd = 5; r = 1; s = 1; degrees_correct = 66;\r\ndegrees = round(jogging(d,r,s));\r\nassert(degrees==degrees_correct)\r\n%%\r\nd = 6; r = 1; s = 1; degrees_correct = 71;\r\ndegrees = round(jogging(d,r,s));\r\nassert(degrees==degrees_correct)\r\n%%\r\nd = 7; r = 1; s = 1; degrees_correct = 73;\r\ndegrees = round(jogging(d,r,s));\r\nassert(degrees==degrees_correct)\r\n%%\r\nd = 8; r = 1; s = 1; degrees_correct = 76;\r\ndegrees = round(jogging(d,r,s));\r\nassert(degrees==degrees_correct)\r\n%%\r\nd = 7; r = 1; s = 2; degrees_correct = 55;\r\ndegrees = round(jogging(d,r,s));\r\nassert(degrees==degrees_correct)\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":3,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":40,"test_suite_updated_at":"2012-03-02T10:41:06.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-03-01T21:44:31.000Z","updated_at":"2026-01-31T12:59:31.000Z","published_at":"2012-03-02T16:52:52.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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\u003eImagine x-y coordinate system and you are at the origin and your partner is on the x-axis at some small distance (d) away from you. You and your partner started jogging simultaneously, left foot first. You and your partner maintained identical rate of steps per second (r) and length of every step (s). Your track and your partner's track are parallel but at angle alpha to x-axis. Please note that alpha is less than 90 degrees. At the initial moment of starting your partner appeared to be ahead of you due to the angle alpha not being 90 degrees. After you finished jogging a long distance, a photograph of your foot prints at a random location looked as if your partner was neither behind nor ahead of you. Please calculate the largest alpha (degrees) possible under these constraints.\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":44365,"title":"An asteroid and a spacecraft","description":"\r\n\u0026#128640 Imagine a non-relativistic simple situation. \r\n\r\nAssume positions p0, p1, p2, and p3 are three dimensional Cartesian coordinates.\r\n\r\nYour spacecraft started from the position p0 at time t0. \r\n\r\nYour spacecraft is moving with a constant velocity.\r\n\r\nYour spacecraft is expected to reach a star at the location p1 at time t1.\r\n\r\nYou just heard over the radio that an asteroid has been identified at the location p2 at time t0.\r\n\r\nThe asteroid is moving with a constant velocity.\r\n\r\nThe asteroid is expected to reach another star at the location p3 at time t1. \r\n\r\nYou need to write a code 'safetrip' in MATLAB to return true if the minimum distance between your spacecraft and the asteroid will be more than the distance d during the time interval between t0 and t1, otherwise return false.","description_html":"\u003cp\u003e\u0026#128640 Imagine a non-relativistic simple situation.\u003c/p\u003e\u003cp\u003eAssume positions p0, p1, p2, and p3 are three dimensional Cartesian coordinates.\u003c/p\u003e\u003cp\u003eYour spacecraft started from the position p0 at time t0.\u003c/p\u003e\u003cp\u003eYour spacecraft is moving with a constant velocity.\u003c/p\u003e\u003cp\u003eYour spacecraft is expected to reach a star at the location p1 at time t1.\u003c/p\u003e\u003cp\u003eYou just heard over the radio that an asteroid has been identified at the location p2 at time t0.\u003c/p\u003e\u003cp\u003eThe asteroid is moving with a constant velocity.\u003c/p\u003e\u003cp\u003eThe asteroid is expected to reach another star at the location p3 at time t1.\u003c/p\u003e\u003cp\u003eYou need to write a code 'safetrip' in MATLAB to return true if the minimum distance between your spacecraft and the asteroid will be more than the distance d during the time interval between t0 and t1, otherwise return false.\u003c/p\u003e","function_template":"function ok = safetrip(d, t0, t1, p0, p1, p2, p3)\r\n    if d\u003e1000000000\r\n        ok = true;\r\n    end\r\nend","test_suite":"%%\r\np0 = [0 0 0];\r\np1 = [1 1 1];\r\np2 = [2 2 2];\r\np3 = [3 3 3];\r\nt0 = 0; \r\nt1 = 1;\r\nd = 1;\r\nok = true;\r\nassert(isequal(safetrip(d, t0, t1, p0, p1, p2, p3), ok))\r\n\r\n%%\r\np0 = [3 3 3];\r\np1 = [2 2 2];\r\np2 = [2 2 2];\r\np3 = [3 3 3];\r\nt0 = 0; \r\nt1 = 1;\r\nd = 1;\r\nok = false;\r\nassert(isequal(safetrip(d, t0, t1, p0, p1, p2, p3), ok))\r\n\r\n%%\r\np0 = [1 2 3];\r\np1 = [4 5 6];\r\np2 = [3 2 1];\r\np3 = [6 5 4];\r\nt0 = 10; \r\nt1 = 20;\r\nd = 2;\r\nok = true;\r\nassert(isequal(safetrip(d, t0, t1, p0, p1, p2, p3), ok))\r\n\r\n","published":true,"deleted":false,"likes_count":6,"comments_count":8,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":168,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":35,"created_at":"2017-10-10T02:30:44.000Z","updated_at":"2026-03-26T15:11:20.000Z","published_at":"2017-10-16T01:51:00.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\u003e\u0026amp;#128640 Imagine a non-relativistic simple situation.\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\u003eAssume positions p0, p1, p2, and p3 are three dimensional Cartesian coordinates.\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\u003eYour spacecraft started from the position p0 at time t0.\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\u003eYour spacecraft is moving with a constant velocity.\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\u003eYour spacecraft is expected to reach a star at the location p1 at time t1.\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\u003eYou just heard over the radio that an asteroid has been identified at the location p2 at time t0.\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\u003eThe asteroid is moving with a constant velocity.\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\u003eThe asteroid is expected to reach another star at the location p3 at time t1.\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\u003eYou need to write a code 'safetrip' in MATLAB to return true if the minimum distance between your spacecraft and the asteroid will be more than the distance d during the time interval between t0 and t1, otherwise return false.\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":274,"title":"Bouncing disk","description":"A disk is placed in a rectangular room with dimensions a and b in a point with coordinates x0 and y0. The disk is given a startup speed V, m/s, the angle between the speed and the x axis is phi, rad. All coordinates have metric dimensions. (See the figure below, just right-click on it and choose open in new tab). The friction factor is nu (always greater then zero). The energy loss caused by bumping the walls is negligible.\r\n\r\n\u003c\u003chttps://lh6.googleusercontent.com/nk2V7gipW9Dbsd5a1FFLvK7I-4rF2TnySfiLvEpmdZePEKn4x6BeUt5andxV_dH9zGAjfbrxbS7M4u9I0E8sVNCH6_N_wpputwU=w1600\u003e\u003e\r\n\r\nFind the resulting position of the disk.\r\nThe answer should be given with the tolerance greater than 10^-3.","description_html":"\u003cp\u003eA disk is placed in a rectangular room with dimensions a and b in a point with coordinates x0 and y0. The disk is given a startup speed V, m/s, the angle between the speed and the x axis is phi, rad. All coordinates have metric dimensions. (See the figure below, just right-click on it and choose open in new tab). The friction factor is nu (always greater then zero). The energy loss caused by bumping the walls is negligible.\u003c/p\u003e\u003cimg src=\"https://lh6.googleusercontent.com/nk2V7gipW9Dbsd5a1FFLvK7I-4rF2TnySfiLvEpmdZePEKn4x6BeUt5andxV_dH9zGAjfbrxbS7M4u9I0E8sVNCH6_N_wpputwU=w1600\"\u003e\u003cp\u003eFind the resulting position of the disk.\r\nThe answer should be given with the tolerance greater than 10^-3.\u003c/p\u003e","function_template":"function [x,y] = room_bounce(x0, y0, V, phi, a, b, nu)\r\n  \r\nend","test_suite":"%%\r\n\r\n[x,y]=room_bounce(0,0,1,0,1,1,0.1);\r\nassert(isequal(round(x*1000)/1000,0.51))\r\nassert(isequal(round(y*1000)/1000,0))\r\n\r\n%%\r\n\r\n[x,y]=room_bounce(0,0,1,0,0.5,1,0.1);\r\nassert(isequal(round(x*1000)/1000,0.49))\r\nassert(isequal(round(y*1000)/1000,0))\r\n\r\n%%\r\n\r\n[x,y]=room_bounce(0.1,0,1,pi/4,0.1,1,0.1);\r\nassert(isequal(round(x*1000)/1000,0.061))\r\nassert(isequal(round(y*1000)/1000,0.361))\r\n\r\n%%\r\n\r\n[x,y]=room_bounce(0.1,0,10,pi/10,0.3,0.6,0.1);\r\nassert(isequal(round(x*1000)/1000,0.01))\r\nassert(isequal(round(y*1000)/1000,0.155))\r\n\r\n%%\r\n\r\n[x,y]=room_bounce(1,1,10,-pi/7,2,5,0.01);\r\nassert(isequal(round(x*1000)/1000,0.366))\r\nassert(isequal(round(y*1000)/1000,0.219))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":15,"created_by":530,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":25,"test_suite_updated_at":"2012-02-07T22:03:31.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-02-06T23:14:44.000Z","updated_at":"2026-03-11T15:09:49.000Z","published_at":"2012-02-07T22:11:40.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\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/media/image1.png\"}],\"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\u003eA disk is placed in a rectangular room with dimensions a and b in a point with coordinates x0 and y0. The disk is given a startup speed V, m/s, the angle between the speed and the x axis is phi, rad. All coordinates have metric dimensions. (See the figure below, just right-click on it and choose open in new tab). The friction factor is nu (always greater then zero). The energy loss caused by bumping the walls is negligible.\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:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\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\u003eFind the resulting position of the disk. The answer should be given with the tolerance greater than 10^-3.\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\"},{\"partUri\":\"/media/image1.png\",\"contentType\":\"image/png\",\"content\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAADAFBMVEV4eHiTk5P29vaBgYGcnJzAwMC3t7eKiorS0tLt7e3b29vk5OTJycn///9vb28AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD61b95AAAAyklEQVR42q2SSQ6FIAxAWzQxkcj976lEE5R+hojQOmw+Cxa8RwcoGnhf6oNDD0AvGL8j/E2wC+JiXwSaAKbbatGkLjBrX13szynmtPXnKc2eCRiMGQtXxrq2hmZRuuXx6SVdPlPpopeC387sFMMIwdsyAMFAEcHuptW5oIaKYgjHBBoZ512snMeJ8g7o0DmA5jwKXRdqy9W6gfMzhd7iMOySlxq0qn/z4leR43HNQ8WrLtYi1Dz+pnjsmt/8ZsulwLgQOOeC4EyQHH5z1GUZiLNTtwAAAABJRU5ErkJggg==\"}]}"},{"id":323,"title":"Mechanics 1","description":"I thought I would make a mechanics problem for all those physics lovers out there. \r\n\r\nImagine two solid, rigid spheres B1 and B2 with radius R1 and R2 and mass M1 and M2.  B1 initially has its center of mass at the origin and is confined to always move along the x axis.  B2 has its center of mass located at coordinates (x2,y2) where 0\u003cx2\u003c(R1+R2) and sqrt((R1+R2)^2-x2^2)\u003cy2.  Gravity acts in the negative y direction with constant g = 9.8 in some consistent unit system.\r\n\r\nWrite a function that returns the velocity of both spheres after B2 is allowed to fall, assuming a lossless collision occurs.  Keep in mind that the answers should be two-element row vectors.  For example, if R1=1, R2=.25, M1=2, M2=4, x2=.5 and y2=6, then:\r\n\r\n  [V1,V2] = balldrop_puzz(M1,M2,R1,R2,x2,y2)\r\n\r\n  V1 = [-10.8362631979321 0]\r\n  V2 = [5.41813159896603 2.66024980473149]","description_html":"\u003cp\u003eI thought I would make a mechanics problem for all those physics lovers out there.\u003c/p\u003e\u003cp\u003eImagine two solid, rigid spheres B1 and B2 with radius R1 and R2 and mass M1 and M2.  B1 initially has its center of mass at the origin and is confined to always move along the x axis.  B2 has its center of mass located at coordinates (x2,y2) where 0\u0026lt;x2\u0026lt;(R1+R2) and sqrt((R1+R2)^2-x2^2)\u0026lt;y2.  Gravity acts in the negative y direction with constant g = 9.8 in some consistent unit system.\u003c/p\u003e\u003cp\u003eWrite a function that returns the velocity of both spheres after B2 is allowed to fall, assuming a lossless collision occurs.  Keep in mind that the answers should be two-element row vectors.  For example, if R1=1, R2=.25, M1=2, M2=4, x2=.5 and y2=6, then:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e[V1,V2] = balldrop_puzz(M1,M2,R1,R2,x2,y2)\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003eV1 = [-10.8362631979321 0]\r\nV2 = [5.41813159896603 2.66024980473149]\r\n\u003c/pre\u003e","function_template":"function [V1,V2] = balldrop_puzz(M1,M2,R1,R2,x2,y2)\r\n  V1 = [pi 0];\r\n  V2 = [pi,pi];\r\nend","test_suite":"%%\r\n[V1,V2] = balldrop_puzz(1.5,2.5,2,2,3.75,7);\r\nassert(all(abs(V1-[-4.62546938906081,0])\u003c1000*eps))\r\nassert(all(abs(V2-[2.77528163343649,-9.45403544713895])\u003c1000*eps))\r\n%%\r\n[V1,V2] = balldrop_puzz(1.5,1.75,2,3.3,2.75,5)\r\nassert(all(abs(V1-[-2.38857735374413,0])\u003c1000*eps))\r\nassert(all(abs(V2-[2.04735201749497 0.340314640435397])\u003c1000*eps))\r\n%%\r\n[V1,V2] = balldrop_puzz(1.5,1.5,2,2,2.75,3)\r\nassert(all(abs(V1-[-0.926482490085206,0])\u003c1000*eps))\r\nassert(all(abs(V2-[0.926482490085206,-0.387821095199846])\u003c1000*eps))\r\n%%\r\n[V1,V2] = balldrop_puzz(3,1,4,2,2.75,7)\r\nassert(all(abs(V1-[-1.45087063290465,0])\u003c1000*eps))\r\nassert(all(abs(V2-[4.35261189871394,2.7238062965565])\u003c1000*eps))\r\n%%\r\n[V1,V2] = balldrop_puzz(1,7,2,1,1,4)\r\nassert(all(abs(V1-[-11.8594824370299,0])\u003c1000*eps))\r\nassert(all(abs(V2-[1.69421177671855,0])\u003c1000*eps))","published":true,"deleted":false,"likes_count":3,"comments_count":6,"created_by":459,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":38,"test_suite_updated_at":"2012-02-16T19:48:02.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-02-15T22:12:53.000Z","updated_at":"2026-02-19T10:01:09.000Z","published_at":"2012-02-16T19:50:07.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\u003eI thought I would make a mechanics problem for all those physics lovers out there.\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\u003eImagine two solid, rigid spheres B1 and B2 with radius R1 and R2 and mass M1 and M2. B1 initially has its center of mass at the origin and is confined to always move along the x axis. B2 has its center of mass located at coordinates (x2,y2) where 0\u0026lt;x2\u0026lt;(R1+R2) and sqrt((R1+R2)^2-x2^2)\u0026lt;y2. Gravity acts in the negative y direction with constant g = 9.8 in some consistent unit system.\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\u003eWrite a function that returns the velocity of both spheres after B2 is allowed to fall, assuming a lossless collision occurs. Keep in mind that the answers should be two-element row vectors. For example, if R1=1, R2=.25, M1=2, M2=4, x2=.5 and y2=6, then:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[[V1,V2] = balldrop_puzz(M1,M2,R1,R2,x2,y2)\\n\\nV1 = [-10.8362631979321 0]\\nV2 = [5.41813159896603 2.66024980473149]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"term":"tag:\"mechanics\"","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:\"mechanics\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"mechanics\"","","\"","mechanics","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f1022dfbf40\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f1022dfbea0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f1022dfb5e0\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f1022dfc1c0\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f1022dfc120\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f1022dfc080\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f1022dfbfe0\u003e":"tag:\"mechanics\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f1022dfbfe0\u003e":"tag:\"mechanics\""},"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":"search","password":"J3bGPZzQ7asjJcCk","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"mechanics\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"mechanics\"","","\"","mechanics","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f1022dfbf40\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f1022dfbea0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f1022dfb5e0\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f1022dfc1c0\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f1022dfc120\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f1022dfc080\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f1022dfbfe0\u003e":"tag:\"mechanics\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f1022dfbfe0\u003e":"tag:\"mechanics\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":321,"difficulty_rating":"easy"},{"id":48675,"difficulty_rating":"easy"},{"id":48680,"difficulty_rating":"easy"},{"id":44936,"difficulty_rating":"easy-medium"},{"id":433,"difficulty_rating":"easy-medium"},{"id":44365,"difficulty_rating":"easy-medium"},{"id":274,"difficulty_rating":"medium"},{"id":323,"difficulty_rating":"medium-hard"}]}}