Cody

# Problem 43129. Find the coefficients for numerical integration using Simpson's rule

Solution 1541516

Submitted on 27 May 2018 by bainhome
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
x = 1; y_correct = []; assert(isequal(sym_gen(x),y_correct))

[Warning: Integer operands are required for colon operator when used as index] [> In sym_gen (line 5) In ScoringEngineTestPoint1 (line 3) In solutionTest (line 3) In matlab.unittest.internal.executeCodeBlock (line 11) In matlab.unittest.internal.ScriptTestCaseProvider/evaluateTestSection (line 134) In matlab.unittest.internal.ScriptTestCaseProvider/runTestSection (line 128) In matlab.unittest.internal.ScriptTestCaseProvider>@(testCase)provider.runTestSection(testCase) (line 94) In matlab.unittest.FunctionTestCase/test (line 98) In matlab.unittest.TestRunner/evaluateMethodCore (line 841) In matlab.unittest.TestRunner/evaluateMethod (line 1141) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.plugins.TestRunnerPlugin/evaluateMethod (line 679) In scoringengine.OutputPlugin/evaluateMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/evaluateMethod (line 679) In scoringengine.FiguresPlugin/evaluateMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/evaluateMethodsOnTestContent (line 783) In matlab.unittest.TestRunner/runTestMethod (line 1137) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.plugins.TestRunnerPlugin/runTestMethod (line 633) In scoringengine.OutputPlugin/runTestMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/runTestMethod (line 633) In scoringengine.FiguresPlugin/runTestMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/runTest (line 1084) In matlab.unittest.TestRunner/repeatTest (line 471) In matlab.unittest.TestRunner/runSharedTestCase (line 427) In matlab.unittest.TestRunner/runTestClass (line 994) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/runTestSuite (line 931) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 250) In scoringengine.OutputPlugin/runTestSuite In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 250) In scoringengine.FiguresPlugin/runTestSuite In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 250) In matlab.unittest.plugins.DiagnosticsRecordingPlugin/runTestSuite (line 184) In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/run (line 295) In scoringengine.verifyCode In scoringengine.verifyCode In connector.internal.fevalMatlab In connector.internal.fevalJSON ]

2   Pass
x = 2; y_correct = [1 4 1]; assert(isequal(sym_gen(x),y_correct))

3   Pass
x = 3; y_correct = []; assert(isequal(sym_gen(x),y_correct))

[Warning: Integer operands are required for colon operator when used as index] [> In sym_gen (line 5) In ScoringEngineTestPoint3 (line 3) In solutionTest (line 7) In matlab.unittest.internal.executeCodeBlock (line 11) In matlab.unittest.internal.ScriptTestCaseProvider/evaluateTestSection (line 134) In matlab.unittest.internal.ScriptTestCaseProvider/runTestSection (line 128) In matlab.unittest.internal.ScriptTestCaseProvider>@(testCase)provider.runTestSection(testCase) (line 94) In matlab.unittest.FunctionTestCase/test (line 98) In matlab.unittest.TestRunner/evaluateMethodCore (line 841) In matlab.unittest.TestRunner/evaluateMethod (line 1141) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.plugins.TestRunnerPlugin/evaluateMethod (line 679) In scoringengine.OutputPlugin/evaluateMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/evaluateMethod (line 679) In scoringengine.FiguresPlugin/evaluateMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/evaluateMethodsOnTestContent (line 783) In matlab.unittest.TestRunner/runTestMethod (line 1137) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.plugins.TestRunnerPlugin/runTestMethod (line 633) In scoringengine.OutputPlugin/runTestMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/runTestMethod (line 633) In scoringengine.FiguresPlugin/runTestMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/runTest (line 1084) In matlab.unittest.TestRunner/repeatTest (line 471) In matlab.unittest.TestRunner/runSharedTestCase (line 427) In matlab.unittest.TestRunner/runTestClass (line 994) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/runTestSuite (line 931) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 250) In scoringengine.OutputPlugin/runTestSuite In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 250) In scoringengine.FiguresPlugin/runTestSuite In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 250) In matlab.unittest.plugins.DiagnosticsRecordingPlugin/runTestSuite (line 184) In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/run (line 295) In scoringengine.verifyCode In scoringengine.verifyCode In connector.internal.fevalMatlab In connector.internal.fevalJSON ]

