Post Reply 
exact results with roots
01-24-2015, 01:29 PM
Post: #1
exact results with roots
hi all,
I wonder if there is a way to get something like the "SQ()" function in HP50:
For example I input √2 in CAS, then I press "ab/c" and get approx(), that's 1.414213..., but if I press again "ab/c" I get a fraction and not the root (√2) again, like it was in HP 50g, using SQ()...

Please, help.
If not, I hope this function could be added in a next firmware upgrade...

cheers
Salvo
Visit this user's website Find all posts by this user
Quote this message in a reply
01-24-2015, 01:32 PM
Post: #2
RE: exact results with roots
http://www.hpmuseum.org/forum/thread-18.html

Would that fit your needs?

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
01-24-2015, 03:06 PM (This post was last modified: 01-24-2015 03:35 PM by salvomic.)
Post: #3
RE: exact results with roots
(01-24-2015 01:32 PM)Han Wrote:  http://www.hpmuseum.org/forum/thread-18.html

Would that fit your needs?

yes, thank you!
very interesting.

Is there a way to use it with a matrix? :-)
ex. having a matrix with [[1, 1.414213...], [3.141592..., 1.7320...]] to get [[1, √2], [∏, √3]]... The program, as it is, give error...
I found that we could use this method:
1. use mat2list with the matrix
2. use QPI
3. use list2mat; but this one require the matrix dimension
I hope to get an automatic program for that...
Visit this user's website Find all posts by this user
Quote this message in a reply
01-24-2015, 06:23 PM
Post: #4
RE: exact results with roots
(01-24-2015 03:06 PM)salvomic Wrote:  
(01-24-2015 01:32 PM)Han Wrote:  http://www.hpmuseum.org/forum/thread-18.html

Would that fit your needs?

yes, thank you!
very interesting.

Is there a way to use it with a matrix? :-)
ex. having a matrix with [[1, 1.414213...], [3.141592..., 1.7320...]] to get [[1, √2], [∏, √3]]... The program, as it is, give error...
I found that we could use this method:
1. use mat2list with the matrix
2. use QPI
3. use list2mat; but this one require the matrix dimension
I hope to get an automatic program for that...

You can, except Home view by design forces all matrices to be numeric and does not allow symbolic objects. Since all PPL programs are considered to be "Home" programs, the entries inside each matrix will always be converted back to decimal form. You can get what you want using by converting over to a CAS program, though.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
01-24-2015, 06:41 PM
Post: #5
RE: exact results with roots
(01-24-2015 06:23 PM)Han Wrote:  You can, except Home view by design forces all matrices to be numeric and does not allow symbolic objects. Since all PPL programs are considered to be "Home" programs, the entries inside each matrix will always be converted back to decimal form. You can get what you want using by converting over to a CAS program, though.

ok, thank you.

salvo
Visit this user's website Find all posts by this user
Quote this message in a reply
01-25-2015, 04:16 PM
Post: #6
RE: exact results with roots
any help to have a template for this? - I'm not so able for now with the new language...

(having a matrix selected)
(matdim is a variable = matrix dimension)

- mat2list (M) ;-)
- apply QPI program ;-)
- list2mat (M, matdim)
- results (again the matrix but with QPI applied)

:-)

Thank you in advance!
Visit this user's website Find all posts by this user
Quote this message in a reply
01-25-2015, 04:21 PM (This post was last modified: 01-25-2015 04:22 PM by Han.)
Post: #7
RE: exact results with roots
(01-25-2015 04:16 PM)salvomic Wrote:  any help to have a template for this? - I'm not so able for now with the new language...

(having a matrix selected)
(matdim is a variable = matrix dimension)

- mat2list (M) ;-)
- apply QPI program ;-)
- list2mat (M, matdim)
- results (again the matrix but with QPI applied)

:-)

Thank you in advance!

Code:
#cas
qpimat(m):=
BEGIN
  local s:=dim(m);
  m:=mat2list(m);
  m:=QPI(m);
  m:=list2mat(m,s(2)); 
  return m;
END;
#end

Create a new program named qpimat and make sure it's a CAS program. Then type in the code above. Note that you must be in CAS view in order to see symbolic matrices. In Home view, qpimat does nothing.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
01-25-2015, 05:56 PM
Post: #8
RE: exact results with roots
(01-25-2015 04:21 PM)Han Wrote:  ...
Create a new program named qpimat and make sure it's a CAS program. Then type in the code above. Note that you must be in CAS view in order to see symbolic matrices. In Home view, qpimat does nothing.

thank you a lot!
I created a program "QPIMAT" with Connectivy Kit, pasted the code and sent to calc, it works well with a test matrix, writing "qpimat()" directly, but I cannot see it listed in Catalog User (I've only QPI): why?
It's on Programs list...
Visit this user's website Find all posts by this user
Quote this message in a reply
01-25-2015, 10:33 PM
Post: #9
RE: exact results with roots
(01-25-2015 05:56 PM)salvomic Wrote:  thank you a lot!
I created a program "QPIMAT" with Connectivy Kit, pasted the code and sent to calc, it works well with a test matrix, writing "qpimat()" directly, but I cannot see it listed in Catalog User (I've only QPI): why?
It's on Programs list...

It's technically a CAS function. Perhaps this is why it is not listed. In the CAS view, you can create functions; for example: f(x):=x^2. You can see that if all such functions were listed as programs, it can cause a lot of clutter. Perhaps this may change in the future... I have no idea.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
01-25-2015, 10:39 PM
Post: #10
RE: exact results with roots
(01-25-2015 10:33 PM)Han Wrote:  It's technically a CAS function. Perhaps this is why it is not listed. In the CAS view, you can create functions; for example: f(x):=x^2. You can see that if all such functions were listed as programs, it can cause a lot of clutter. Perhaps this may change in the future... I have no idea.

yes,
I understand.
The problem is related to the fact we can't use "EXPORT" with #cas/#end structure, I think, so the function won't listed.
I hope in the future could be a way to get that, as it's very useful!

Thanks again!

salvo
Visit this user's website Find all posts by this user
Quote this message in a reply
03-05-2015, 10:30 AM (This post was last modified: 03-05-2015 11:08 AM by salvomic.)
Post: #11
RE: exact results with roots
(01-25-2015 10:33 PM)Han Wrote:  It's technically a CAS function. ...

Han, please,
is it possible to rationalize (symbolic representation) using QPI (on in other way) some "classical" irrational or transcendental expressions, like √π (1.77245385091), π^2 (9.86960440109), 2/π, 1/√π, golden ratio (0.618 033 988 749 894 = ((\sqrt(5) -1)/2), euler_gamma ...?

thanks for info!

Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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