04-12-2019, 12:20 PM
Hi.
TABLES and SEQUENCES have been present since the beginning of hp-prime, but there is a problem when creating tables because the position (a, b) is rewritten to the algebraic form of a complex number a+b*i
Steps to reproduce the problem.
tbl3 := [up] [copy] [enter]
matrix( tbl2 ) [enter] ok >
[[ 10, 1 ],[ 1, 7 ]]
matrix( tbl3 ) [enter] >
"matrix( tbl3 )
Error: Bad Argument Value"
I think a solution is that the tables are encoded the positions of the elements with [[x, y]] or [x,y] and not as (x, y)
/!\
[[x, y]] index in 1
[x,y] index in 0
tbl2 := table( mtr1 .+ 1 ) [enter] >
or
/////
Now with seq cmd
seq1:= 9,8,7 [enter] ok >
seq1[[3]] [enter] ok
7
[up] [copy] [enter] >
"Gen [int] Error: Bad Argument Type"
seq1[2] [enter] // index in 0
8 > 7
test on-line
TABLES and SEQUENCES have been present since the beginning of hp-prime, but there is a problem when creating tables because the position (a, b) is rewritten to the algebraic form of a complex number a+b*i
Steps to reproduce the problem.
PHP Code:
1: mtr1 := [[ 9, 0 ],[ 0, 6 ]] [enter] ok
2: tbl2 := table( mtr1 .+ 1 ) [enter] ok >
table(
(1,1) = 10,
(1,2) = 1,
(2,1) = 1,
(2,2) = 7
)
tbl3 := [up] [copy] [enter]
PHP Code:
tbl3 := table(
1+i = 10,
1+2*i = 1,
2+i = 1,
2+2*i = 7
)
matrix( tbl2 ) [enter] ok >
[[ 10, 1 ],[ 1, 7 ]]
matrix( tbl3 ) [enter] >
"matrix( tbl3 )
Error: Bad Argument Value"
I think a solution is that the tables are encoded the positions of the elements with [[x, y]] or [x,y] and not as (x, y)
/!\
[[x, y]] index in 1
[x,y] index in 0
tbl2 := table( mtr1 .+ 1 ) [enter] >
PHP Code:
table(
[[1,1]] = 10,
[[1,2]] = 1,
[[2,1]] = 1,
[[2,2]] = 7
)
or
PHP Code:
table(
[0,0] = 10,
[0,1] = 1,
[1,0] = 1,
[1,1] = 7
)
/////
Now with seq cmd
seq1:= 9,8,7 [enter] ok >
seq1[[3]] [enter] ok
7
[up] [copy] [enter] >
"Gen [int] Error: Bad Argument Type"
seq1[2] [enter] // index in 0
8 > 7
test on-line