HP Forums
Software 2.1.14558 (Beta): First Impressions - 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: Software 2.1.14558 (Beta): First Impressions (/thread-16813.html)



Software 2.1.14558 (Beta): First Impressions - Eddie W. Shore - 04-26-2021 04:59 AM

First, thank you HP Team! Thank you Tim and Cyrille!

NEW COMMANDS

If I am understanding correctly, the Resources command returns a graphic object?

I like the Intelligent Math mode. If that box is checked, the Prime will prioritize returning results exactly in Home Mode. Unchecked, all results are floating point (the default mode in programming). My fingers are crossed that a system variable, like HAngle or HFormat, is created for Intelligent mode.

I was excited when I learned about Go To in programming editing mode. However, it is not the GOTO command I thought it was, but allows you to jump to any line in programming mode. Still useful. Also, there are line markers in the PPL programming mode.

Below are demos of the several of the new commands.

TERMINAL

Code:
EXPORT TERMDEMO()
BEGIN
// Demo of Terminal command
// HP Prime 4.22.21 Beta
// 2021-04-26 EWS

// storage by list
{'A','B','C'}:={√2,√3,√5};

// initial screen
PRINT(A);
PRINT(B);
PRINT(C);
// add a wait after each step

// change terminal line 3 
// to √8
Terminal(3):=√8;
// a row separates new from old

END;

There are lot more things that can be done with terminal: examples include clear the terminal screen and change the line's color.

PRINT2D

I think is the my favorite new command so far. PRINT2D prints textbook expressions on to the terminal, and allows for strings to be displayed in different font sizes, colors, and styles.

Code:
EXPORT PTWODEMO()
BEGIN
// Demo of PRINT2D command
// HP Prime 4.22.21 Beta
// 2021-04-26 EWS


// clear before beginning
PRINT();
PRINT("PRINT vs PRINT2D");

// Print 2D objects
PRINT('√74');
PRINT2D('√74');

PRINT('85/36');
PRINT2D('85/36');

LOCAL n:=√88;
// evaluated always goes
// float
PRINT(n);
PRINT2D(n);

// unless QPI is applied
n:=QPI(n);
PRINT(n);
PRINT2D(n);

WAIT(0);

// 2D styles
// font size (3=med, 4=large)
// color
// style
PRINT();
PRINT2D("NONE",3,0,0);
PRINT2D("BOLD",3,0,1);
PRINT2D("UNDERLINE",3,0,2);
PRINT2D("STRIKED",3,0,3);
// centered and right not
// working? They are struck
// out.
PRINT2D("CENTER",3,0,4);
PRINT2D("RIGHT",3,0,4);
WAIT(0);

