# HP Forums

Full Version: HP 48G Programming with matrices
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

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.

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).

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: http://www.read-gpi.com/ 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.

Thanks for both replies. That really helps!
DBD

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 Hpcalc.org 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.