HP Forums
Exact Fractions in Matrices - 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: Exact Fractions in Matrices (/thread-12330.html)



Exact Fractions in Matrices - Eddie W. Shore - 02-01-2019 02:39 PM

Can matrices only display decimal approximations on the HP Prime?

Say I have the matrix

[ [ 0.5, 0.6 ], [ 0.7, 0.8 ] ]

and I want to display the matrix in the program as

[ [ 1/2, 3/5 ], [ 7/10, 4/5 ] ].

A friend asked me how can we do this?

QPI turns matrices into lists when converting to exact values.

The command exact is ignored in Home Mode.

I had no success with propfrac or partfrac.

Is there a command that works like the [ a b/c ] key? Any help will be appreciated. Thank you.


RE: Exact Fractions in Matrices - grsbanks - 02-01-2019 04:47 PM

I'm guessing the answer is no.

I just tried to create a matrix with fractions by direct input. While the fractions showed on the command line, as soon as I hit [Enter] they were replaced by approximate values.

Before pressing [Enter]:

[attachment=6879]

After pressing [Enter]:

[attachment=6880]


RE: Exact Fractions in Matrices - John P - 02-01-2019 06:20 PM

It works in CAS with no probs.


RE: Exact Fractions in Matrices - Joe Horn - 02-02-2019 04:19 AM

This is awkward but it works in Home:

CAS("string(exact(M1))")


RE: Exact Fractions in Matrices - informach - 02-02-2019 04:21 PM

Hi!, Eddie :
Try by creating any algorithm with p/q Form, as ...


RE: Exact Fractions in Matrices - Eddie W. Shore - 02-02-2019 11:21 PM

(02-02-2019 04:19 AM)Joe Horn Wrote:  This is awkward but it works in Home:

CAS("string(exact(M1))")

It does... except that the matrix is one line. I'm surprised that QPI does not make all the entries of a matrices in exact fraction form.

Thank you.


RE: Exact Fractions in Matrices - Joe Horn - 02-03-2019 11:37 PM

(02-02-2019 11:21 PM)Eddie W. Shore Wrote:  I'm surprised that QPI does not make all the entries of a matrices in exact fraction form.

It does, but it also converts the matrix into a list of lists, because Home does not support symbolic matrices, only matrices of reals. So if you want a symbolic matrix, you'll either have to do it in CAS (or a CAS program), or convert the symbolic matrix into a form that Home can tolerate, such as a list of lists or a string. I personally like the QPI solution, even though its accuracy cannot be tuned as finely as the 'exact' function can.

Disclaimer: I *think* the above is correct, but I've almost entirely given up trying to learn how to use the HP Prime. Attempting to wrap one's brain around a constantly-moving target which is also a shape-shifter surrounded by an intermittent cloaking device is painful.


RE: Exact Fractions in Matrices - rprosperi - 02-04-2019 02:20 AM

(02-03-2019 11:37 PM)Joe Horn Wrote:  Disclaimer: I *think* the above is correct, but I've almost entirely given up trying to learn how to use the HP Prime. Attempting to wrap one's brain around a constantly-moving target which is also a shape-shifter surrounded by an intermittent cloaking device is painful.

Yikes!

But there is good news here, as this is almost certainly the first time I discovered something about an HP machine before Joe did...


RE: Exact Fractions in Matrices - Eddie W. Shore - 02-04-2019 02:04 PM

I would love to have a program command that works like the [a b/c] key.


RE: Exact Fractions in Matrices - cdmackay - 02-04-2019 02:40 PM

Is it my imagination or is QPI() not documented anywhere (other than in the Toolbox Catlg)? I can't find it in the User Guide.


RE: Exact Fractions in Matrices - Joe Horn - 02-05-2019 02:13 AM

(02-04-2019 02:40 PM)cdmackay Wrote:  Is it my imagination or is QPI() not documented anywhere (other than in the Toolbox Catlg)? I can't find it in the User Guide.

Correct. Like many other recently-added functions (including my favorites, dfc and dfc2f), QPI has not yet been added to the User Guide.


RE: Exact Fractions in Matrices - cdmackay - 02-05-2019 03:26 PM

(02-05-2019 02:13 AM)Joe Horn Wrote:  
(02-04-2019 02:40 PM)cdmackay Wrote:  Is it my imagination or is QPI() not documented anywhere (other than in the Toolbox Catlg)? I can't find it in the User Guide.

Correct. Like many other recently-added functions (including my favorites, dfc and dfc2f), QPI has not yet been added to the User Guide.

<scrambles to look those up…>

thanks Joe.

Some time ago someone posted a nice HTML version of the help file, which I downloaded. Sadly I can't remember whence it came, but it's the only doc I have that mentions QPI, and it's a lot easier to search than the one on the calc, even with the emulator.


RE: Exact Fractions in Matrices - chromos - 02-06-2019 05:35 AM

(02-05-2019 03:26 PM)cdmackay Wrote:  Some time ago someone posted a nice HTML version of the help file, which I downloaded. Sadly I can't remember whence it came...

Did you mean this thread?


RE: Exact Fractions in Matrices - cdmackay - 02-06-2019 02:39 PM

(02-06-2019 05:35 AM)chromos Wrote:  
(02-05-2019 03:26 PM)cdmackay Wrote:  Some time ago someone posted a nice HTML version of the help file, which I downloaded. Sadly I can't remember whence it came...

Did you mean this thread?

oh! It was TimW, how embarrassing for me to forget. Yes, that was it, thanks very much indeed.

edit: and your version too, thanks! Smile