The following warnings occurred:
Warning [2] Undefined array key 253133 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 253136 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 253139 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 253141 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 253167 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 253168 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 253173 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 253216 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 253244 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 253253 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $thread - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $fid - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 253141 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 253253 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $lang - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Attempt to read property "messages_in_thread" on null - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks





My first HP Prime PPL Program



#11

This is my first ever non RPL program and it took me several hours to figure it out and get it to work, since I'm totally unfamiliar with the language, syntax, conventions and interface. Also, many needed commands are not included or explained in the calculator commands list. For example, I was unable to get the program to run w/o crashing and resetting the calculator until I inserted the LOCAL statement. In other cases I received a syntax error doing a Check of the code when using the exact syntax shown in an example in the User Guide. During the development I encountered numerous sudden resets of the calculator while entering/editing the program, which seems to be commonplace with this calculator. Fortunately, however, I did not corrupt the flash drive this time around.

This program performs 2D polar<>rectangular coordinate conversions, which are not supplied as built-in functions on the Prime. Note that I have substituted "Theta" and "SQRT" in this posting in place of the actual symbols, since they would not display properly.

EXPORT PR_Convert()
BEGIN
LOCAL X1,X2;
CHOOSE(N,"PR_Convert","Polar","Rectangular");
CASE
IF N=1 THEN
INPUT(X1,"To Polar","X =","Enter X",1);
INPUT(X2,"To Polar","Y =","Enter Y",1);
PRINT("R = " +SQRT(X1²+X2²) );
PRINT("Theta = " +ATAN(X2/X1) );
END;
IF N=2 THEN
INPUT(X1,"To Rectangular","R =","Enter R",1);
INPUT(X2,"To Rectangular","Theta =","Enter Theta",1);
PRINT("X = " +X1*COS(X2) );
PRINT("Y = " +X1*SIN(X2) );
END;
DEFAULT
END;
END;

#12

So if you mean there is no R->P command and P->R, you are correct. Those only make sense on a RPN only system that does not assume each command will return only a single result.

The way this is designed is that you can toggle your complex number forms. Type your complex number, then use the [shift] [*] key to toggle between the two representations.

What is missing is a command to do this inside a program.

TW


#13

Thanks, Tim. I hadn't noticed that key. It's a lot easier than the HP 50g, where you have to go into the MODE menu and change the coordinate system. Actually, the last HP calculator to have a proper R<>P key was the HP 33s, which unfortunately HP no longer makes. Doing R<>P coordinate conversions on the HP 35s is very cumbersome.


#14

Quote:
It's a lot easier than the HP 50g, where you have to go into the MODE menu and change the coordinate system. Actually, the last HP calculator to have a proper R<>P key was the HP 33s, which unfortunately HP no longer makes. Doing R<>P coordinate conversions on the HP 35s is very cumbersome.

Did I tell you I recommend a WP 34S here?

d:-)

#15

Quote:
This is my first ever non RPL program and it took me several hours to figure it out and get it to work, since I'm totally unfamiliar with the language, syntax, conventions and interface. Also, many needed commands are not included or explained in the calculator commands list. For example, I was unable to get the program to run w/o crashing and resetting the calculator until I inserted the LOCAL statement. In other cases I received a syntax error doing a Check of the code when using the exact syntax shown in an example in the User Guide. During the development I encountered numerous sudden resets of the calculator while entering/editing the program, which seems to be commonplace with this calculator. Fortunately, however, I did not corrupt the flash drive this time around.

This program performs 2D polar<>rectangular coordinate conversions, which are not supplied as built-in functions on the Prime. Note that I have substituted "Theta" and "SQRT" in this posting in place of the actual symbols, since they would not display properly.

EXPORT PR_Convert()
BEGIN
LOCAL X1,X2;
CHOOSE(N,"PR_Convert","Polar","Rectangular");
CASE
IF N=1 THEN
INPUT(X1,"To Polar","X =","Enter X",1);
INPUT(X2,"To Polar","Y =","Enter Y",1);
PRINT("R = " +SQRT(X1²+X2²) );
PRINT("Theta = " +ATAN(X2/X1) );
END;
IF N=2 THEN
INPUT(X1,"To Rectangular","R =","Enter R",1);
INPUT(X2,"To Rectangular","Theta =","Enter Theta",1);
PRINT("X = " +X1*COS(X2) );
PRINT("Y = " +X1*SIN(X2) );
END;
DEFAULT
END;
END;

For the INPUT command, I believe that you can place multiple inputs using lists. For example,

INPUT({X1,X2}, "Title", { "X1=", "X2=" }, {"Enter X1", "Enter X2" }, {0,0})

