Question
Can someone write the Python Code for this please i will rate well if done in PYTHON. (below is the data that we are using)
Can someone write the Python Code for this please i will rate well if done in PYTHON. (below is the data that we are using)
-0.475858, 1.61655 -0.291753, 0.184802 -0.156001, 0.518786 -0.155835, 0.175825 -0.0830172, 0.716709 -0.0378482, -0.175242 -0.0354125, -0.419593 -0.031637, -0.175356 -0.0278986, 0.766967 -0.00824979, 1.288 0.0219349, -0.489762 0.0445145, 0.208203 0.054619, -0.882471 0.0622923, 0.0251381 0.0805425, -0.725215 0.127694, 0.665832 0.155061, -0.366929 0.156963, 0.908665 0.164728, -1.35282 0.170196, -1.54989 0.182544, 0.438095 0.198014, -0.198922 0.204006, 1.39479 0.204256, 0.256587 0.2087, 0.55308 0.227248, 1.46571 0.237809, -0.0645576 0.247094, 0.300832 0.265259, 0.525974 0.28106, 0.257571 0.291944, 0.0961804 0.29553, -0.31141 0.32966, -0.880397 0.335426, 0.240218 0.339811, -0.699955 0.352007, 0.346959 0.352245, 0.752489 0.353896, 1.0232 0.363696, 0.630955 0.369514, -0.343318 0.389491, 0.272933 0.416274, -0.0761403 0.438879, -0.19565 0.442245, 0.863891 0.455956, 0.701215 0.459631, 1.01267 0.471401, -0.23062 0.476601, 0.736797 0.482028, -1.01504 0.492712, -0.15063 0.501553, 0.57707 0.504194, -0.561413 0.513612, 0.475046 0.514642, 0.0298359 0.537014, 1.36812 0.556246, 0.0303942 0.565418, -0.772955 0.569736, 1.74316 0.570288, -1.62324 0.574182, -0.301873 0.603708, -0.201646 0.604698, 0.259001 0.60807, -1.08011 0.617414, 1.13921 0.619699, 0.582547 0.629067, 0.199976 0.631067, 0.111664 0.632339, -1.29451 0.650641, -1.84665 0.652468, 0.46195 0.659724, 0.592782 0.664545, -0.276916 0.677041, -0.829129 0.707553, -0.444252 0.720048, -0.117467 0.724264, 0.63162 0.726469, 0.782911 0.743541, 0.100915 0.744343, 0.3795 0.750823, 0.671069 0.75446, -1.77586 0.763351, 1.22417 0.770964, 0.857921 0.801134, 0.837987 0.804558, -0.40623 0.823405, -1.09426 0.824932, -0.0194408 0.875181, 0.283706 0.883165, -0.975963 0.908401, -0.478273 0.922053, -0.223029 0.940569, 0.387269 0.965179, 0.799455 0.97461, 0.671972 0.977467, 0.865337 0.992481, 0.19848 1.00795, 0.869344 1.00915, 0.198508 1.01216, -0.0396392 1.01474, 1.17165 1.0215, 0.601259 1.02399, -0.196502 1.03423, -0.00703115 1.04436, 0.112878 1.05487, -0.0304288 1.05688, -0.0447468 1.05772, -0.18548 1.06374, 0.546898 1.0644, 0.451331 1.06666, -0.239398 1.07713, 1.60915 1.09329, 1.26729 1.10045, -1.50021 1.11038, 1.6024 1.11381, 0.222943 1.11778, 1.2148 1.13897, -0.00049879 1.1507, 1.23201 1.15176, 1.37447 1.18651, 0.808371 1.19418, -1.4307 1.2029, 0.344255 1.20853, 0.386425 1.21044, -0.0697229 1.22825, 0.793256 1.23784, 0.490003 1.24596, -0.369613 1.25684, -0.0664069 1.26023, -0.190964 1.26877, 0.850827 1.28676, 0.688957 1.29723, 1.52758 1.30761, -0.383767 1.30917, 1.53511 1.31171, 3.07106 1.32682, 1.44999 1.32697, 0.667961 1.33334, 0.533207 1.33583, 1.20737 1.33844, 2.09274 1.37656, 3.02798 1.38306, 1.10122 1.38659, -0.337923 1.3957, 1.77001 1.40613, 0.831007 1.40773, 2.04402 1.41514, 1.53283 1.41625, 0.266911 1.41954, 1.5327 1.47261, 1.23653 1.47541, 0.871985 1.51488, -0.0839653 1.52653, 0.34107 1.53497, -0.272537 1.53633, 0.499573 1.54945, 1.85715 1.55192, 0.734371 1.56255, 0.878776 1.56258, 0.515282 1.57898, -0.834357 1.60519, 2.14334 1.60671, 0.424413 1.60911, 0.577861 1.61021, 1.71143 1.62784, 1.44509 1.6409, -0.348453 1.65598, 1.834 1.68474, 0.810788 1.69006, 1.01145 1.69131, 0.392798 1.69319, 0.0617622 1.69396, -0.0984828 1.69714, 0.850359 1.69977, 0.33061 1.7068, 1.96275 1.73336, 0.506072 1.73469, 0.631757 1.73499, 1.55557 1.77248, 0.021123 1.79774, 0.313264 1.79935, 1.04038 1.81299, 0.395002 1.81647, 1.7209 1.82256, 2.67554 1.82792, 0.173569 1.83953, 1.46099 1.84244, 2.71897 1.84818, 0.323806 1.84889, 1.50567 1.85323, 2.27154 1.88449, 0.198864 1.89307, -0.354981 1.90771, 0.267326 1.91078, 0.560273 1.91173, 1.15801 1.93374, 2.00083 1.95051, 0.89107 1.96911, 2.81366 1.97286, 0.698703 1.978, 1.07668 1.97919, 3.81328 1.99484, 0.34402 1.99703, 3.05189 2.00003, 1.48483 2.00469, 1.55315 2.01582, 3.86005 2.02309, 1.62729 2.03319, 2.17284 2.05445, 1.8063 2.05622, 3.06034 2.074, 1.37561 2.081, 3.54117 2.09842, 1.36911 2.10377, -0.0157141 2.11105, 0.842713 2.12117, 0.679113 2.12638, 2.03543 2.14053, 2.75783 2.15111, 2.27092 2.15634, 3.67081 2.16472, 2.42054 2.19123, 0.671507 2.20416, 2.26509 2.21113, 2.17692 2.2318, 3.05963 2.23907, 1.75696 2.26294, 3.19227 2.2689, 2.118 2.27414, 1.58254 2.29355, 3.75319 2.31937, 2.85552 2.32326, 2.96735 2.32352, 3.77348 2.32441, 1.46125 2.33289, 2.82011 2.33632, 2.11031 2.3483, 1.93379 2.35997, 2.18404 2.35998, 1.48224 2.37342, 3.19583 2.37377, 3.65416 2.37809, 2.55515 2.39246, 4.24572 2.41313, 4.39854 2.42044, 3.54897 2.4396, 3.77516 2.44384, 1.69782 2.46125, 2.97268 2.47485, 2.35463 2.51671, 2.40067 2.52227, 2.13835 2.5561, 3.96073 2.56344, 2.91309 2.56682, 2.51567 2.58266, 0.783549 2.58965, 2.744 2.59552, 1.99402 2.62515, 2.28695 2.63097, 2.52928 2.65281, 3.85287 2.6702, 2.58929 2.67054, 2.99672 2.6773, 4.1426 2.6836, 2.50559 2.70613, 3.16801 2.71037, 2.84195 2.72517, 1.05864 2.73656, 2.72256 2.74504, 3.13469 2.74559, 3.4531 2.7542, 3.36923 2.76056, 3.9635 2.76193, 3.33587 2.76786, 3.42609 2.80244, 2.40943 2.81958, 2.04301 2.83091, 2.43874 2.84685, 3.66902 2.87123, 2.90375 2.88588, 2.42132 2.89322, 4.18642 2.90047, 4.58287 2.90448, 4.37348 2.91556, 2.74219 2.95559, 2.20216 2.96382, 4.06924 2.96762, 3.989 3.00659, 3.13268 3.02966, 2.8094 3.03812, 3.7868 3.0423, 5.13436 3.04333, 1.68249 3.04784, 4.57819 3.06069, 4.83208 3.0624, 2.15816 3.12283, 3.87136 3.12611, 2.56791 3.16295, 3.64179 3.28843, 4.6277 3.60982, 4.8328
Problem #3 Find the least squares solution of the system Xm y using the Moore-Penrose pseudo inverse of X, X+, using the Singular Value Decomposition of X, print the solution, plot the solution yfumx + b on top of the data, and find out the time it takes Python to compute the solution. Follow these steps: a. Find the SVD of the matrix X, U, d, VT np.linalg.svd(X), and use it to compute X b. Solve for the slope, m, and y-intercept, b: [m, b] - X*y; print m and b. c. Plot the data again and the solution yismx+ b on the same figure. VD+viT Make sure you include time commands to find the CPU time it took to find the solution this way. [176]: | # Enter your code here m Ls 2.00164 b_IS 0.862736 tLs 0.00874805450439 L2residual# 33.4626034117 - Problem #3 Find the least squares solution of the system Xm y using the Moore-Penrose pseudo inverse of X, X+, using the Singular Value Decomposition of X, print the solution, plot the solution yfumx + b on top of the data, and find out the time it takes Python to compute the solution. Follow these steps: a. Find the SVD of the matrix X, U, d, VT np.linalg.svd(X), and use it to compute X b. Solve for the slope, m, and y-intercept, b: [m, b] - X*y; print m and b. c. Plot the data again and the solution yismx+ b on the same figure. VD+viT Make sure you include time commands to find the CPU time it took to find the solution this way. [176]: | # Enter your code here m Ls 2.00164 b_IS 0.862736 tLs 0.00874805450439 L2residual# 33.4626034117Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started