[HP-Prime xCAS] Arrays: Programming Commands (solution to the ambiguity)



#8

Hello

Case 0: Array + scalar or Array - scalar

Array + scalar => Array + ( scalar * identity(#Rows of Array))

Case 1: Array .+ scalar or Array .- scalar ( element to element)


Array .+ escalar => Array + Escalar * newArray( ones, m,n )

Array .- escalar => Array - Escalar * newArray( ones, m,n )

Edited: 30 Aug 2013, 6:33 p.m. after one or more responses were posted


#9

For the development group HP-PRIME calculator, or the author of xcas

solution to the ambiguity by using a single container [ data ]

Solution 1: use prefixes

list[ a, b, c ] or lst[ a, b, c ] or l[a, b, c ] is displayed in the history as { ... }

vector[ a, b, c ] or vtr[ a, b, c ] or v[a, b, c ] is displayed in the history as [ ... ]

matrix[[ a, b, c ]] or mtr[[ a, b, c ]] or m[[a, b, c ]] is displayed in the history as [[ ... ]]

poly[ a, b, c ] or poly[ a, b, c ] or p[ a, b, c ] is displayed in the history as < ... >

set[a, b, c ] or s[a, b, c] is displayed in the history as « ... » or ( )

Solution 2: use different characters

list => { a, b, c }

vector => [ a, b, c ]

matrix => [[ a, b, c ]]

poly => < a, b, c >

set => « a, b, c »


Thanks

PD; I want to eliminate all the Xs of the images that I posted =)


Edited: 29 Aug 2013, 9:36 a.m.


#10

You are overlooking that requiring use of *ANY* special character means that it is very difficult to use the software with a standard keyboard. It is simple to say "use a special e" for the exponent constant, or "use a special bracket for <xxx>", but that then requires someone on the computer (or tablet, or whatever) to select from a special character menu. This is not desirable. The software should be as portable to as many systems as possible.

TW

Edited: 29 Aug 2013, 8:20 p.m.


#11

A solution can be to use combination of characters Digraphs or Trigraphs for maintain code portability or export to other math languages

http://en.wikipedia.org/wiki/Digraphs_and_trigraphs

Di/TriGraph (Entry line or program) => Equivalent (internal)

:= => as a only symbol <= // pre store symbol x := 3 => x <= 3

=> => as a only symbol => post store symbol 3 => x

-> => arrow

#e or e_ => convert to exact EXP // history as e

#e. => 2.71828182846 // as approx e^1. ~ 2.71828182846

exp => #e() // exp function history as e^()

#i or i_ => exact imaginary unit internal

#i. or i_. => (0,1)

imagPart(3+4*#i) => 4*#i // history as 4*i

imagPart(3+4*i_) => 4*i_ // history as 4*i

< and > are on all keyboards (tablets, etc)

<< => « // begin to contain a new object as set

>> => » // end to contain a new object as set

&& => AND // true && false => false // history as true AND false

&. => and (bit to bit) // #b1011 &. #b10110 => #b00010 // history as #b1011 and #b10110

|| => OR

|. => or (bit to bit)

|object| => ABS( object ) // history as |object| // |[[-1, 3][8, -9]]| => [[1, 3][8, 9]]

||_ object _|| => norm( object ) // ||_[[-1, 3][8, -9]]_|| => norm([[1, 3][8, 9]]) => // 12.449899598

| => EVAL

!= => not equal symbol // #e != #e. => true

?= => equal (test) // history as = // x*y ?= y*x => true

== => (same) // history as == // x*y == y*x => false

=. => equal (element to element) [ a, b, c ] =. [ c, d, c ] => [ false, false, true ]

'_ => ^t (transpose) // [ a, b, c ]'_ => [ a, b, c ]^T => [ a; b; c ] (vertical or column vector)

// [[ a, b, c ]]'_ => [[ a, b, c ]]^T => [[ a] [b] [c] ]

object' => diff

object'' => diff(diff

<: => [ // for keyboards that do not have this type of parentheses

:> => ] // <: a, b, c :> => [ a, b, c ]

<( => {

)> => } // ( : a, b, c : ) => { a, b, c }

<_ => angle // rectCoo( [ 5, <_53 ] ) => [ 3, 4 ]

Others

!| => NOR

!& => NAND

%| => XOR

union => UNION SYMBOL

intersect => INTERSECT SYMBOL

etc


Edited: 30 Aug 2013, 5:57 p.m. after one or more responses were posted


#12

Yes, that is a solution. However, all that has been done is force the user to learn a more complicated entry scheme in order to use the device/software. All design involves tradeoffs. I personally don't think forcing the user to learn a series of unique entries makes more sense then just saying "e and i are special commands, don't use them as variables" for example.

TW


#13

The common user does not have to learn anything (combination of symbols), all paste for templates or keyboard or catalog =) on history or entry line

for example

0:

for expert users or text input

integral(function, variable, ....)

for templates (normal user)

[]

integralSymbol []

[]

1:

abs( ... ) // for expert users or text input

with templates

| ... |

2: norm( ... ) or ||_ ... _|| // for expert users or text input

with templates

|| ... ||

/!\ abs(matrix) != norm(matrix),
ambuguity command HP-Prime

3: transpose( [...] ) or [...]'_ // for expert users or text input

with templates

[...]T

4: nroot( 3, -8)

with templates

3v -8 ¬

5: 3+4*i_ // for expert users or text input

with templates

3+4*i

/!\ [Shift]+[2] put the special symbol e on history or prg

6: e_^3 // for expert users or text input

with templates

e^3

7: [ [a], b, c ] for expert users or text input

with templates

....

8: [ 5, <_53 ] for expert users or text input

with templates

[ 5, AngleSymbol 53 ]

9:

true && false for expert users or text input

true AND false // normal user

10:

#b1011 &. #b10110 // advanced user

#b1011 and #b10110 // normal user

/!\

AND for logic expresion (uppercase)

and for bit to bit (lowercase)

11:

6 >= 7 // advanced user

with templates

6 (greater and equal symbol) 7

12:

x^y // text input

with templates

[]^[]

13:

diff(y(x))+y(x)=8 // text input

with templates

d(y)

¯¯¯¯ + y = 8

dx

etc ...

--------------------

HP-Prime currently accepts the following

|| => OR

&& => AND

>= => greater and equal

<= => minor and equal

!= => different

!object => NOT object

diff(y) => y'

inf => oo

REQUEST for HP-Prime Development Group HPDG: include more Di/TriGraph as previously proposed =)

-----------

TW >> I personally don't think forcing the user to learn a series of unique entries makes more sense then just saying "e and i are special commands, don't use them as variables" for example

-----------

[Shift]+[LN] put the special symbol e on history or prg

[Shift]+[2] put the special symbol i on history or prg

there is no problem!

e, i left free to be used as variables or symbols, counter, unit vector, matrix or vector element, coeficient etc ...

some examples

set1 := set[ a, e, i, o, u ]; set1 => [ a, e, i, o, u ] // set element

[[ a b c ] [ d e f ] [ g h i ]] // matrix element

poly1[ a b c d e ]; => a*x^4 + b*x^3 + c*x^2 + d*x^1 + e*x^0 // coeficient

for i=0 ... // counter

sigma( ... i=3, ... ) // counter

product( ... i=1, ... ) // counter

the standard basis vectors are often instead denoted i, j, k

i:= [ 1, 0, 0 ]

j:= [ 0, 1, 0 ]

k:= [ 0, 0, 1 ]


Edited: 2 Sept 2013, 9:33 p.m. after one or more responses were posted


#14

Some templates for HP_Prime


Possibly Related Threads...
Thread Author Replies Views Last Post
  [HP-PIRME] BUG Pretty Print, Solution: abs => |...|, ABS => ||...|| CompSystems 2 337 12-13-2013, 09:36 AM
Last Post: CompSystems
  Programming workaround for "prepend" HP PRIME Marek Russ 4 325 11-29-2013, 05:46 AM
Last Post: Marek Russ
  HP 50g - question about matrices arrays vectors etc. Sean Freeman 6 398 11-14-2013, 01:44 PM
Last Post: peacecalc
  hp prime - programming with lists giancarlo 3 289 11-10-2013, 02:13 AM
Last Post: Giancarlo
  XCas / Prime "solve" question Nigel J Dowrick 4 304 11-08-2013, 04:01 AM
Last Post: Nigel J Dowrick
  HP Prime Programming Tutorial #3: WHILE, INPUT, KILL, REPEAT, GETKEY Eddie W. Shore 5 397 11-07-2013, 12:25 AM
Last Post: Han
  HP Prime - programming bluesun08 2 236 11-04-2013, 04:31 PM
Last Post: bluesun08
  More undocumented programming limitations in the HP Prime Michael de Estrada 3 285 11-03-2013, 08:22 PM
Last Post: Michael de Estrada
  HP Prime questions: I/O and Meta programming Andy Gryc 2 260 10-31-2013, 11:22 PM
Last Post: Andy Gryc
  HP-Prime/Xcas: vector/list indexing fhub 6 400 10-27-2013, 04:52 PM
Last Post: fhub

Forum Jump: