50G variable issue



#10

Hello all.

I'm having a devil of a time on this 50G with the simplest thing. So, I'd like some help. Thanks.

Why would this:

<< -> a b >> give me a 'Syntax Error' after I press ENTER as I just try to write this beginning steps of a program to see if I'm using the -> function correctly? Even when I try << -> 'a' 'b' >> , I get the same Syntax Error message.

Does my 50G need certain flags set? Are there certain libraries, functions or a reset/restore of the calc to its factory state that I need to perform?

As I've not programmed a 48GX in at least three years, I am quite a bit rusty.


#11

<< -> A B << >> >>

The inner << >> are for the program to be written in.


Edited: 21 May 2012, 2:32 p.m.


#12

Thanks! Relief!! Okay, so now the question is after local vars are created/consumed by the -> command, why must the next step always be << program >> instead of just coding the rest of the program even though the first set of << >> is already there?


#13

You need the inner set of brackets to delineate the scope of the variables. There's nothing to prevent you from having more than one inner set.

<<
-> a b
<<
* do some stuff here to calculate two values
>>
-> x y
<<
* do some stuff with the two new values
>>
>>

You can also nest deeper.

<<
-> a b
<<
* do some stuff
-> x y
<<
* do some stuff with a, b, x, and y
>>
* do more stuff with a and b
>>
>>

#14

Thanks for the refresher course. Yes, I could scope out one of those 'An Easy Course In...' but, since Educalc is now relegated to my MoHPC DVD, perhaps I could pour myself into the 28 manual as well as the myriad of 28 app packs there and learn by example. Would anyone here know where I could pick up some of those books so manufactured in the days of EduCalc and the 28 run?

By the way, has EduCalc resurfaced here on the web under another name perhaps? Could the EduCalc.net website be a remarketed/repackaged EduCalc or is it something different?


#15

Quote:
Would anyone here know where I could pick up some of those books so manufactured in the days of EduCalc and the 28 run?

Try the "HP 48 Insights" books. They're right there on the MoHPC DVDs. I'm reading them now and find them very helpful.

For example, any variable that starts with a left arrow is automatically a local variable.

Also, executing a local variable always just returns it to the stack. If the variable contains a program that you wish to execute, you must add an EVAL instruction.

#16

Hi,

Right, inner sub-program structure and local variables allow a lot of fun in RPL.

But the « -> a b « ... » » structure is not the only possible way.
One useful structure with local variable is the 'user function'. In contrary of program/sub-program structure, 'user function' permits algebraic or symbolic evaluations, derivations and integrations.
Simply replace the unique inner « ... » sub-program structure by an algebraic expression '...a...b...'

Having two types of local variables structures also explain a inner structure (program or algebraic object) is needed.

« -> a b 'a^2+a*b+b*b' »


P.S. Bart's message meets mine in the Internet Wires !

Edited: 21 May 2012, 3:14 p.m.

#17

Hi,

You can also use an algebraic expression directly after the local variable command, eg:
<< -> a b 'a^2+a*b+b^2' >>

Anyway, it's about the scope in which local variables exist. See the AUR chapter 1 section "Using Local Variables" (p1-7 i think).

Regards,
-B


#18

So, in all context, -> is more a local variable mechanism in contrast to a global variable creation mechanism.

And Bart, you are correct, indeed! Page 1-7 is EXACTLY where the dissertation on Local Variables begins! Well done!


Edited: 21 May 2012, 3:51 p.m.


Possibly Related Threads...
Thread Author Replies Views Last Post
  hp-prime solver and variable name fabrice48 22 2,778 12-10-2013, 03:25 AM
Last Post: fabrice48
  Solver issue with HP 17BII - different from 19BII Jeff Kearns 13 1,411 11-28-2013, 02:36 AM
Last Post: Don Shepherd
  Prime: Scope of Variable and functions within programs Thomas Chrapkiewicz 9 1,165 11-18-2013, 03:39 PM
Last Post: Thomas Chrapkiewicz
  Another minor Prime hexagesimal issue Jonathan Cameron 1 516 11-08-2013, 02:37 PM
Last Post: Michael de Estrada
  HP Prime - Variable problem bluesun08 12 1,321 11-07-2013, 11:34 AM
Last Post: bluesun08
  HP Prime Solver Variables Issue Anibal Morones Ruelas 8 1,137 10-19-2013, 09:45 AM
Last Post: Harold A Climer
  Voyager keyboard issue John Richards 2 543 09-27-2013, 07:43 PM
Last Post: John Richards
  WP-34S: Little issue with program step indicator Miguel Toro 6 828 09-06-2013, 12:45 PM
Last Post: Miguel Toro
  HELP! WP-34S (Flashing Issue) Barry Mead 2 485 07-15-2013, 04:25 AM
Last Post: Marcus von Cube, Germany
  HP 50g issue Matthew Richards 4 642 04-21-2013, 01:27 AM
Last Post: Matthew Richards

Forum Jump: