Adjoint matrix (my function): ok with numbers but not symbolics

11102017, 04:04 PM
(This post was last modified: 11102017 04:05 PM by salvomic.)
Post: #1




Adjoint matrix (my function): ok with numbers but not symbolics
hi,
in the code in this program the function adj(m) works well with numbers like Code: adj([1,2],[3,4]) Code: adj([a,b],[c,d]) Why? The need to have this function is because the new adjoint_matrix() in the CAS is, as it must be, more detailed, and it returns characteristic polynomial of A and the comatrix o AxI, i.e. Code:
Code: [[d, b],[c,a]] Any help, please, using (or not) the new adjoint_matrix()? Salvo ∫aL√0 (@salvomic, IT9CLU)  HP Prime, 50g, 12C :: HP Prime Software Library 

11102017, 04:38 PM
Post: #2




RE: Adjoint matrix (my function): ok with numbers but not symbolics
It is true! was there a change in interactivity HP PPL  CAS?
Viga C  TD  FB 

11102017, 04:41 PM
Post: #3




RE: Adjoint matrix (my function): ok with numbers but not symbolics
There should not have been, so this is interesting and exactly why we wanted a more public beta to test a wider range of user programs.
To be clear, you are calling your function in the CAS where previously it worked fine? Or are you calling it from Home? Please provide exact steps that DID work in prior versions and now no longer work. Thank you! TW Although I work for the HP calculator group, the views and opinions I post here are my own. 

11102017, 04:57 PM
(This post was last modified: 11102017 05:41 PM by salvomic.)
Post: #4




RE: Adjoint matrix (my function): ok with numbers but not symbolics
(11102017 04:41 PM)Tim Wessman Wrote: There should not have been, so this is interesting and exactly why we wanted a more public beta to test a wider range of user programs. I called my adj() in CAS with this code: Code: adj([[a,b],[c,d]]) \[ \begin{Vmatrix} d & b \\ c & a \end{Vmatrix} \] and instead return an error. If I try Code: adj([[1,2],[4,3]]) \[ \begin{Vmatrix} 3 & 2 \\ 4 & 1 \end{Vmatrix} \] In my program adj(m) recall the internal cofactors(m) that use MAKEMAT and an internal function, minor(mat, r,c) that simply use delrows() and delcols() to delete row r and col c and pass the argument, and so on. A simple code that, if I well remember worked well with numbers and with letters first (however I can be wrong, I don't remember if in older version it worked also with letters, I would like to understand why the littoral matrix is taken as it wouldn't a matrix and why then there is the "bad argument type")... Also in iOS app I get the error. So I wonder: maybe it's not a real bug but only a problem with types of vars? Simply, I thought that passing a matrix (m) it were indifferent if the matrix had numbers or letters (for symbolic calc) in its elements... EDIT: also with adj([[1, SIN(x)],[2,3]]) I get "Error: Bad argument type" \[ \begin{Vmatrix} 1 & sin(x) \\ 2 & 3 \end{Vmatrix} \] ∫aL√0 (@salvomic, IT9CLU)  HP Prime, 50g, 12C :: HP Prime Software Library 

11102017, 05:05 PM
(This post was last modified: 11102017 05:39 PM by salvomic.)
Post: #5




RE: Adjoint matrix (my function): ok with numbers but not symbolics
Here there is the code, if someone would like to collaborate to find the error in it, that prevent the use of a letters instead of numbers in the matrix:
Code:
The problem is in input, I suppose: type([1,2],[4,3]) > DOM_LIST TYPE([1,2],[4,3]) > 4 (matrix) but type([1,sin(x)],[2,3]) > DOM_LIST TYPE([1,sin(x)],[2,3]) > 6 (list) ... ∫aL√0 (@salvomic, IT9CLU)  HP Prime, 50g, 12C :: HP Prime Software Library 

11102017, 06:47 PM
Post: #6




RE: Adjoint matrix (my function): ok with numbers but not symbolics
(11102017 04:57 PM)salvomic Wrote: I called my adj() in CAS with this code: Well, that is the issue. Did it work previously and something has changed? Or is this just new code not working like you'd want. One is a bug and one is an enhancement/feature request. TW Although I work for the HP calculator group, the views and opinions I post here are my own. 

11102017, 06:53 PM
Post: #7




RE: Adjoint matrix (my function): ok with numbers but not symbolics
(11102017 06:47 PM)Tim Wessman Wrote: Well, that is the issue. Did it work previously and something has changed? Or is this just new code not working like you'd want. Tim, I'm not requesting an enhancement, hi :) I made the code in 2015 and then it worked, I believe also with the symbolic matrices... Now that code (I haven't changed nothing) distinguishes between matrices and lists and refuses to treat the second ones. I do *hope* it isn't a bug ∫aL√0 (@salvomic, IT9CLU)  HP Prime, 50g, 12C :: HP Prime Software Library 

11102017, 06:55 PM
Post: #8




RE: Adjoint matrix (my function): ok with numbers but not symbolics
When you compute the det of a minor, it will return a symbolic expression, can you really store that in a Home local variable?
Why don't you write a CAS program ? What about defining adj(m):=adjoint_matrix(m)[2,size(m)]? 

11102017, 07:07 PM
Post: #9




RE: Adjoint matrix (my function): ok with numbers but not symbolics
(11102017 06:55 PM)parisse Wrote: When you compute the det of a minor, it will return a symbolic expression, can you really store that in a Home local variable?you are right, I didn't think it when I wrote the program. Quote:Why don't you write a CAS program ? oh, well (it is not a bug, Tim) In 2015 we hadn't adjoint_matrix()... Thank you! Now is more and more simple. I'm rewriting the program as you suggest. Only a little difference: adjoint_matrix([[1,2],[4,3]])[2,2] returns [[3,2],[4,1]] and my adj([[1,2],[4,3]]) returns [[3,2],[4,1]], that's the first result multiplied by 1 ... Also with [[a,b],[c,d]] I get the difference * 1... ∫aL√0 (@salvomic, IT9CLU)  HP Prime, 50g, 12C :: HP Prime Software Library 

11102017, 07:09 PM
Post: #10




RE: Adjoint matrix (my function): ok with numbers but not symbolics
Then adj(m):=adjoint_matrix(m)[2,size(m)]*(1)^(size(m)1) should do the job.


11102017, 07:12 PM
(This post was last modified: 11102017 09:36 PM by salvomic.)
Post: #11




RE: Adjoint matrix (my function): ok with numbers but not symbolics
(11102017 07:09 PM)parisse Wrote: Then adj(m):=adjoint_matrix(m)[2,size(m)]*(1)^(size(m)1) should do the job. ok! I'll rewrite the whole program for the new FW as a CAS function... EDIT This code is all CAS and works after the beta 2017 November 8. adj(m) Adjoint matrix cofactors(m) Cofactors matrix > TRN(adj(m)) minor(m, r, c) a minor of the matrix m, suppressing row r and col c Code:
∫aL√0 (@salvomic, IT9CLU)  HP Prime, 50g, 12C :: HP Prime Software Library 

« Next Oldest  Next Newest »

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