#16

Thanks. Like I said, I'm very new to this and could definitely improve.


#17

It is very good for a first attempt Michael. It also fills a much needed gap IMO.


#18

Hi Eddie,

Thanks for the encouragement. I'm definitely a lightweight in this crowd. I've revised the program code per Han's suggestion and it makes for a better operation. Instead of the inputs appearing separately, they now appear on a single screen, although the number of keystrokes and entries remains unchanged. I also replaced "=" with "==" in the CASE tests for consistency, although it doesn't seem to matter which form is used.

EXPORT PR_Convert()
BEGIN
LOCAL X1,X2;
CHOOSE(N,"PR_Convert","Polar","Rectangular");
CASE
IF N==1 THEN
INPUT({X1,X2},"To Polar",{"X =","Y ="},{"Enter X","Enter Y"},{0,0});
PRINT("R = " + sqrt(X1²+X2²) );
PRINT("theta = " + ATAN(X2/X1) );
END;
IF N==2 THEN
INPUT({X1,X2},"To Rectangular",{"R =","theta ="},{"Enter R","Enter theta"},{0,0});
PRINT("X = " + X1*COS(X2) );
PRINT("Y = " + X1*SIN(X2) );
END;
DEFAULT
END;
END;

Edited: 19 Oct 2013, 12:06 p.m.


#19

Quote:
Hi Eddie,

Thanks for the encouragement. I'm definitely a lightweight in this crowd. I've revised the program code per Han's suggestion and it makes for a better operation. Instead of the inputs appearing separately, they now appear on a single screen, although the number of keystrokes and entries remains unchanged. I also replaced "=" with "==" in the CASE tests for consistency, although it doesn't seem to matter which form is used.

EXPORT PR_Convert()
BEGIN
LOCAL X1,X2;
CHOOSE(N,"PR_Convert","Polar","Rectangular");
CASE
IF N==1 THEN
INPUT({X1,X2},"To Polar",{"X =","Y ="},{"Enter X","Enter Y"},{0,0});
PRINT("R = " + sqrt(X1²+X2²) );
PRINT("theta = " + ATAN(X2/X1) );
END;
IF N==2 THEN
INPUT({X1,X2},"To Rectangular",{"R =","theta ="},{"Enter R","Enter theta"},{0,0});
PRINT("X = " + X1*COS(X2) );
PRINT("Y = " + X1*SIN(X2) );
END;
DEFAULT
END;
END;


I think we can all empathize with being a lightweight. I had not even messed with the emulator until I got my calculator in late September (only a few weeks ago). There are still lots of things we are all still trying to figure out on the calculator. And you might finding it interesting that = does not always behave like == :-) I think your approach is best, though -- use == for boolean tests and avoid = when possible.

Good luck programming -- I'm just glad the language is very easy to learn and also quite fast.


#20

What I find interesting is that the Help key gives the exact same explanation of "=" and "==" when I select them in the Catalog menu in the toolbox.


Possibly Related Threads…
Thread Author Replies Views Last Post
  Sending little images to the Prime (...and Program name bug?) Erwin Ried 19 7,141 12-10-2013, 05:35 PM
Last Post: Erwin Ried
  Problem with debug HP prime program, somebody help me? Carlos CM (Mexico) 6 3,216 12-05-2013, 03:07 PM
Last Post: Carlos CM (Mexico)
  HP PRIME: APP program code DISAPPEARS !! Joseph Ec 0 1,166 11-25-2013, 11:35 AM
Last Post: Joseph Ec
  Prime: Placing more than 1 item on the RPN stack in a single program? John Colvin 4 2,199 11-19-2013, 08:59 AM
Last Post: Miguel Toro
  Prime: Program size limited to 64K? Erwin Ried 4 1,979 11-17-2013, 11:42 PM
Last Post: Joseph Ec
  [HP-Prime] Picking elements from a List in a program Jean-Michel 3 1,921 11-15-2013, 04:16 AM
Last Post: dg1969
  HP Prime: Recommendation for future RPN Program Mode BruceTTT 3 2,092 11-13-2013, 10:03 PM
Last Post: BruceTTT
  HP Prime: run a program in another program Davi Ribeiro de Oliveira 6 2,611 11-11-2013, 08:28 PM
Last Post: Davi Ribeiro de Oliveira
  [prime] Insert a breakpoint in a program for debugging ? Olivier Lecluse 3 1,721 11-09-2013, 09:41 PM
Last Post: Joseph Ec
  HP PRIME: Hide return value from program and swap Edit with Run vrrr 2 1,500 11-09-2013, 04:04 PM
Last Post: vrrr

Forum Jump: