Strange miracles and wonders happen on the latest Vir Calc ver 2018 10 16 - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: Strange miracles and wonders happen on the latest Vir Calc ver 2018 10 16 (/thread-11711.html) |
Strange miracles and wonders happen on the latest Vir Calc ver 2018 10 16 - John P - 11-01-2018 03:22 AM I was trying to use size command in a program and when I used size({list}) it returned integer, but when I used size([vector]) i got {some integer}. Should not size for 1D lists/vectors return just an integer? After farther investigation I tried to see what is really going on and in a simple prgm: EXPORT test(a1,a2) BEGIN local s1:=size(a1), s2:=size(a2); return(s1,s2); END; I am getting the answer {3+2*i} , complex number where a1:={1,2,3}, a2:={1,2} or a1:=[1,2,3] and a2:=[1,2], it does not matter if a1 and/or a2 are lists with {} or with []. When I change the prgm test to: EXPORT test(a1,a2) BEGIN local s1:=size(a1), s2:=size(a2); local out; out:=[s1,s2]; return(out); END; and test({1,2},[1,2,3,4]} I get "Error: Invalid input", but when test({1,2},{1,2,3,4} I get [2,4]. Changing in test() out:=[,] to out:={s1,s2} gives the ans {numb,{numb}}, if for ex a1:={{...} and a2:=[...]. I hope somebody at HP or not should fix those inconsistencies: for 1D vector the return should be an integer and for 2D matrices the return should be {int1,int2} or [int1,int2] but not both mixed up and different for {2D} and [2D]. On top on that: using the latest Virtual Calc ver. 2018 10 16, the keys on my laptop get confuse for ex. the Backspace deletes to the right instead of to the left, the ENTER key as well does some strange 'magic' on VC. Hey, guys at HP what is going on? Is anybody out there in control or we are on autopilot? RE: Strange miracles and wonders happen on the latest Vir Calc ver 2018 10 16 - Tim Wessman - 11-01-2018 03:59 AM I suspect your CAS is stuck in "python" mode. Run "restart()" and that should reset your indexes to 1 based. As for the other, it sounds like your "shift" function is on. Just restart it.[/align] RE: Strange miracles and wonders happen on the latest Vir Calc ver 2018 10 16 - John P - 11-02-2018 04:28 AM Hello, Could anybody explain to me why: When DIM is executed in programs returns: 1.DIM({1,2})-->{1,1}, {1,2} is not list with 1 element, but with 2. {1,1} would be if the list was {{1}}. DIM({x,y})-->{1,1}, same as above. 2. DIM([1,2])-->{2}, OK for a list. DIM([x,y])-->{1,1}, same as in 1 above, {1,1} is wrong dimension for 1D vector or list. When DIM is executed in history, command line, it returns: 1. DIM({1,1})-->2, correct. 2. DIM([1,2])-->2, correct. 3. DIM({x,y})-->2, correct. 4. DIM([x,y])-->2, correct. 5. DIM([[1,2,3],[4,5,6]])-->[2,3], correct. 6. DIM({{1,2},{3,4}})-->[2,2],OK. matrix. 7. DIM({{1},{2,3,4}})-->{{1},{1,1,1}}, not OK it should be {2,{1,3}}. 8. DIM({[1,2],[3,4,5]})-->{{2},{3}}, looks OK. 9. DIM([[1],[2,3],[4,5,6]])-->Error:Syntax Error, OK. There is some logic the DIM behaves on the command line, but in programs the way DIM works is inconsistent mildly speaking. Could somebody who is responsible for the maintenance of HP CAS, I presume Mr. Parisse, explain why many commands behave in different way on the command line then while executed in programs. Logical answer would be very much appreciated. Thank you very much. |