Post Reply 
problem with table and seq data
04-12-2019, 12:20 PM (This post was last modified: 04-19-2019 02:27 PM by compsystems.)
Post: #1
problem with table and seq data
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.

PHP Code:
1mtr1 := [[ 9],[ 0]] [enterok

2
tbl2 := tablemtr1 .+ )  [enterok >

table(

   (
1,1) = 10,
   (
1,2) = 1,
   (
2,1) = 1,
   (
2,2) = 7



tbl3 := [up] [copy] [enter]

PHP Code:
tbl3 := table(

   
1+10,
   
1+2*1,
   
2+1,
   
2+2*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

LO SUFICIENTEMENTE BUENO ES ENEMIGO DE LA EXCELENCIA.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)