A bug and a related mini-challenge Message #1 Posted by Rodger Rosenbaum on 26 Mar 2008, 9:19 p.m.
I recently came across an unexpected bug in the HP48G (and descendants).
The LSQ command is supposed to return the solution with minimum Euclidean length when given an underdetermined system (with an infinite number of solutions).
Given system A*x=B, with A:
[[ 1 1 0 0 0 -1 ]
[ 1 0 -1 0 1 0 ]
[ 0 1 1 1 0 0 ]
[ 0 0 0 1 1 1 ]]
and B:
[[ 4 ]
[ 8 ]
[ 12 ]
[ 16 ]]
LSQ gives a solution:
[[6.99541284404 ]
[ 6.15137614679 ]
[ 2.84403669725 ]
[ 3.00458715596 ]
[ 3.84862385321 ]
[ 9.14678999083 ]]
with a Euclidean length of 14.2255745922. But this is not the minimum length solution. For example, [ 6 2 1 9 3 4 ]T is a solution and has Euclidean length 12.124355653, but there IS a solution with minimum possible length. The mini-challenge is to find it, using your HP48G, HP49G+ or HP50G. Don't use MATLAB or something similar until you give it a shot on your HP calculator.
I was very surprised by this bug. I've used LSQ a lot, and never before seen such behavior, and I have no idea what particular circumstance leads to the error. Maybe Werner can find out.
|