// now let's try colors
PRINT();
PRINT2D("Red",3,#FF0000h,0);
PRINT2D("Green",3,#008000h,0);
PRINT2D("Blue",3,#0000FFh,0);
PRINT2D("Yellow",3,#FFFF00h,0);
PRINT2D("Dark Gray",3,#404040h,0);

END;

CONST

This allows the user to define a constant. I did get a syntax error with this code though.

Code:
EXPORT CONSTDEMO()
BEGIN

// Demo of CONST command
// HP Prime 4.22.21 Beta
// 2021-04-26 EWS

// define and protect 
// constants
CONST A;
CONST B:=√3;

// but this gives a 
// syntax error.

END;

TEXTSIZE

There is no help file for TEXTSIZE (yet), TEXTSIZE returns the text as a two element list: { size in pixels for the x-axis, size in pixels for the y-axis }. Curiously, TEXTSIZE is found in the Cmds-Drawing-Cartesian menu instead of the Cms-Drawing-Pixels menu.

Code:
EXPORT TXTSZEDEMO()
BEGIN
// Demo of TEXTSIZE command
// HP Prime 4.22.21 Beta
// 2021-04-26 EWS

// no separate help page for
// now
// returns {x size, y size}
// in plxels
// TEXTSIZE(text,font number)

LOCAL s3,s4,s5,str:="demo";
PRINT();
PRINT("demo");
s3:=TEXTSIZE(str,3);
s4:=TEXTSIZE(str,4);
s5:=TEXTSIZE(str,5);
PRINT("Size 3: "+STRING(s3));
PRINT("Size 4: "+STRING(s4));
PRINT("Size 5: "+STRING(s5));

END;

I am fan of the Probability Wizard (Toolbox-Math-Probability-Probability Wizard), curious to know why this approach instead of making another standard app.

I have not gotten to the Python app yet, plan to do so within the coming week.


RE: Software 2.1.14558 (Beta): First Impressions - cyrille de brébisson - 04-26-2021 09:46 AM

Hello,

>Resource
Resource allows you to read/write the resource part of a program.
Resource can contain a graphic object. In this case, G1:=Resource("name") allows you to get the data. This allows you to store graphical files in your program.
But it can also be binary data if you have, for example, a star position database...
Resource("name", start, end) allows you to read n bytes.

You can change a resource file, but it is not the main purpose...

Cyrille


RE: Software 2.1.14558 (Beta): First Impressions - compsystems - 04-26-2021 04:10 PM

the new CONST command does not allow compiling the code

Quote:Syntax:
[EXPORT] CONST Var1:=Val1[, Var2:=Val2, ... Var8:=Val8];

In a program, you can use the keyword CONST in front of global variable definition.
Any attempts to store a value in a variable so designated will result in a run time error. This allows you to protect a global variable from accidental modification by the user.

TERMINAL CMD (please more examples)
Quote:Syntax:

Terminal
Terminal(n)
Terminal(-n)
Terminal(0)
Terminal:={}
Terminal(n):= obj
Terminal(-n):= {obj, color, font, flags}
Terminal(0):= {visible, maxLines, xpos, ypos}

The Terminal function gives you access to the terminal data and allows you to control it...
Terminal returns a list of all the items currently displayed by the terminal

Terminal(n) allows you to access the nth item displayed by the terminal

Terminal(-n) returns the nth item and the associated meta data as a list, the firt item is the displayed item, the other 3 items are the color, the font and the flags following the PRINT2D function info

Terminal(0) return a list of variois Terminal information: {terminal_visible, max_Numer_Of_VisibleLines, {Current.xscroll, max_xscroll}, {current_yscroll, max_yscroll}, nb_Lines_in_terminal}

Terminal:={objects} allows to change the object displayed by the terminal all at once

Terminal(n):= obj allows to change the nth object displayed by the terminal

Terminal(-n):= {obj, color, font, flags} allow to change the nth object displayed by the terminal, including the meta data

Terminal(0):= {visible, maxLines, xpos, ypos} allows you to control the terminal parameters, visibility, max number of lines and scroll positions, note that a -1 in any of these means "no change"

I think you need a function that allows you to enter Terminal(); and exit the terminal view from a program code.


PRINT2D CMD

The FLOOR and CEILIN commands are widely used, for them there are mathematical symbols, which are in the Unicode font.

PHP Code:
PRINT2D'floor(17 / 3)' ); // print as function floor(17 / 3), but ⌊ 17/3 ⌋ is real 2D mathbook print, 8970 (⌊) & 8971(⌋)  unicode char
    
PRINT( "\n" );
    
    
PRINT2D'ceiling(17 / 3)' ); // print as ceiling(17 / 3), but ⌈ 17/3 ⌉ is real 2D mathbook print, 8968(⌈)/8969(⌉) unicode char
    
PRINT2Dceiling(17 3) ); // 6
    
PRINT( "\n" );
    
   
    
PRINT2D'abs(3+4*i)' ); // | 3 + 4i |
    
PRINT2Dabs(3+4*i) ); // 5
    
PRINT( "\n" ); 



RE: Software 2.1.14558 (Beta): First Impressions - Tyann - 04-26-2021 05:34 PM

Quote:This allows the user to define a constant. I did get a syntax error with this code though.
Bonjour
CONST var:=val;
fonctionne pour moi, cela doit être placé hors des fonctions:

Hello
CONST var:=val;
works for me, it must be placed outside the functions:
Code:

CONST CA:=100;
EXPORT essai(n)
BEGIN
 n*CA;
END;



RE: Software 2.1.14558 (Beta): First Impressions - compsystems - 04-26-2021 05:58 PM

Ok, the definitions must be outside the main body of the program. They also have to be different variables from the system

1 Real: A,...,Z
2 Complex: Z0,..., Z9
3 List: L0,..., L9
4 Matrix: M0,..., M9
5: Graphics: G0,..., G9


PHP Code:
// define and protect 
// constants
CONST A1 := (e/2);
CONST 
B1 := e;

EXPORT CONSTDEMO()
BEGIN
    LOCAL C1
;
    PRINT();
    
PRINT2D(A1);
    
PRINT2D(B1);
    
    
C1:=QUOTE((e/2));
    
PRINT2D((C1));
    RETURN(
"Done");
END

CONSTDEMO() [ENTER] OK

PHP Code:
CONST A1;
CONST 
B1 := e;

EXPORT CONSTDEMO1()
BEGIN
    
PRINT();
    
A1 := B1/2// Error: Invalid input
    
PRINT2D(A1);
    RETURN(
"Done");
END

CONSTDEMO1() [ENTER] "Error: Invalid input"
the output message has to be improved to "Error: A1 constant"