The Museum of HP Calculators

HP Forum Archive 15

[ Return to Index | Top of Index ]

HP 48G Programming with matrices
Message #1 Posted by DBD on 5 Oct 2005, 6:32 p.m.

I've been using my HP48 for many years now and unfortunately, I haven't done a lot of programming with it. Some, but not much.

It would be very helpful if I could write a program that would have a 4x4 matrix, with each element being a variable. The 1,1 element would be (cos(theta))^2, 2,1 element (sin(theta))^2, etc. I could have theta as a variable stored in the program's directory or have it as a local variable within the program. The problem is that I can't figure out how to get a matrix full of variables into the program.

If somebody could give me some advice on this, I'd really appreciate it.


Re: HP 48G Programming with matrices
Message #2 Posted by Crawl on 5 Oct 2005, 10:28 p.m.,
in response to message #1 by DBD

Does this work the same way as it would on the 49G+?

On that calculator, what I'd do is enter the desired matrix in the matrix writer (maybe using the equation writer within the MW to enter the elements), then enter it onto the stack.

Then I'd select the matrix on the stack and "Copy".

Then I'd go to where I wanted to enter it in the program, and paste it as an algebraic object.

You might need an EVAL after that (depending on how you want to use it).

Re: HP 48G Programming with matrices
Message #3 Posted by I, Claudius on 6 Oct 2005, 9:04 a.m.,
in response to message #1 by DBD

Perhaps the best is what the second poster suggested, simply use the built-in Matrix Writer to construct your matrix, then use the wealth of 48 matrix commands to do whatever you wish. If you prefer command line entry, another way is to use the ROW-> command, which transforms row vectors into a matrix. There are also a number of element commands which I won't detail here.

Since you're a beginning programmer, there are a number of good books available on programming the 48, which also work on the 49/49+. Probably the best one to start with is "An Easy Course in Using & Programming the 48" by GrapeVine Publications: If you find you like programming, get a copy of the 48 Series Advanced Users Reference Manual, or AUR. It provides a detailed description of every command available in the 48 ROM.

As I play with my old 48, I find it very slow compared with the 49 series. If possible, experiment with a 49/49+, you may find you like the increased speed as well as a true Computer Algebra System included. If your calculator is a GX in good shape, you will probably be able to sell it on eBay for much more than you'll pay for two 49s! Best of luck.

Edited: 6 Oct 2005, 9:05 a.m.

Re: HP 48G Programming with matrices
Message #4 Posted by DBD on 6 Oct 2005, 9:25 a.m.,
in response to message #3 by I, Claudius

Thanks for both replies. That really helps! DBD

Re: HP 48G Programming with matrices
Message #5 Posted by Ron Ross on 6 Oct 2005, 11:21 a.m.,
in response to message #3 by I, Claudius

I, Claudius's comment about getting an Hp49G+ holds merit (though I would not suggest you sell your Hp 48GX to get it, keep that until you fall in love with the 49G+ or better, have two loves & don't let them in sight of each other, their infareds would blaze away in jealously! AND that is BAD for battery life!).

While the Hp 48G can work with Some symbolics, its matrix support may not handle anything more complex than simple polynomials (though there is some software on that may correct this). No matter, even if there is a solution, your Hp48g will be slow in comparision to everything else if you plan to use symbolics in its matrix functions. Its Matrix routines are optimized for numerical work and it is a great system for numerical number crunching, but its performance is miserable in symbolic manipulation as I, Claudius indicates.

[ Return to Index | Top of Index ]

Go back to the main exhibit hall