Cody

# Problem 44846. Just another norm problem (JANP)

Solution 1769634

Submitted on 2 Apr 2019 by William
• Size: 34
• 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
A=[ 1.000000000000 0.000000000000 0.000000000000 0.000000000000 ; 0.000000000000 1.000000000000 0.000000000000 0.000000000000 ; 0.000000000000 0.000000000000 1.000000000000 0.000000000000 ; 0.000000000000 0.000000000000 0.000000000000 1.000000000000 ]; [yc,yr]=sol(A); assert(abs(norm(A*yc,1)-norm(A,1)*norm(yc,1))<1e-12 && abs(norm(A*yr,inf)-norm(A,inf)*norm(yr,inf))<1e-12 );

2   Pass
A=[ 0.000000000000 0.000000000000 0.000000000000 ; 0.000000000000 0.000000000000 0.000000000000 ; 0.000000000000 0.000000000000 0.000000000000 ]; [yc,yr]=sol(A); assert(abs(norm(A*yc,1)-norm(A,1)*norm(yc,1))<1e-12 && abs(norm(A*yr,inf)-norm(A,inf)*norm(yr,inf))<1e-12 );

3   Pass
A=[ 1.000000000000 1.000000000000 1.000000000000 ; 1.000000000000 1.000000000000 1.000000000000 ; 1.000000000000 1.000000000000 1.000000000000 ]; [yc,yr]=sol(A); assert(abs(norm(A*yc,1)-norm(A,1)*norm(yc,1))<1e-12 && abs(norm(A*yr,inf)-norm(A,inf)*norm(yr,inf))<1e-12 );

4   Pass
A=[ 5.000000000000 -2.000000000000 -2.000000000000 ; -1.000000000000 -1.000000000000 5.000000000000 ; -4.000000000000 -1.000000000000 2.000000000000 ]; [yc,yr]=sol(A); assert(abs(norm(A*yc,1)-norm(A,1)*norm(yc,1))<1e-12 && abs(norm(A*yr,inf)-norm(A,inf)*norm(yr,inf))<1e-12 );

5   Pass
A=[ 10.000000000000 2.000000000000 3.000000000000 -7.000000000000 -1.000000000000 1.000000000000 7.000000000000 -2.000000000000 5.000000000000 10.000000000000 ; -1.000000000000 6.000000000000 10.000000000000 7.000000000000 10.000000000000 -8.000000000000 -6.000000000000 10.000000000000 0.000000000000 4.000000000000 ; 9.000000000000 -3.000000000000 -5.000000000000 7.000000000000 2.000000000000 9.000000000000 -3.000000000000 10.000000000000 3.000000000000 -7.000000000000 ; -9.000000000000 -5.000000000000 7.000000000000 -2.000000000000 7.000000000000 8.000000000000 0.000000000000 3.000000000000 8.000000000000 -9.000000000000 ; 3.000000000000 -3.000000000000 4.000000000000 -1.000000000000 -4.000000000000 -1.000000000000 -3.000000000000 8.000000000000 -6.000000000000 3.000000000000 ; 7.000000000000 2.000000000000 -5.000000000000 2.000000000000 3.000000000000 6.000000000000 6.000000000000 -1.000000000000 -2.000000000000 2.000000000000 ; -5.000000000000 7.000000000000 0.000000000000 5.000000000000 2.000000000000 -7.000000000000 10.000000000000 3.000000000000 10.000000000000 10.000000000000 ; 9.000000000000 -4.000000000000 -2.000000000000 5.000000000000 10.000000000000 3.000000000000 -6.000000000000 10.000000000000 -1.000000000000 5.000000000000 ; 6.000000000000 -1.000000000000 2.000000000000 6.000000000000 -8.000000000000 -4.000000000000 -5.000000000000 2.000000000000 4.000000000000 4.000000000000 ; 7.000000000000 8.000000000000 7.000000000000 -2.000000000000 1.000000000000 -1.000000000000 5.000000000000 9.000000000000 9.000000000000 1.000000000000 ]; [yc,yr]=sol(A); assert(abs(norm(A*yc,1)-norm(A,1)*norm(yc,1))<1e-12 && abs(norm(A*yr,inf)-norm(A,inf)*norm(yr,inf))<1e-12 );

6   Pass
A=[ -1.548477864976 -1.754301530936 0.494943144464 0.279045918708 0.192101558519 -0.596873784956 -1.359428021431 -0.672560081843 0.730050867444 0.463124194931 ; 1.863159633130 -0.363808954647 0.908594854358 0.597093730506 0.992332288991 -1.520646325613 0.970506681969 0.736462181575 -0.983511780519 -0.612630024220 ; 0.134026621819 -0.627094005626 -1.154218834769 0.244716707806 0.576244193779 0.671841600663 0.143639810487 -1.069960692800 0.052031556718 2.244399810639 ; -1.546002573826 0.440150252714 1.257555517431 -0.118346511075 1.305783771558 0.022844290056 0.082603591158 0.334715119526 0.877599372595 0.072347608359 ; 0.433282396192 -1.502641128909 1.452532416739 -1.289407881945 -0.729305831866 -1.177788586254 0.716664014558 0.411882595255 1.014141040942 0.865514396303 ; 0.102954219987 -0.208235444350 -2.076811485163 0.057563641729 -0.864574687578 -0.334578164100 1.193483862005 0.154120187534 -0.084348410787 -0.415696466596 ; -0.570346099877 -1.505125459583 -0.176488004067 -0.520932887272 -0.094920991407 -1.829455208608 -1.071061918746 0.554570697670 -1.853531576346 -1.114938105926 ; 0.493062156694 1.809740822675 -0.652082191476 -1.279026891780 1.383213915568 0.429989596952 1.318902209313 -1.172845688456 -1.096820709859 0.685252427933 ; -0.707513213508 -0.116972567752 0.156533803693 -0.056227231500 1.303681373529 -0.173993462314 -1.210003141195 1.007586685962 0.218627627525 1.037673215279 ; -1.348025035971 1.226208985170 -0.850225794307 -0.209680283172 -0.125812180556 1.631242419289 -1.074114901773 0.113520280110 0.794245850720 1.822211528431 ]; [yc,yr]=sol(A); assert(abs(norm(A*yc,1)-norm(A,1)*norm(yc,1))<1e-12 && abs(norm(A*yr,inf)-norm(A,inf)*norm(yr,inf))<1e-12 );

