{"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":8051,"title":"Stress-Strain Properties - 4","description":"A common measure of the ability of a material to carry load per unit mass is termed strength-to-weight ratio and is calculated by dividing the ultimate tensile strength of the material by its density. This property is key in weight-critical applications, such as aerospace, where many materials with high strength-to-weight ratios are used (e.g., Ni-based superalloys, Ti-based alloys, Al-based alloys, and composites).\r\n\r\nWrite a function to calculate the strength-to-weight ratio for a given material provided its ultimate tensile strength and density.\r\n\r\nPrevious problem: 3 - \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8050-stress-strain-properties-3 qualitative measure of brittleness\u003e. Next problem: 5 - \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8052-stress-strain-properties-5 stiffness-to-weight ratio\u003e.","description_html":"\u003cp\u003eA common measure of the ability of a material to carry load per unit mass is termed strength-to-weight ratio and is calculated by dividing the ultimate tensile strength of the material by its density. This property is key in weight-critical applications, such as aerospace, where many materials with high strength-to-weight ratios are used (e.g., Ni-based superalloys, Ti-based alloys, Al-based alloys, and composites).\u003c/p\u003e\u003cp\u003eWrite a function to calculate the strength-to-weight ratio for a given material provided its ultimate tensile strength and density.\u003c/p\u003e\u003cp\u003ePrevious problem: 3 - \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8050-stress-strain-properties-3\"\u003equalitative measure of brittleness\u003c/a\u003e. Next problem: 5 - \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8052-stress-strain-properties-5\"\u003estiffness-to-weight ratio\u003c/a\u003e.\u003c/p\u003e","function_template":"function [StWR] = stress_strain4(S_u,density)\r\n\r\nStWR = 1;\r\n\r\nend\r\n","test_suite":"%% Note\r\n% The following properties are measured at room temperature and are tensile\r\n% in a single direction. Some materials, such as metals are generally\r\n% isotropic, whereas others, like composite are highly anisotropic\r\n% (different properties in different directions). Also, property values can\r\n% range depending on the material grade. Finally, thermal or environmental\r\n% changes can alter these properties, sometimes drastically.\r\n\r\n%% steel alloy (ASTM A36)\r\nS_y = 250e6; %Pa\r\nS_u = 400e6; %Pa\r\ne_y = 0.00125;\r\ne_u = 0.35;\r\nnu = 0.26;\r\nG = 79.3e9; %Pa\r\nE = 200e9; %Pa\r\ndensity = 7.85; %g/cm^3\r\nsh_exp = 0.14; %strain-hardening exponent\r\nsh_coeff = 0.463; %strain-hardening coefficient\r\nStWR_corr = 5.096e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% titanium (Ti-6Al-4V)\r\nS_y = 830e6; %Pa\r\nS_u = 900e6; %Pa\r\ne_y = 0.00728;\r\ne_u = 0.14;\r\nnu = 0.342;\r\nG = 44e9; %Pa\r\nE = 114e9; %Pa\r\ndensity = 4.51; %g/cm^3\r\nsh_exp = 0.04; %strain-hardening exponent\r\nsh_coeff = 0.974; %strain-hardening coefficient\r\nStWR_corr = 19.96e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% Inconel 718\r\nS_y = 1172e6; %Pa\r\nS_u = 1407e6; %Pa\r\ne_y = 0.00563;\r\ne_u = 0.027;\r\nnu = 0.29;\r\nG = 11.6e9; %Pa\r\nE = 208e9; %Pa\r\ndensity = 8.19; %g/cm^3\r\nsh_exp = 0.075; %strain-hardening exponent\r\nsh_coeff = 1.845; %strain-hardening coefficient\r\nStWR_corr = 17.18e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% aluminum alloy (6061-T6)%^\u0026\r\nS_y = 241e6; %Pa\r\nS_u = 300e6; %Pa\r\ne_y = 0.0035;\r\ne_u = 0.15;\r\nnu = 0.33;\r\nG = 26e9; %Pa\r\nE = 68.9e9; %Pa\r\ndensity = 2.7; %g/cm^3\r\nsh_exp = 0.042; %strain-hardening exponent\r\nsh_coeff = 0.325; %strain-hardening coefficient\r\nStWR_corr = 11.11e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% copper\r\nS_y = 70e6; %Pa\r\nS_u = 220e6; %Pa\r\ne_y = 0.00054;\r\ne_u = 0.48;\r\nnu = 0.34;\r\nG = 48e9; %Pa\r\nE = 130e9; %Pa\r\ndensity = 8.92; %g/cm^3\r\nsh_exp = 0.44; %strain-hardening exponent\r\nsh_coeff = 0.304; %strain-hardening coefficient\r\nStWR_corr = 2.466e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% rhenium\r\nS_y = 317e6; %Pa\r\nS_u = 1130e6; %Pa\r\ne_y = 0.000685;\r\ne_u = 0.24;\r\nnu = 0.3;\r\nG = 178e9; %Pa\r\nE = 463e9; %Pa\r\ndensity = 21.02; %g/cm^3\r\nsh_exp = 0.353; %strain-hardening exponent\r\nsh_coeff = 1.870; %strain-hardening coefficient\r\nStWR_corr = 5.376e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6)\r\nS_y = 82e6; %Pa\r\nS_u = 82e6; %Pa\r\ne_y = 0.0265;\r\ne_u = 0.45;\r\nnu = 0.41;\r\nG = 2.8e9; %Pa\r\nE = 3.1e-2; %Pa\r\ndensity = 1.14; %g/cm^3\r\nStWR_corr = 7.193e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6) reinforced with 45wt.% glass fiber\r\nS_y = 230e6; %Pa\r\nS_u = 230e6; %Pa\r\ne_y = 0.016;\r\ne_u = 0.016;\r\nnu = 0.35;\r\nG = 13.0e9; %Pa\r\nE = 14.5e9; %Pa\r\ndensity = 1.51; %g/cm^3\r\nStWR_corr = 15.23e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% diamond\r\nS_y = 1200e6; %Pa\r\nS_u = 1200e6; %Pa\r\ne_y = 0.001;\r\ne_u = 0.001;\r\nnu = 0.20;\r\nG = 478e9; %Pa\r\nE = 1200e9; %Pa\r\ndensity = 3.51; %g/cm^3\r\nStWR_corr = 34.19e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_u = 400e6; %Pa\r\n\t\tdensity = 7.85; %g/cm^3\r\n\t\tStWR_corr = 5.096e7;\r\n\tcase 2\r\n\t\tS_u = 230e6; %Pa\r\n\t\tdensity = 1.51; %g/cm^3\r\n\t\tStWR_corr = 15.23e7;\r\n\tcase 3\r\n\t\tS_u = 1130e6; %Pa\r\n\t\tdensity = 21.02; %g/cm^3\r\n\t\tStWR_corr = 5.376e7;\r\n\tcase 4\r\n\t\tS_u = 1200e6; %Pa\r\n\t\tdensity = 3.51; %g/cm^3\r\n\t\tStWR_corr = 34.19e7;\r\nend\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_u = 300e6; %Pa\r\n\t\tdensity = 2.7; %g/cm^3\r\n\t\tStWR_corr = 11.11e7;\r\n\tcase 2\r\n\t\tS_u = 900e6; %Pa\r\n\t\tdensity = 4.51; %g/cm^3\r\n\t\tStWR_corr = 19.96e7;\r\n\tcase 3\r\n\t\tS_u = 220e6; %Pa\r\n\t\tdensity = 8.92; %g/cm^3\r\n\t\tStWR_corr = 2.466e7;\r\n\tcase 4\r\n\t\tS_u = 230e6; %Pa\r\n\t\tdensity = 1.51; %g/cm^3\r\n\t\tStWR_corr = 15.23e7;\r\nend\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_u = 300e6; %Pa\r\n\t\tdensity = 2.7; %g/cm^3\r\n\t\tStWR_corr = 11.11e7;\r\n\tcase 2\r\n\t\tS_u = 1200e6; %Pa\r\n\t\tdensity = 3.51; %g/cm^3\r\n\t\tStWR_corr = 34.19e7;\r\n\tcase 3\r\n\t\tS_u = 82e6; %Pa\r\n\t\tdensity = 1.14; %g/cm^3\r\n\t\tStWR_corr = 7.193e7;\r\n\tcase 4\r\n\t\tS_u = 900e6; %Pa\r\n\t\tdensity = 4.51; %g/cm^3\r\n\t\tStWR_corr = 19.96e7;\r\nend\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":222,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2015-03-30T19:24:41.000Z","updated_at":"2026-03-10T20:20:32.000Z","published_at":"2015-03-30T19:24:41.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA common measure of the ability of a material to carry load per unit mass is termed strength-to-weight ratio and is calculated by dividing the ultimate tensile strength of the material by its density. This property is key in weight-critical applications, such as aerospace, where many materials with high strength-to-weight ratios are used (e.g., Ni-based superalloys, Ti-based alloys, Al-based alloys, and composites).\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 to calculate the strength-to-weight ratio for a given material provided its ultimate tensile strength and density.\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\u003ePrevious problem: 3 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8050-stress-strain-properties-3\\\"\u003e\u003cw:r\u003e\u003cw:t\u003equalitative measure of brittleness\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem: 5 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8052-stress-strain-properties-5\\\"\u003e\u003cw:r\u003e\u003cw:t\u003estiffness-to-weight ratio\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\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":8052,"title":"Stress-Strain Properties - 5","description":"Similar to the previous problem, materials may be characterized by their stiffness-to-weight ratio, which is the elastic modulus divided by density. Write a function to calculate this ratio for a material provided its elastic modulus and density.\r\n\r\nPrevious problem: 4 - \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8051-stress-strain-properties-4 strength-to-weight ratio\u003e. Next problem: 6 - \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8053-stress-strain-properties-6 absorbed strain energy\u003e.","description_html":"\u003cp\u003eSimilar to the previous problem, materials may be characterized by their stiffness-to-weight ratio, which is the elastic modulus divided by density. Write a function to calculate this ratio for a material provided its elastic modulus and density.\u003c/p\u003e\u003cp\u003ePrevious problem: 4 - \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8051-stress-strain-properties-4\"\u003estrength-to-weight ratio\u003c/a\u003e. Next problem: 6 - \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8053-stress-strain-properties-6\"\u003eabsorbed strain energy\u003c/a\u003e.\u003c/p\u003e","function_template":"function [EtWR] = stress_strain5(E,density)\r\n\r\nEtWR = 1\r\n\r\nend\r\n","test_suite":"%% Note\r\n% The following properties are measured at room temperature and are tensile\r\n% in a single direction. Some materials, such as metals are generally\r\n% isotropic, whereas others, like composite are highly anisotropic\r\n% (different properties in different directions). Also, property values can\r\n% range depending on the material grade. Finally, thermal or environmental\r\n% changes can alter these properties, sometimes drastically.\r\n\r\n%% steel alloy (ASTM A36)\r\nS_y = 250e6; %Pa\r\nS_u = 400e6; %Pa\r\ne_y = 0.00125;\r\ne_u = 0.35;\r\nnu = 0.26;\r\nG = 79.3e9; %Pa\r\nE = 200e9; %Pa\r\ndensity = 7.85; %g/cm^3\r\nsh_exp = 0.14; %strain-hardening exponent\r\nsh_coeff = 0.463; %strain-hardening coefficient\r\nEtWR_corr = 2.548e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% titanium (Ti-6Al-4V)\r\nS_y = 830e6; %Pa\r\nS_u = 900e6; %Pa\r\ne_y = 0.00728;\r\ne_u = 0.14;\r\nnu = 0.342;\r\nG = 44e9; %Pa\r\nE = 114e9; %Pa\r\ndensity = 4.51; %g/cm^3\r\nsh_exp = 0.04; %strain-hardening exponent\r\nsh_coeff = 0.974; %strain-hardening coefficient\r\nEtWR_corr = 2.528e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% Inconel 718\r\nS_y = 1172e6; %Pa\r\nS_u = 1407e6; %Pa\r\ne_y = 0.00563;\r\ne_u = 0.027;\r\nnu = 0.29;\r\nG = 11.6e9; %Pa\r\nE = 208e9; %Pa\r\ndensity = 8.19; %g/cm^3\r\nsh_exp = 0.075; %strain-hardening exponent\r\nsh_coeff = 1.845; %strain-hardening coefficient\r\nEtWR_corr = 2.540e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% aluminum alloy (6061-T6)%^\u0026\r\nS_y = 241e6; %Pa\r\nS_u = 300e6; %Pa\r\ne_y = 0.0035;\r\ne_u = 0.15;\r\nnu = 0.33;\r\nG = 26e9; %Pa\r\nE = 68.9e9; %Pa\r\ndensity = 2.7; %g/cm^3\r\nsh_exp = 0.042; %strain-hardening exponent\r\nsh_coeff = 0.325; %strain-hardening coefficient\r\nEtWR_corr = 2.552e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% copper\r\nS_y = 70e6; %Pa\r\nS_u = 220e6; %Pa\r\ne_y = 0.00054;\r\ne_u = 0.48;\r\nnu = 0.34;\r\nG = 48e9; %Pa\r\nE = 130e9; %Pa\r\ndensity = 8.92; %g/cm^3\r\nsh_exp = 0.44; %strain-hardening exponent\r\nsh_coeff = 0.304; %strain-hardening coefficient\r\nEtWR_corr = 1.457e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% rhenium\r\nS_y = 317e6; %Pa\r\nS_u = 1130e6; %Pa\r\ne_y = 0.000685;\r\ne_u = 0.24;\r\nnu = 0.3;\r\nG = 178e9; %Pa\r\nE = 463e9; %Pa\r\ndensity = 21.02; %g/cm^3\r\nsh_exp = 0.353; %strain-hardening exponent\r\nsh_coeff = 1.870; %strain-hardening coefficient\r\nEtWR_corr = 2.203e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6)\r\nS_y = 82e6; %Pa\r\nS_u = 82e6; %Pa\r\ne_y = 0.0265;\r\ne_u = 0.45;\r\nnu = 0.41;\r\nG = 2.8e9; %Pa\r\nE = 3.1e9; %Pa\r\ndensity = 1.14; %g/cm^3\r\nEtWR_corr = 0.272e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6) reinforced with 45wt.% glass fiber\r\nS_y = 230e6; %Pa\r\nS_u = 230e6; %Pa\r\ne_y = 0.016;\r\ne_u = 0.016;\r\nnu = 0.35;\r\nG = 13.0e9; %Pa\r\nE = 14.5e9; %Pa\r\ndensity = 1.51; %g/cm^3\r\nEtWR_corr = 0.960e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% diamond\r\nS_y = 1200e6; %Pa\r\nS_u = 1200e6; %Pa\r\ne_y = 0.001;\r\ne_u = 0.001;\r\nnu = 0.20;\r\nG = 478e9; %Pa\r\nE = 1200e9; %Pa\r\ndensity = 3.51; %g/cm^3\r\nEtWR_corr = 34.19e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tE = 114e9; %Pa\r\n\t\tdensity = 4.51; %g/cm^3\r\n\t\tEtWR_corr = 2.528e10;\r\n\tcase 2\r\n\t\tE = 68.9e9; %Pa\r\n\t\tdensity = 2.7; %g/cm^3\r\n\t\tEtWR_corr = 2.552e10;\r\n\tcase 3\r\n\t\tE = 200e9; %Pa\r\n\t\tdensity = 7.85; %g/cm^3\r\n\t\tEtWR_corr = 2.548e10;\r\n\tcase 4\r\n\t\tE = 1200e9; %Pa\r\n\t\tdensity = 3.51; %g/cm^3\r\n\t\tEtWR_corr = 34.19e10;\r\nend\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tE = 68.9e9; %Pa\r\n\t\tdensity = 2.7; %g/cm^3\r\n\t\tEtWR_corr = 2.552e10;\r\n\tcase 2\r\n\t\tE = 3.1e9; %Pa\r\n\t\tdensity = 1.14; %g/cm^3\r\n\t\tEtWR_corr = 0.272e10;\r\n\tcase 3\r\n\t\tE = 14.5e9; %Pa\r\n\t\tdensity = 1.51; %g/cm^3\r\n\t\tEtWR_corr = 0.960e10;\r\n\tcase 4\r\n\t\tE = 208e9; %Pa\r\n\t\tdensity = 8.19; %g/cm^3\r\n\t\tEtWR_corr = 2.540e10;\r\nend\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tE = 208e9; %Pa\r\n\t\tdensity = 8.19; %g/cm^3\r\n\t\tEtWR_corr = 2.540e10;\r\n\tcase 2\r\n\t\tE = 463e9; %Pa\r\n\t\tdensity = 21.02; %g/cm^3\r\n\t\tEtWR_corr = 2.203e10;\r\n\tcase 3\r\n\t\tE = 130e9; %Pa\r\n\t\tdensity = 8.92; %g/cm^3\r\n\t\tEtWR_corr = 1.457e10;\r\n\tcase 4\r\n\t\tE = 3.1e9; %Pa\r\n\t\tdensity = 1.14; %g/cm^3\r\n\t\tEtWR_corr = 0.272e10;\r\nend\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":212,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2015-03-30T19:40:12.000Z","updated_at":"2026-03-10T20:42:38.000Z","published_at":"2015-03-30T19:40:12.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\u003eSimilar to the previous problem, materials may be characterized by their stiffness-to-weight ratio, which is the elastic modulus divided by density. Write a function to calculate this ratio for a material provided its elastic modulus and density.\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\u003ePrevious problem: 4 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8051-stress-strain-properties-4\\\"\u003e\u003cw:r\u003e\u003cw:t\u003estrength-to-weight ratio\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem: 6 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8053-stress-strain-properties-6\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eabsorbed strain energy\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\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":8047,"title":"Weighted Gold/Silver Standard","description":"Building off of the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8045-gold-standard Gold Standard\u003e and \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8046-gold-silver-standard Gold/Silver Standard\u003e problems, let's make a weighted currency convertor. The same data for gold value and silver-to-gold ratio will be provided in the function template.\r\n\r\nFor this problem, based on a historical year (HY) and a historical value (HV) in dollars, calculate the current value using the gold (CVG) and silver (CVS) references; see the referenced problems for details and examples of those individual problems. In this case, you will be provided a weighting that will range from 0 to 1, where 0 indicates complete weighting by gold and 1 indicates complete weighting by silver. Remember to round the result to two decimal places. If HY is outside of the historical data range, return NaN.\r\n\r\nAs an example, with HY = 2000, HV = 1000, and wt = 0.4:\r\n\r\n* CVG = $4534.09 (gold standard)\r\n* CVS = $3822.36 (silver standard)\r\n* CV = (1-0.4)*4534.09 + 0.4*3822.36 = $4249.40.","description_html":"\u003cp\u003eBuilding off of the \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8045-gold-standard\"\u003eGold Standard\u003c/a\u003e and \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8046-gold-silver-standard\"\u003eGold/Silver Standard\u003c/a\u003e problems, let's make a weighted currency convertor. The same data for gold value and silver-to-gold ratio will be provided in the function template.\u003c/p\u003e\u003cp\u003eFor this problem, based on a historical year (HY) and a historical value (HV) in dollars, calculate the current value using the gold (CVG) and silver (CVS) references; see the referenced problems for details and examples of those individual problems. In this case, you will be provided a weighting that will range from 0 to 1, where 0 indicates complete weighting by gold and 1 indicates complete weighting by silver. Remember to round the result to two decimal places. If HY is outside of the historical data range, return NaN.\u003c/p\u003e\u003cp\u003eAs an example, with HY = 2000, HV = 1000, and wt = 0.4:\u003c/p\u003e\u003cul\u003e\u003cli\u003eCVG = $4534.09 (gold standard)\u003c/li\u003e\u003cli\u003eCVS = $3822.36 (silver standard)\u003c/li\u003e\u003cli\u003eCV = (1-0.4)*4534.09 + 0.4*3822.36 = $4249.40.\u003c/li\u003e\u003c/ul\u003e","function_template":"function [CV] = gold_silver_weighted_standard(HY,HV,wt)\r\n\r\nY = 1791:2014;\r\nGV = [19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 20.1, 21.64, 20.95, 19.46, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.94, 20.69, 20.69, 21.64, 20.86, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.7, 20.67, 20.67, 20.67, 20.67, 23.42, 30.02, 42.03, 32.52, 29.13, 28.57, 28.88, 27.49, 23.75, 23.09, 23.24, 23.52, 22.99, 23.75, 23.05, 21.66, 20.84, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 24.44, 34.94, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 39.26, 41.51, 36.41, 41.25, 58.6, 97.81, 159.74, 161.49, 125.32, 148.31, 193.55, 307.5, 612.56, 459.64, 375.91, 424, 360.66, 317.66, 368.24, 447.95, 438.31, 382.58, 384.93, 363.29, 344.97, 360.91, 385.42, 385.5, 389.09, 332.39, 295.24, 279.91, 280.1, 272.22, 311.33, 364.8, 410.52, 446, 606, 699, 874, 975, 1227, 1572, 1700, 1415, 1270];\r\nSR = [15.05, 15.17, 15, 15.37, 15.55, 15.65, 15.41, 15.59, 15.74, 15.68, 15.46, 15.26, 15.41, 15.41, 15.79, 15.52, 15.43, 16.08, 15.96, 15.77, 15.53, 16.11, 16.25, 15.04, 15.26, 15.28, 15.11, 15.35, 15.33, 15.62, 15.95, 15.8, 15.84, 15.82, 15.7, 15.76, 15.74, 15.78, 15.78, 15.82, 15.72, 15.73, 15.93, 15.73, 15.8, 15.72, 15.83, 15.85, 15.62, 15.62, 15.7, 15.87, 15.93, 15.85, 15.92, 15.9, 15.8, 15.85, 15.78, 15.7, 15.46, 15.59, 15.33, 15.33, 15.38, 15.38, 15.27, 15.38, 15.19, 15.29, 15.5, 15.35, 15.37, 15.37, 15.44, 15.43, 15.57, 15.59, 15.6, 15.57, 15.57, 15.63, 15.93, 16.16, 16.64, 17.75, 17.2, 17.92, 18.39, 18.05, 18.25, 18.2, 18.64, 18.61, 19.41, 20.78, 21.1, 22, 22.1, 19.75, 20.92, 23.72, 26.49, 32.56, 31.6, 30.59, 34.2, 35.03, 34.36, 33.33, 34.68, 39.15, 38.1, 35.7, 33.87, 30.54, 31.24, 38.64, 39.74, 38.22, 38.33, 33.62, 34.19, 37.37, 40.48, 30.78, 24.61, 21, 18.44, 20.28, 32.76, 30.43, 31.69, 30.8, 29.78, 33.11, 36.47, 35.34, 38.78, 53.74, 71.25, 73.29, 69.83, 72.36, 54.19, 77.09, 77.44, 80.39, 88.84, 99.76, 99.73, 90.57, 77.67, 77.67, 67.4, 43.67, 48.73, 47.07, 48.61, 47.14, 39.12, 41.16, 41.04, 41.01, 39.24, 38.5, 38.5, 39.27, 38.34, 38.27, 37.82, 32.22, 27.34, 27.04, 27.04, 27.04, 22.56, 18.29, 23.16, 20.54, 26.66, 34.75, 38.21, 33.9, 36.51, 28.76, 32.05, 35.8, 27.69, 29.66, 43.65, 47.24, 37.03, 44.26, 51.68, 67.25, 63.84, 66.95, 69.49, 79.78, 89.83, 87.47, 83.85, 72.79, 74.78, 74.89, 67.91, 53.24, 53.26, 55.96, 61.95, 67.32, 74.22, 61.3, 60.7, 52.2, 51.91, 58.17, 66.27, 60.64, 44.75, 53.58, 59.31, 66.38];\r\n\r\nCV = 1;\r\n\r\nend\r\n","test_suite":"%% current check\r\nHY = 2014; HV = 1270; wt = 0.5; CV_corr = 1270;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%% out-of-range check 1\r\nHY = 500; HV = 50; wt = 0.5; CV_corr = NaN;\r\nassert(isnan(gold_silver_weighted_standard(HY,HV,wt)))\r\n\r\n%% out-of-range check 2\r\nHY = 2500; HV = 5000; wt = 0.5; CV_corr = NaN;\r\nassert(isnan(gold_silver_weighted_standard(HY,HV,wt)))\r\n\r\n%%\r\nHY = 2010; HV = 1000; wt = 0.5; CV_corr = 990.29;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 2005; HV = 1000; wt = 0.5; CV_corr = 2725.7;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 2000; HV = 1000; wt = 0.5; CV_corr = 4178.23;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1995; HV = 1000; wt = 0.5; CV_corr = 3502.87;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1990; HV = 1000; wt = 0.5; CV_corr = 3632.31;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1950; HV = 1000; wt = 0.5; CV_corr = 31027.07;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1900; HV = 1000; wt = 0.5; CV_corr = 46146.07;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1850; HV = 1000; wt = 0.5; CV_corr = 37986.86;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1800; HV = 1000; wt = 0.5; CV_corr = 40484.63;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 2000; HV = 1000;\r\nwt = randi(10)/10;\r\nswitch (wt*10)\r\n\tcase 0\r\n\t\tCV_corr = 4534.09;\r\n\tcase 1\r\n\t\tCV_corr = 4462.92;\r\n\tcase 2\r\n\t\tCV_corr = 4391.75;\r\n\tcase 3\r\n\t\tCV_corr = 4320.57;\r\n\tcase 4\r\n\t\tCV_corr = 4249.4;\r\n\tcase 5\r\n\t\tCV_corr = 4178.23;\r\n\tcase 6\r\n\t\tCV_corr = 4107.05;\r\n\tcase 7\r\n\t\tCV_corr = 4035.88;\r\n\tcase 8\r\n\t\tCV_corr = 3964.7;\r\n\tcase 9\r\n\t\tCV_corr = 3893.53;\r\n\tcase 10\r\n\t\tCV_corr = 3822.36;\r\nend\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1800; HV = 1000;\r\nwt = randi(10)/10;\r\nswitch (wt*10)\r\n\tcase 0\r\n\t\tCV_corr = 65497.68;\r\n\tcase 1\r\n\t\tCV_corr = 60495.07;\r\n\tcase 2\r\n\t\tCV_corr = 55492.46;\r\n\tcase 3\r\n\t\tCV_corr = 50489.85;\r\n\tcase 4\r\n\t\tCV_corr = 45487.24;\r\n\tcase 5\r\n\t\tCV_corr = 40484.63;\r\n\tcase 6\r\n\t\tCV_corr = 35482.02;\r\n\tcase 7\r\n\t\tCV_corr = 30479.41;\r\n\tcase 8\r\n\t\tCV_corr = 25476.8;\r\n\tcase 9\r\n\t\tCV_corr = 20474.19;\r\n\tcase 10\r\n\t\tCV_corr = 15471.58;\r\nend\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":50,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":30,"created_at":"2015-03-30T16:47:31.000Z","updated_at":"2026-03-27T06:22:48.000Z","published_at":"2015-03-30T16:47:31.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\u003eBuilding off of the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8045-gold-standard\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGold Standard\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:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8046-gold-silver-standard\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGold/Silver Standard\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e problems, let's make a weighted currency convertor. The same data for gold value and silver-to-gold ratio will be provided in the function template.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor this problem, based on a historical year (HY) and a historical value (HV) in dollars, calculate the current value using the gold (CVG) and silver (CVS) references; see the referenced problems for details and examples of those individual problems. In this case, you will be provided a weighting that will range from 0 to 1, where 0 indicates complete weighting by gold and 1 indicates complete weighting by silver. Remember to round the result to two decimal places. If HY is outside of the historical data range, return NaN.\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\u003eAs an example, with HY = 2000, HV = 1000, and wt = 0.4:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCVG = $4534.09 (gold standard)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCVS = $3822.36 (silver standard)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCV = (1-0.4)*4534.09 + 0.4*3822.36 = $4249.40.\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":8051,"title":"Stress-Strain Properties - 4","description":"A common measure of the ability of a material to carry load per unit mass is termed strength-to-weight ratio and is calculated by dividing the ultimate tensile strength of the material by its density. This property is key in weight-critical applications, such as aerospace, where many materials with high strength-to-weight ratios are used (e.g., Ni-based superalloys, Ti-based alloys, Al-based alloys, and composites).\r\n\r\nWrite a function to calculate the strength-to-weight ratio for a given material provided its ultimate tensile strength and density.\r\n\r\nPrevious problem: 3 - \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8050-stress-strain-properties-3 qualitative measure of brittleness\u003e. Next problem: 5 - \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8052-stress-strain-properties-5 stiffness-to-weight ratio\u003e.","description_html":"\u003cp\u003eA common measure of the ability of a material to carry load per unit mass is termed strength-to-weight ratio and is calculated by dividing the ultimate tensile strength of the material by its density. This property is key in weight-critical applications, such as aerospace, where many materials with high strength-to-weight ratios are used (e.g., Ni-based superalloys, Ti-based alloys, Al-based alloys, and composites).\u003c/p\u003e\u003cp\u003eWrite a function to calculate the strength-to-weight ratio for a given material provided its ultimate tensile strength and density.\u003c/p\u003e\u003cp\u003ePrevious problem: 3 - \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8050-stress-strain-properties-3\"\u003equalitative measure of brittleness\u003c/a\u003e. Next problem: 5 - \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8052-stress-strain-properties-5\"\u003estiffness-to-weight ratio\u003c/a\u003e.\u003c/p\u003e","function_template":"function [StWR] = stress_strain4(S_u,density)\r\n\r\nStWR = 1;\r\n\r\nend\r\n","test_suite":"%% Note\r\n% The following properties are measured at room temperature and are tensile\r\n% in a single direction. Some materials, such as metals are generally\r\n% isotropic, whereas others, like composite are highly anisotropic\r\n% (different properties in different directions). Also, property values can\r\n% range depending on the material grade. Finally, thermal or environmental\r\n% changes can alter these properties, sometimes drastically.\r\n\r\n%% steel alloy (ASTM A36)\r\nS_y = 250e6; %Pa\r\nS_u = 400e6; %Pa\r\ne_y = 0.00125;\r\ne_u = 0.35;\r\nnu = 0.26;\r\nG = 79.3e9; %Pa\r\nE = 200e9; %Pa\r\ndensity = 7.85; %g/cm^3\r\nsh_exp = 0.14; %strain-hardening exponent\r\nsh_coeff = 0.463; %strain-hardening coefficient\r\nStWR_corr = 5.096e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% titanium (Ti-6Al-4V)\r\nS_y = 830e6; %Pa\r\nS_u = 900e6; %Pa\r\ne_y = 0.00728;\r\ne_u = 0.14;\r\nnu = 0.342;\r\nG = 44e9; %Pa\r\nE = 114e9; %Pa\r\ndensity = 4.51; %g/cm^3\r\nsh_exp = 0.04; %strain-hardening exponent\r\nsh_coeff = 0.974; %strain-hardening coefficient\r\nStWR_corr = 19.96e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% Inconel 718\r\nS_y = 1172e6; %Pa\r\nS_u = 1407e6; %Pa\r\ne_y = 0.00563;\r\ne_u = 0.027;\r\nnu = 0.29;\r\nG = 11.6e9; %Pa\r\nE = 208e9; %Pa\r\ndensity = 8.19; %g/cm^3\r\nsh_exp = 0.075; %strain-hardening exponent\r\nsh_coeff = 1.845; %strain-hardening coefficient\r\nStWR_corr = 17.18e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% aluminum alloy (6061-T6)%^\u0026\r\nS_y = 241e6; %Pa\r\nS_u = 300e6; %Pa\r\ne_y = 0.0035;\r\ne_u = 0.15;\r\nnu = 0.33;\r\nG = 26e9; %Pa\r\nE = 68.9e9; %Pa\r\ndensity = 2.7; %g/cm^3\r\nsh_exp = 0.042; %strain-hardening exponent\r\nsh_coeff = 0.325; %strain-hardening coefficient\r\nStWR_corr = 11.11e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% copper\r\nS_y = 70e6; %Pa\r\nS_u = 220e6; %Pa\r\ne_y = 0.00054;\r\ne_u = 0.48;\r\nnu = 0.34;\r\nG = 48e9; %Pa\r\nE = 130e9; %Pa\r\ndensity = 8.92; %g/cm^3\r\nsh_exp = 0.44; %strain-hardening exponent\r\nsh_coeff = 0.304; %strain-hardening coefficient\r\nStWR_corr = 2.466e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% rhenium\r\nS_y = 317e6; %Pa\r\nS_u = 1130e6; %Pa\r\ne_y = 0.000685;\r\ne_u = 0.24;\r\nnu = 0.3;\r\nG = 178e9; %Pa\r\nE = 463e9; %Pa\r\ndensity = 21.02; %g/cm^3\r\nsh_exp = 0.353; %strain-hardening exponent\r\nsh_coeff = 1.870; %strain-hardening coefficient\r\nStWR_corr = 5.376e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6)\r\nS_y = 82e6; %Pa\r\nS_u = 82e6; %Pa\r\ne_y = 0.0265;\r\ne_u = 0.45;\r\nnu = 0.41;\r\nG = 2.8e9; %Pa\r\nE = 3.1e-2; %Pa\r\ndensity = 1.14; %g/cm^3\r\nStWR_corr = 7.193e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6) reinforced with 45wt.% glass fiber\r\nS_y = 230e6; %Pa\r\nS_u = 230e6; %Pa\r\ne_y = 0.016;\r\ne_u = 0.016;\r\nnu = 0.35;\r\nG = 13.0e9; %Pa\r\nE = 14.5e9; %Pa\r\ndensity = 1.51; %g/cm^3\r\nStWR_corr = 15.23e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% diamond\r\nS_y = 1200e6; %Pa\r\nS_u = 1200e6; %Pa\r\ne_y = 0.001;\r\ne_u = 0.001;\r\nnu = 0.20;\r\nG = 478e9; %Pa\r\nE = 1200e9; %Pa\r\ndensity = 3.51; %g/cm^3\r\nStWR_corr = 34.19e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_u = 400e6; %Pa\r\n\t\tdensity = 7.85; %g/cm^3\r\n\t\tStWR_corr = 5.096e7;\r\n\tcase 2\r\n\t\tS_u = 230e6; %Pa\r\n\t\tdensity = 1.51; %g/cm^3\r\n\t\tStWR_corr = 15.23e7;\r\n\tcase 3\r\n\t\tS_u = 1130e6; %Pa\r\n\t\tdensity = 21.02; %g/cm^3\r\n\t\tStWR_corr = 5.376e7;\r\n\tcase 4\r\n\t\tS_u = 1200e6; %Pa\r\n\t\tdensity = 3.51; %g/cm^3\r\n\t\tStWR_corr = 34.19e7;\r\nend\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_u = 300e6; %Pa\r\n\t\tdensity = 2.7; %g/cm^3\r\n\t\tStWR_corr = 11.11e7;\r\n\tcase 2\r\n\t\tS_u = 900e6; %Pa\r\n\t\tdensity = 4.51; %g/cm^3\r\n\t\tStWR_corr = 19.96e7;\r\n\tcase 3\r\n\t\tS_u = 220e6; %Pa\r\n\t\tdensity = 8.92; %g/cm^3\r\n\t\tStWR_corr = 2.466e7;\r\n\tcase 4\r\n\t\tS_u = 230e6; %Pa\r\n\t\tdensity = 1.51; %g/cm^3\r\n\t\tStWR_corr = 15.23e7;\r\nend\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_u = 300e6; %Pa\r\n\t\tdensity = 2.7; %g/cm^3\r\n\t\tStWR_corr = 11.11e7;\r\n\tcase 2\r\n\t\tS_u = 1200e6; %Pa\r\n\t\tdensity = 3.51; %g/cm^3\r\n\t\tStWR_corr = 34.19e7;\r\n\tcase 3\r\n\t\tS_u = 82e6; %Pa\r\n\t\tdensity = 1.14; %g/cm^3\r\n\t\tStWR_corr = 7.193e7;\r\n\tcase 4\r\n\t\tS_u = 900e6; %Pa\r\n\t\tdensity = 4.51; %g/cm^3\r\n\t\tStWR_corr = 19.96e7;\r\nend\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":222,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2015-03-30T19:24:41.000Z","updated_at":"2026-03-10T20:20:32.000Z","published_at":"2015-03-30T19:24:41.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA common measure of the ability of a material to carry load per unit mass is termed strength-to-weight ratio and is calculated by dividing the ultimate tensile strength of the material by its density. This property is key in weight-critical applications, such as aerospace, where many materials with high strength-to-weight ratios are used (e.g., Ni-based superalloys, Ti-based alloys, Al-based alloys, and composites).\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 to calculate the strength-to-weight ratio for a given material provided its ultimate tensile strength and density.\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\u003ePrevious problem: 3 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8050-stress-strain-properties-3\\\"\u003e\u003cw:r\u003e\u003cw:t\u003equalitative measure of brittleness\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem: 5 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8052-stress-strain-properties-5\\\"\u003e\u003cw:r\u003e\u003cw:t\u003estiffness-to-weight ratio\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\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":8052,"title":"Stress-Strain Properties - 5","description":"Similar to the previous problem, materials may be characterized by their stiffness-to-weight ratio, which is the elastic modulus divided by density. Write a function to calculate this ratio for a material provided its elastic modulus and density.\r\n\r\nPrevious problem: 4 - \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8051-stress-strain-properties-4 strength-to-weight ratio\u003e. Next problem: 6 - \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8053-stress-strain-properties-6 absorbed strain energy\u003e.","description_html":"\u003cp\u003eSimilar to the previous problem, materials may be characterized by their stiffness-to-weight ratio, which is the elastic modulus divided by density. Write a function to calculate this ratio for a material provided its elastic modulus and density.\u003c/p\u003e\u003cp\u003ePrevious problem: 4 - \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8051-stress-strain-properties-4\"\u003estrength-to-weight ratio\u003c/a\u003e. Next problem: 6 - \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8053-stress-strain-properties-6\"\u003eabsorbed strain energy\u003c/a\u003e.\u003c/p\u003e","function_template":"function [EtWR] = stress_strain5(E,density)\r\n\r\nEtWR = 1\r\n\r\nend\r\n","test_suite":"%% Note\r\n% The following properties are measured at room temperature and are tensile\r\n% in a single direction. Some materials, such as metals are generally\r\n% isotropic, whereas others, like composite are highly anisotropic\r\n% (different properties in different directions). Also, property values can\r\n% range depending on the material grade. Finally, thermal or environmental\r\n% changes can alter these properties, sometimes drastically.\r\n\r\n%% steel alloy (ASTM A36)\r\nS_y = 250e6; %Pa\r\nS_u = 400e6; %Pa\r\ne_y = 0.00125;\r\ne_u = 0.35;\r\nnu = 0.26;\r\nG = 79.3e9; %Pa\r\nE = 200e9; %Pa\r\ndensity = 7.85; %g/cm^3\r\nsh_exp = 0.14; %strain-hardening exponent\r\nsh_coeff = 0.463; %strain-hardening coefficient\r\nEtWR_corr = 2.548e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% titanium (Ti-6Al-4V)\r\nS_y = 830e6; %Pa\r\nS_u = 900e6; %Pa\r\ne_y = 0.00728;\r\ne_u = 0.14;\r\nnu = 0.342;\r\nG = 44e9; %Pa\r\nE = 114e9; %Pa\r\ndensity = 4.51; %g/cm^3\r\nsh_exp = 0.04; %strain-hardening exponent\r\nsh_coeff = 0.974; %strain-hardening coefficient\r\nEtWR_corr = 2.528e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% Inconel 718\r\nS_y = 1172e6; %Pa\r\nS_u = 1407e6; %Pa\r\ne_y = 0.00563;\r\ne_u = 0.027;\r\nnu = 0.29;\r\nG = 11.6e9; %Pa\r\nE = 208e9; %Pa\r\ndensity = 8.19; %g/cm^3\r\nsh_exp = 0.075; %strain-hardening exponent\r\nsh_coeff = 1.845; %strain-hardening coefficient\r\nEtWR_corr = 2.540e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% aluminum alloy (6061-T6)%^\u0026\r\nS_y = 241e6; %Pa\r\nS_u = 300e6; %Pa\r\ne_y = 0.0035;\r\ne_u = 0.15;\r\nnu = 0.33;\r\nG = 26e9; %Pa\r\nE = 68.9e9; %Pa\r\ndensity = 2.7; %g/cm^3\r\nsh_exp = 0.042; %strain-hardening exponent\r\nsh_coeff = 0.325; %strain-hardening coefficient\r\nEtWR_corr = 2.552e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% copper\r\nS_y = 70e6; %Pa\r\nS_u = 220e6; %Pa\r\ne_y = 0.00054;\r\ne_u = 0.48;\r\nnu = 0.34;\r\nG = 48e9; %Pa\r\nE = 130e9; %Pa\r\ndensity = 8.92; %g/cm^3\r\nsh_exp = 0.44; %strain-hardening exponent\r\nsh_coeff = 0.304; %strain-hardening coefficient\r\nEtWR_corr = 1.457e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% rhenium\r\nS_y = 317e6; %Pa\r\nS_u = 1130e6; %Pa\r\ne_y = 0.000685;\r\ne_u = 0.24;\r\nnu = 0.3;\r\nG = 178e9; %Pa\r\nE = 463e9; %Pa\r\ndensity = 21.02; %g/cm^3\r\nsh_exp = 0.353; %strain-hardening exponent\r\nsh_coeff = 1.870; %strain-hardening coefficient\r\nEtWR_corr = 2.203e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6)\r\nS_y = 82e6; %Pa\r\nS_u = 82e6; %Pa\r\ne_y = 0.0265;\r\ne_u = 0.45;\r\nnu = 0.41;\r\nG = 2.8e9; %Pa\r\nE = 3.1e9; %Pa\r\ndensity = 1.14; %g/cm^3\r\nEtWR_corr = 0.272e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6) reinforced with 45wt.% glass fiber\r\nS_y = 230e6; %Pa\r\nS_u = 230e6; %Pa\r\ne_y = 0.016;\r\ne_u = 0.016;\r\nnu = 0.35;\r\nG = 13.0e9; %Pa\r\nE = 14.5e9; %Pa\r\ndensity = 1.51; %g/cm^3\r\nEtWR_corr = 0.960e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% diamond\r\nS_y = 1200e6; %Pa\r\nS_u = 1200e6; %Pa\r\ne_y = 0.001;\r\ne_u = 0.001;\r\nnu = 0.20;\r\nG = 478e9; %Pa\r\nE = 1200e9; %Pa\r\ndensity = 3.51; %g/cm^3\r\nEtWR_corr = 34.19e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tE = 114e9; %Pa\r\n\t\tdensity = 4.51; %g/cm^3\r\n\t\tEtWR_corr = 2.528e10;\r\n\tcase 2\r\n\t\tE = 68.9e9; %Pa\r\n\t\tdensity = 2.7; %g/cm^3\r\n\t\tEtWR_corr = 2.552e10;\r\n\tcase 3\r\n\t\tE = 200e9; %Pa\r\n\t\tdensity = 7.85; %g/cm^3\r\n\t\tEtWR_corr = 2.548e10;\r\n\tcase 4\r\n\t\tE = 1200e9; %Pa\r\n\t\tdensity = 3.51; %g/cm^3\r\n\t\tEtWR_corr = 34.19e10;\r\nend\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tE = 68.9e9; %Pa\r\n\t\tdensity = 2.7; %g/cm^3\r\n\t\tEtWR_corr = 2.552e10;\r\n\tcase 2\r\n\t\tE = 3.1e9; %Pa\r\n\t\tdensity = 1.14; %g/cm^3\r\n\t\tEtWR_corr = 0.272e10;\r\n\tcase 3\r\n\t\tE = 14.5e9; %Pa\r\n\t\tdensity = 1.51; %g/cm^3\r\n\t\tEtWR_corr = 0.960e10;\r\n\tcase 4\r\n\t\tE = 208e9; %Pa\r\n\t\tdensity = 8.19; %g/cm^3\r\n\t\tEtWR_corr = 2.540e10;\r\nend\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tE = 208e9; %Pa\r\n\t\tdensity = 8.19; %g/cm^3\r\n\t\tEtWR_corr = 2.540e10;\r\n\tcase 2\r\n\t\tE = 463e9; %Pa\r\n\t\tdensity = 21.02; %g/cm^3\r\n\t\tEtWR_corr = 2.203e10;\r\n\tcase 3\r\n\t\tE = 130e9; %Pa\r\n\t\tdensity = 8.92; %g/cm^3\r\n\t\tEtWR_corr = 1.457e10;\r\n\tcase 4\r\n\t\tE = 3.1e9; %Pa\r\n\t\tdensity = 1.14; %g/cm^3\r\n\t\tEtWR_corr = 0.272e10;\r\nend\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":212,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2015-03-30T19:40:12.000Z","updated_at":"2026-03-10T20:42:38.000Z","published_at":"2015-03-30T19:40:12.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\u003eSimilar to the previous problem, materials may be characterized by their stiffness-to-weight ratio, which is the elastic modulus divided by density. Write a function to calculate this ratio for a material provided its elastic modulus and density.\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\u003ePrevious problem: 4 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8051-stress-strain-properties-4\\\"\u003e\u003cw:r\u003e\u003cw:t\u003estrength-to-weight ratio\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem: 6 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8053-stress-strain-properties-6\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eabsorbed strain energy\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\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":8047,"title":"Weighted Gold/Silver Standard","description":"Building off of the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8045-gold-standard Gold Standard\u003e and \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8046-gold-silver-standard Gold/Silver Standard\u003e problems, let's make a weighted currency convertor. The same data for gold value and silver-to-gold ratio will be provided in the function template.\r\n\r\nFor this problem, based on a historical year (HY) and a historical value (HV) in dollars, calculate the current value using the gold (CVG) and silver (CVS) references; see the referenced problems for details and examples of those individual problems. In this case, you will be provided a weighting that will range from 0 to 1, where 0 indicates complete weighting by gold and 1 indicates complete weighting by silver. Remember to round the result to two decimal places. If HY is outside of the historical data range, return NaN.\r\n\r\nAs an example, with HY = 2000, HV = 1000, and wt = 0.4:\r\n\r\n* CVG = $4534.09 (gold standard)\r\n* CVS = $3822.36 (silver standard)\r\n* CV = (1-0.4)*4534.09 + 0.4*3822.36 = $4249.40.","description_html":"\u003cp\u003eBuilding off of the \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8045-gold-standard\"\u003eGold Standard\u003c/a\u003e and \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8046-gold-silver-standard\"\u003eGold/Silver Standard\u003c/a\u003e problems, let's make a weighted currency convertor. The same data for gold value and silver-to-gold ratio will be provided in the function template.\u003c/p\u003e\u003cp\u003eFor this problem, based on a historical year (HY) and a historical value (HV) in dollars, calculate the current value using the gold (CVG) and silver (CVS) references; see the referenced problems for details and examples of those individual problems. In this case, you will be provided a weighting that will range from 0 to 1, where 0 indicates complete weighting by gold and 1 indicates complete weighting by silver. Remember to round the result to two decimal places. If HY is outside of the historical data range, return NaN.\u003c/p\u003e\u003cp\u003eAs an example, with HY = 2000, HV = 1000, and wt = 0.4:\u003c/p\u003e\u003cul\u003e\u003cli\u003eCVG = $4534.09 (gold standard)\u003c/li\u003e\u003cli\u003eCVS = $3822.36 (silver standard)\u003c/li\u003e\u003cli\u003eCV = (1-0.4)*4534.09 + 0.4*3822.36 = $4249.40.\u003c/li\u003e\u003c/ul\u003e","function_template":"function [CV] = gold_silver_weighted_standard(HY,HV,wt)\r\n\r\nY = 1791:2014;\r\nGV = [19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 20.1, 21.64, 20.95, 19.46, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.94, 20.69, 20.69, 21.64, 20.86, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.7, 20.67, 20.67, 20.67, 20.67, 23.42, 30.02, 42.03, 32.52, 29.13, 28.57, 28.88, 27.49, 23.75, 23.09, 23.24, 23.52, 22.99, 23.75, 23.05, 21.66, 20.84, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 24.44, 34.94, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 39.26, 41.51, 36.41, 41.25, 58.6, 97.81, 159.74, 161.49, 125.32, 148.31, 193.55, 307.5, 612.56, 459.64, 375.91, 424, 360.66, 317.66, 368.24, 447.95, 438.31, 382.58, 384.93, 363.29, 344.97, 360.91, 385.42, 385.5, 389.09, 332.39, 295.24, 279.91, 280.1, 272.22, 311.33, 364.8, 410.52, 446, 606, 699, 874, 975, 1227, 1572, 1700, 1415, 1270];\r\nSR = [15.05, 15.17, 15, 15.37, 15.55, 15.65, 15.41, 15.59, 15.74, 15.68, 15.46, 15.26, 15.41, 15.41, 15.79, 15.52, 15.43, 16.08, 15.96, 15.77, 15.53, 16.11, 16.25, 15.04, 15.26, 15.28, 15.11, 15.35, 15.33, 15.62, 15.95, 15.8, 15.84, 15.82, 15.7, 15.76, 15.74, 15.78, 15.78, 15.82, 15.72, 15.73, 15.93, 15.73, 15.8, 15.72, 15.83, 15.85, 15.62, 15.62, 15.7, 15.87, 15.93, 15.85, 15.92, 15.9, 15.8, 15.85, 15.78, 15.7, 15.46, 15.59, 15.33, 15.33, 15.38, 15.38, 15.27, 15.38, 15.19, 15.29, 15.5, 15.35, 15.37, 15.37, 15.44, 15.43, 15.57, 15.59, 15.6, 15.57, 15.57, 15.63, 15.93, 16.16, 16.64, 17.75, 17.2, 17.92, 18.39, 18.05, 18.25, 18.2, 18.64, 18.61, 19.41, 20.78, 21.1, 22, 22.1, 19.75, 20.92, 23.72, 26.49, 32.56, 31.6, 30.59, 34.2, 35.03, 34.36, 33.33, 34.68, 39.15, 38.1, 35.7, 33.87, 30.54, 31.24, 38.64, 39.74, 38.22, 38.33, 33.62, 34.19, 37.37, 40.48, 30.78, 24.61, 21, 18.44, 20.28, 32.76, 30.43, 31.69, 30.8, 29.78, 33.11, 36.47, 35.34, 38.78, 53.74, 71.25, 73.29, 69.83, 72.36, 54.19, 77.09, 77.44, 80.39, 88.84, 99.76, 99.73, 90.57, 77.67, 77.67, 67.4, 43.67, 48.73, 47.07, 48.61, 47.14, 39.12, 41.16, 41.04, 41.01, 39.24, 38.5, 38.5, 39.27, 38.34, 38.27, 37.82, 32.22, 27.34, 27.04, 27.04, 27.04, 22.56, 18.29, 23.16, 20.54, 26.66, 34.75, 38.21, 33.9, 36.51, 28.76, 32.05, 35.8, 27.69, 29.66, 43.65, 47.24, 37.03, 44.26, 51.68, 67.25, 63.84, 66.95, 69.49, 79.78, 89.83, 87.47, 83.85, 72.79, 74.78, 74.89, 67.91, 53.24, 53.26, 55.96, 61.95, 67.32, 74.22, 61.3, 60.7, 52.2, 51.91, 58.17, 66.27, 60.64, 44.75, 53.58, 59.31, 66.38];\r\n\r\nCV = 1;\r\n\r\nend\r\n","test_suite":"%% current check\r\nHY = 2014; HV = 1270; wt = 0.5; CV_corr = 1270;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%% out-of-range check 1\r\nHY = 500; HV = 50; wt = 0.5; CV_corr = NaN;\r\nassert(isnan(gold_silver_weighted_standard(HY,HV,wt)))\r\n\r\n%% out-of-range check 2\r\nHY = 2500; HV = 5000; wt = 0.5; CV_corr = NaN;\r\nassert(isnan(gold_silver_weighted_standard(HY,HV,wt)))\r\n\r\n%%\r\nHY = 2010; HV = 1000; wt = 0.5; CV_corr = 990.29;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 2005; HV = 1000; wt = 0.5; CV_corr = 2725.7;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 2000; HV = 1000; wt = 0.5; CV_corr = 4178.23;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1995; HV = 1000; wt = 0.5; CV_corr = 3502.87;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1990; HV = 1000; wt = 0.5; CV_corr = 3632.31;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1950; HV = 1000; wt = 0.5; CV_corr = 31027.07;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1900; HV = 1000; wt = 0.5; CV_corr = 46146.07;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1850; HV = 1000; wt = 0.5; CV_corr = 37986.86;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1800; HV = 1000; wt = 0.5; CV_corr = 40484.63;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 2000; HV = 1000;\r\nwt = randi(10)/10;\r\nswitch (wt*10)\r\n\tcase 0\r\n\t\tCV_corr = 4534.09;\r\n\tcase 1\r\n\t\tCV_corr = 4462.92;\r\n\tcase 2\r\n\t\tCV_corr = 4391.75;\r\n\tcase 3\r\n\t\tCV_corr = 4320.57;\r\n\tcase 4\r\n\t\tCV_corr = 4249.4;\r\n\tcase 5\r\n\t\tCV_corr = 4178.23;\r\n\tcase 6\r\n\t\tCV_corr = 4107.05;\r\n\tcase 7\r\n\t\tCV_corr = 4035.88;\r\n\tcase 8\r\n\t\tCV_corr = 3964.7;\r\n\tcase 9\r\n\t\tCV_corr = 3893.53;\r\n\tcase 10\r\n\t\tCV_corr = 3822.36;\r\nend\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1800; HV = 1000;\r\nwt = randi(10)/10;\r\nswitch (wt*10)\r\n\tcase 0\r\n\t\tCV_corr = 65497.68;\r\n\tcase 1\r\n\t\tCV_corr = 60495.07;\r\n\tcase 2\r\n\t\tCV_corr = 55492.46;\r\n\tcase 3\r\n\t\tCV_corr = 50489.85;\r\n\tcase 4\r\n\t\tCV_corr = 45487.24;\r\n\tcase 5\r\n\t\tCV_corr = 40484.63;\r\n\tcase 6\r\n\t\tCV_corr = 35482.02;\r\n\tcase 7\r\n\t\tCV_corr = 30479.41;\r\n\tcase 8\r\n\t\tCV_corr = 25476.8;\r\n\tcase 9\r\n\t\tCV_corr = 20474.19;\r\n\tcase 10\r\n\t\tCV_corr = 15471.58;\r\nend\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":50,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":30,"created_at":"2015-03-30T16:47:31.000Z","updated_at":"2026-03-27T06:22:48.000Z","published_at":"2015-03-30T16:47:31.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\u003eBuilding off of the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8045-gold-standard\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGold Standard\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:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8046-gold-silver-standard\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGold/Silver Standard\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e problems, let's make a weighted currency convertor. The same data for gold value and silver-to-gold ratio will be provided in the function template.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor this problem, based on a historical year (HY) and a historical value (HV) in dollars, calculate the current value using the gold (CVG) and silver (CVS) references; see the referenced problems for details and examples of those individual problems. In this case, you will be provided a weighting that will range from 0 to 1, where 0 indicates complete weighting by gold and 1 indicates complete weighting by silver. Remember to round the result to two decimal places. If HY is outside of the historical data range, return NaN.\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\u003eAs an example, with HY = 2000, HV = 1000, and wt = 0.4:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCVG = $4534.09 (gold standard)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCVS = $3822.36 (silver standard)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCV = (1-0.4)*4534.09 + 0.4*3822.36 = $4249.40.\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:\"weight\"","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:\"weight\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"weight\"","","\"","weight","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f534b00cee0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f534b00ce40\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f534b00c260\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f534b00d160\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f534b00d0c0\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f534b00d020\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f534b00cf80\u003e":"tag:\"weight\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f534b00cf80\u003e":"tag:\"weight\""},"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:\"weight\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"weight\"","","\"","weight","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f534b00cee0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f534b00ce40\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f534b00c260\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f534b00d160\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f534b00d0c0\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f534b00d020\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f534b00cf80\u003e":"tag:\"weight\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f534b00cf80\u003e":"tag:\"weight\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":8051,"difficulty_rating":"easy"},{"id":8052,"difficulty_rating":"easy"},{"id":8047,"difficulty_rating":"easy-medium"}]}}