Exact Fractions in Matrices
02-01-2019, 02:39 PM
Post: #1
 Eddie W. Shore Senior Member Posts: 1,590 Joined: Dec 2013
Exact Fractions in Matrices
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.
02-01-2019, 04:47 PM (This post was last modified: 02-01-2019 04:58 PM by grsbanks.)
Post: #2
 grsbanks Senior Member Posts: 1,219 Joined: Jan 2017
RE: Exact Fractions in Matrices
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]:

After pressing [Enter]:

02-01-2019, 06:20 PM
Post: #3
 John P Member Posts: 218 Joined: Dec 2013
RE: Exact Fractions in Matrices
It works in CAS with no probs.
02-02-2019, 04:19 AM
Post: #4
 Joe Horn Senior Member Posts: 2,004 Joined: Dec 2013
RE: Exact Fractions in Matrices
This is awkward but it works in Home:

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

<0|ɸ|0>
-Joe-
02-02-2019, 04:21 PM
Post: #5
 informach Member Posts: 109 Joined: Jul 2015
RE: Exact Fractions in Matrices
Hi!, Eddie :
Try by creating any algorithm with p/q Form, as ...

Attached File(s) Thumbnail(s)

02-02-2019, 11:21 PM
Post: #6
 Eddie W. Shore Senior Member Posts: 1,590 Joined: Dec 2013
RE: Exact Fractions in Matrices
(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.
02-03-2019, 11:37 PM
Post: #7
 Joe Horn Senior Member Posts: 2,004 Joined: Dec 2013
RE: Exact Fractions in Matrices
(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.

<0|ɸ|0>
-Joe-
02-04-2019, 02:20 AM
Post: #8
 rprosperi Super Moderator Posts: 6,339 Joined: Dec 2013
RE: Exact Fractions in Matrices
(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...

--Bob Prosperi
02-04-2019, 02:04 PM
Post: #9
 Eddie W. Shore Senior Member Posts: 1,590 Joined: Dec 2013
RE: Exact Fractions in Matrices
I would love to have a program command that works like the [a b/c] key.
02-04-2019, 02:40 PM
Post: #10
 cdmackay Senior Member Posts: 727 Joined: Sep 2018
RE: Exact Fractions in Matrices
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.

Cambridge, UK
41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47
Casio, Rockwell 18R
02-05-2019, 02:13 AM
Post: #11
 Joe Horn Senior Member Posts: 2,004 Joined: Dec 2013
RE: Exact Fractions in Matrices
(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.

<0|ɸ|0>
-Joe-
02-05-2019, 03:26 PM
Post: #12
 cdmackay Senior Member Posts: 727 Joined: Sep 2018
RE: Exact Fractions in Matrices
(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.

Cambridge, UK
41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47
Casio, Rockwell 18R
02-06-2019, 05:35 AM
Post: #13
 chromos Member Posts: 224 Joined: Jun 2015
RE: Exact Fractions in Matrices
(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...

Prime G2, 15C CE
02-06-2019, 02:39 PM (This post was last modified: 02-06-2019 02:40 PM by cdmackay.)
Post: #14
 cdmackay Senior Member Posts: 727 Joined: Sep 2018
RE: Exact Fractions in Matrices
(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...

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

edit: and your version too, thanks!

Cambridge, UK
41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47
Casio, Rockwell 18R
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)