7   Pass
A=[ -0.204465803835 0.071829636229 0.408525898848 0.322326222185 -0.173755426940 0.115288242215 0.081491252368 -0.429786476013 0.233742133263 -0.376139492853 ; -0.348154277686 -0.213981727501 0.247196944131 0.222902973268 0.473013623893 0.083132968089 0.437676879075 -0.430721027432 0.150530624455 -0.032589973226 ; 0.347910522314 0.199133559301 -0.239488492916 0.425858038017 -0.134967374694 0.198253926627 -0.452212707615 -0.363992611380 0.016270565774 0.156694003304 ; 0.284854591093 0.296257943282 0.189637840074 -0.007361401538 -0.190850381104 -0.470667657246 -0.446022340830 0.288891319657 -0.173611864911 -0.209814433367 ; -0.229168497849 -0.058410943849 -0.368169334524 0.154882898450 -0.379087615419 0.027882687739 -0.479381965880 -0.407601542076 0.161776196779 0.254536639716 ; -0.272189295184 -0.053784388309 -0.376499167680 0.390123477962 0.415765704041 -0.467927153580 0.181478514196 -0.262131207993 -0.382434515378 0.058118051359 ; -0.178976782911 -0.034337591635 -0.309097146756 0.038525574469 -0.364521794318 0.327142322836 0.098628526633 -0.256352087383 -0.352182585818 -0.072207404452 ; 0.329561804399 -0.220960812725 -0.354267900504 -0.217794835442 -0.167882108172 -0.160013793518 -0.385969965484 -0.395177787341 -0.480235336271 -0.232805942726 ; 0.322182194601 0.175375318417 0.085043615269 0.475957517880 0.397479892400 0.346710958881 0.296245350726 0.358352760229 0.464291730300 0.253736074133 ; 0.070682850482 0.403664526364 -0.426638309920 -0.463574484475 -0.000351222153 -0.253930432894 0.117850587139 0.198199766180 0.470372902013 0.398376325006 ]; [yc,yr]=sol(A); assert(abs(norm(A*yc,1)-norm(A,1)*norm(yc,1))<1e-12 && abs(norm(A*yr,inf)-norm(A,inf)*norm(yr,inf))<1e-12 );

8   Pass
A=[ -0.683155520034 0.205973515879 1.185136527637 0.623136602023 0.182548032547 -0.899872414722 -0.499484267145 0.059866715598 -0.802763541778 1.469239755597 ; -0.100640459770 -0.475047618736 -0.337897222864 1.196559944153 1.248465055626 1.032755789355 0.539698531047 1.485115333675 -0.550422521284 -0.690581117268 ; -0.936331330036 0.593076762211 -0.823072697067 0.212830944163 -0.478833770250 -0.818153068301 -0.345943245369 -0.328822451874 3.127706832164 0.102652441231 ; 0.364816843362 -0.547259617943 -0.917476835534 -0.074715282122 0.263271685292 -0.777441745990 -0.989126911272 0.002847463543 -0.890134493916 -0.825348395625 ; -0.371072365852 -0.774817193105 -0.303302383004 -0.134297061659 0.862901370759 -0.914311484369 -0.286476959201 -0.698191287960 -0.337139622877 -0.010394502883 ; -0.953699348316 -0.310249150102 0.281533985358 0.166435052550 6.325291572406 0.985560320927 -0.635974119994 -0.355147935269 -0.392152953390 -0.811517829575 ; 0.317710770667 -0.570465743929 -0.573086450932 -0.634490677504 0.260206644263 -0.316272945517 -0.111863753192 -0.782491637963 -0.499854157555 0.734328861654 ; 0.385955936034 -0.771787354454 -0.913677989489 1.387360789836 -0.403636231649 -0.096029264640 2.358806503611 -0.797775093994 -0.726136960482 1.043921042539 ; -0.924923719445 0.455113955885 -0.326340600147 -0.088917230708 -0.861774397080 0.751161849438 0.228157729586 0.663516758210 -0.843751805783 -0.872034327032 ; 1.679720087047 -0.490571630344 -0.973852600618 0.220167215369 2.164069855507 -0.446934036873 -0.778656998944 1.089948896178 -0.039936174256 2.121768885937 ]; [yc,yr]=sol(A); assert(abs(norm(A*yc,1)-norm(A,1)*norm(yc,1))<1e-12 && abs(norm(A*yr,inf)-norm(A,inf)*norm(yr,inf))<1e-12 );