Cody

# Problem 45374. Hanging cable - 02

Solution 2289216

Submitted on 17 May 2020 by Binbin Qi
• Size: 106
• This is the leading solution.
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
assert(abs(cable_03([50,70],140)-55.4172)<0.0001)

[Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 324) In cable_03 (line 5) In ScoringEngineTestPoint1 (line 1) In solutionTest (line 3)]

2   Pass
assert(abs(cable_03([80,70],160)-35.4678)<0.0001)

[Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 324) In cable_03 (line 5) In ScoringEngineTestPoint2 (line 1) In solutionTest (line 5)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 330) In cable_03 (line 5) In ScoringEngineTestPoint2 (line 1) In solutionTest (line 5)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 324) In cable_03 (line 5) In ScoringEngineTestPoint2 (line 1) In solutionTest (line 5)]

3   Pass
assert(isequal(cable_03([80,70],150),0))

[Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 324) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 330) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 324) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 330) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 324) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 330) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 324) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 330) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 324) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 330) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 324) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 330) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 324) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 330) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 324) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 330) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 324) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 330) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 324) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 330) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 324) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 330) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 324) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 330) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 324) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2),x1(a),x2(a)) (line 4) In cable_03>@(a)(f(a)-L).^2 (line 5) In fminsearch (line 330) In cable_03 (line 5) In ScoringEngineTestPoint3 (line 1) In solutionTest (line 7)] [Warning: Infinite or Not-a-Number value encountered.] [> In integralCalc/midpArea (line 397) In integralCalc (line 105) In integral (line 88) In cable_03>@(a)integral(@(x)sqrt(1+sinh(x/a).^2...

4   Pass
assert(abs(cable_03([50 100],1000)-984.5341)<0.0001)

5   Pass
assert(abs(cable_03([500 100],1000)-721.5116)<0.0001)