EXECON HELP (DoLIST ~= HP50 CMD) - 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: EXECON HELP (DoLIST ~= HP50 CMD) (/thread-6784.html) |
EXECON HELP (DoLIST ~= HP50 CMD) - compsystems - 09-03-2016 07:37 PM EXECON("&1+10",{1,2,3}) -> {11,12,13} // == {1,2,3} .+ 10 // Ok SEQUENCE, do each element of the list + 1 EXECON("&1-&2",{1,4,3,5}) -> {-3,1,-2} // Ok EXECON("&2-&1",{1,4,3,5}) -> {3,-1,2} // == {4-1, 3-4, 5-3} Ok SEQUENCE, do form element 2 - previous element EXECON("&2-&1",{1,2,3}, {4,5,6}) -> {3,3,3} // Ok SEQUENCE, do element 1 of list2 - element 1 of list1 EXECON("&1-&2",{1,2,3}, {4,5,6}) -> {-3,-3,-3} // Ok SEQUENCE, do element 1 of list1 - element 1 of list2 EXECON("(&1)*5",{1,2,3}) Returns {5,10, 15} // Ok EXECON("&11 *5",{1,2,3}) Returns {5,10, 15} 11 How this is interpreted? EXECON("&2 *5",{1,2,3}) Returns {10, 15} // Ok ({1,2,3}[2, ...]) .* 5 -> {2,3}*5 -> {10, 15} EXECON("&12 *5",{1,2,3}) Returns {10, 15} // Ok EXECON("&3 *5",{1,2,3}) Returns {15} // Ok EXECON("&4 *5",{1,2,3}) "Error: Invalid input" // Ok EXECON("&1 *5",[1,2,3]) Returns [5,10, 15] // Ok each element of the list * 5 EXECON("&2 *5",[1,2,3]) Returns [10] // ???????? EXECON("&12 *5",[1,2,3]) Returns [10] // ???????? -> [10, 15] why with bracketed [] return a different answer ???????? EXECON("&1+&2",{1,2,3}, {4,5,6}) -> {5,7,9} EXECON("&1+&2",{{1,2,3}, {4,5,6}}) -> {{5,7,9}} EXECON("&2 *5",{{1,2,3}, {4,5,6}}) returns {{20,25,30}} // {{1,2,3},{4,5,6}}[2, ...] -> {4,5,6} Ok element(2,...) EXECON("&12 *5",{{1,2,3}, {4,5,6}}) returns {{20,25,30}} 12 How this is interpreted? EXECON("&1 *5",{{1,2,3}, {4,5,6}}) -> {{5,10,15}, {20,25,30}} // {{1,2,3},{4,5,6}}[1, ...] -> {{1,2,3},{4,5,6}} EXECON("&1 =0",{1,2}) -> {0,0} ??? -> {1=0, 2=0} EXECON("&1+10",{a,b,c}) -> "Error: Syntax Error" =(, cmd CAS equivalent? RE: EXECON HELP - Didier Lachieze - 09-03-2016 08:29 PM (09-03-2016 07:37 PM)compsystems Wrote: EXECON("&1+10",{a,b,c}) -> "Error: Syntax Error" =(, cmd CAS equivalent? {a,b,c}+10 -> {a+10, b+10, c+10} RE: EXECON HELP (DoLIST ~= HP50 CMD) - compsystems - 09-03-2016 08:39 PM but an equivalent cmd to general symbolic expressions "functions" EXECON("&1-&2",{a,b,c,d}) -> {a-b, b-c, c-d} RE: EXECON HELP (DoLIST ~= HP50 CMD) - Didier Lachieze - 09-03-2016 09:32 PM I don't think there is a CAS command similar to EXECON. So no general function, each case needs to be coded specifically. For your example: EXECON("&1-&2",{a,b,c,d}) you can do in CAS: revlist(tail(revlist({a,b,c,d}-tail({a,b,c,d})))) RE: EXECON HELP (DoLIST ~= HP50 CMD) - compsystems - 09-04-2016 01:36 AM another example with numeric and symbolic elements =( hp-prime execon("(&2+&3)*&1",{1,2,3}, {4,5,6}, {7,8,9}) -> {11,26,45} previous is same ({4,5,6} .+ {7,8,9}) .* {1,2,3} -> {11,26,45} execon("(&2+&3)*&1",{a,b,c}, {d,e1,f}, {g,h,i1}) -> "Error: Syntax Error" =( EXECON("(&1)=0",{1,2}) -> {0,0} BUG? , ok -> {1=0, 2=0} hp48sx/gx - hp49g/49g+ - hp50g RPN {1,2,3} {4,5,6} {7,8,9} 3 « + * » DOLIST -> {11,26,45} {a,b,c} {d,e1,f} {g,h,i1} 3 « + * » DOLIST -> { 'a*(d+g)' 'b*(e1+h)' 'c*(f+i1)' } =) {1,2} 1 « 0 = » DOLIST - > { '1=0' '2=0' } RE: EXECON HELP (DoLIST ~= HP50 CMD) - compsystems - 09-04-2016 01:53 AM testing Matrix Applied Program/function, MAP CMD map({{1,2,3}, {4,5,6}, {7,8,9}}, x -> x+1 ) [enter] returns [{2,3,4},{5,6,7},{8,9,10}] map({{1,2,3}, {4,5,6}, {7,8,9}}, (x,y,z) -> (y+z)*x) ) [enter] returns "Error" Why? |