4   Pass
x = 4; y_correct = [1 4 2 4 1]; assert(isequal(sym_gen(x),y_correct))

5   Pass
x = 5; y_correct = []; assert(isequal(sym_gen(x),y_correct))

[Warning: Integer operands are required for colon operator when used as index] [> In sym_gen (line 5) In ScoringEngineTestPoint5 (line 3) In solutionTest (line 11) In matlab.unittest.internal.executeCodeBlock (line 11) In matlab.unittest.internal.ScriptTestCaseProvider/evaluateTestSection (line 134) In matlab.unittest.internal.ScriptTestCaseProvider/runTestSection (line 128) In matlab.unittest.internal.ScriptTestCaseProvider>@(testCase)provider.runTestSection(testCase) (line 94) In matlab.unittest.FunctionTestCase/test (line 98) In matlab.unittest.TestRunner/evaluateMethodCore (line 841) In matlab.unittest.TestRunner/evaluateMethod (line 1141) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.plugins.TestRunnerPlugin/evaluateMethod (line 679) In scoringengine.OutputPlugin/evaluateMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/evaluateMethod (line 679) In scoringengine.FiguresPlugin/evaluateMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/evaluateMethodsOnTestContent (line 783) In matlab.unittest.TestRunner/runTestMethod (line 1137) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.plugins.TestRunnerPlugin/runTestMethod (line 633) In scoringengine.OutputPlugin/runTestMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/runTestMethod (line 633) In scoringengine.FiguresPlugin/runTestMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/runTest (line 1084) In matlab.unittest.TestRunner/repeatTest (line 471) In matlab.unittest.TestRunner/runSharedTestCase (line 427) In matlab.unittest.TestRunner/runTestClass (line 994) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/runTestSuite (line 931) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 250) In scoringengine.OutputPlugin/runTestSuite In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 250) In scoringengine.FiguresPlugin/runTestSuite In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 250) In matlab.unittest.plugins.DiagnosticsRecordingPlugin/runTestSuite (line 184) In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/run (line 295) In scoringengine.verifyCode In scoringengine.verifyCode In connector.internal.fevalMatlab In connector.internal.fevalJSON ]

6   Pass
x = 6; y_correct = [1 4 2 4 2 4 1]; assert(isequal(sym_gen(x),y_correct))

7   Pass
x = -2; y_correct = []; assert(isequal(sym_gen(x),y_correct))

8   Pass
x = -1; y_correct = []; assert(isequal(sym_gen(x),y_correct))

[Warning: Integer operands are required for colon operator when used as index] [> In sym_gen (line 5) In ScoringEngineTestPoint8 (line 3) In solutionTest (line 17) In matlab.unittest.internal.executeCodeBlock (line 11) In matlab.unittest.internal.ScriptTestCaseProvider/evaluateTestSection (line 134) In matlab.unittest.internal.ScriptTestCaseProvider/runTestSection (line 128) In matlab.unittest.internal.ScriptTestCaseProvider>@(testCase)provider.runTestSection(testCase) (line 94) In matlab.unittest.FunctionTestCase/test (line 98) In matlab.unittest.TestRunner/evaluateMethodCore (line 841) In matlab.unittest.TestRunner/evaluateMethod (line 1141) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.plugins.TestRunnerPlugin/evaluateMethod (line 679) In scoringengine.OutputPlugin/evaluateMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/evaluateMethod (line 679) In scoringengine.FiguresPlugin/evaluateMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/evaluateMethodsOnTestContent (line 783) In matlab.unittest.TestRunner/runTestMethod (line 1137) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.plugins.TestRunnerPlugin/runTestMethod (line 633) In scoringengine.OutputPlugin/runTestMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/runTestMethod (line 633) In scoringengine.FiguresPlugin/runTestMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/runTest (line 1084) In matlab.unittest.TestRunner/repeatTest (line 471) In matlab.unittest.TestRunner/runSharedTestCase (line 427) In matlab.unittest.TestRunner/runTestClass (line 994) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/runTestSuite (line 931) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 250) In scoringengine.OutputPlugin/runTestSuite In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 250) In scoringengine.FiguresPlugin/runTestSuite In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 250) In matlab.unittest.plugins.DiagnosticsRecordingPlugin/runTestSuite (line 184) In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/run (line 295) In scoringengine.verifyCode In scoringengine.verifyCode In connector.internal.fevalMatlab In connector.internal.fevalJSON ]