rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

max location bug #3484

Open rtoy opened 1 month ago

rtoy commented 1 month ago

Imported from SourceForge on 2024-07-08 01:54:54 Created by zmth on 2020-09-08 00:23:26 Original: https://sourceforge.net/p/maxima/bugs/3653


build_info(version="5.43.0",timestamp="2019-06-01 18:55:31",host="x86_64-w64-mingw32",lisp_name="SBCL",lisp_version="1.4.14",maxima_userdir="C:/Users/zmth/maxima",maxima_tempdir="C:/Users/zmth/AppData/Local/Temp",maxima_objdir="C:/Users/zmth/maxima/binary/5_43_0/sbcl/1_4_14",maxima_frontend="wxMaxima",maxima_frontend_version="19.05.7")

want to find the max location of a matrix or list entry equivalent to fortran maxloc(m) and the index states locate_matrix_entry(m,f,max and f real valued) is the function in maxima that does this BUT it does NOT and only gives error:

(m:matrix([1,2],[3,4]),locate_matrix_entry(m,f,max and f real valued))
the error reads: incorrect syntax real is not an infix operator
rtoy commented 1 month ago

Imported from SourceForge on 2024-07-08 01:54:55 Created by zmth on 2020-09-08 00:25:48 Original: https://sourceforge.net/p/maxima/bugs/3653/#9007


want to find the max location of a matrix or list entry equivalent to fortran maxloc(m) and the index states locate_matrix_entry(m,f,max and f real valued) is the function in maxima that does this BUT it does NOT and only gives error:

(m:matrix([1,2],[3,4]),locate_matrix_entry(m,f,max and f real valued)) the error reads: incorrect syntax real is not an infix operator

rtoy commented 1 month ago

Imported from SourceForge on 2024-07-08 01:54:59 Created by robert_dodier on 2020-09-13 18:46:46 Original: https://sourceforge.net/p/maxima/bugs/3653/#945b


rtoy commented 1 month ago

Imported from SourceForge on 2024-07-08 01:55:03 Created by robert_dodier on 2020-09-13 18:46:47 Original: https://sourceforge.net/p/maxima/bugs/3653/#80ca


The syntax for locate_matrix_entry is a little complicated. Note that it also has start row, start column, end row, end column arguments too. The following works for me:

(%i1) m:matrix([1,2],[3,4]);
                                   [ 1  2 ]
(%o1)                              [      ]
                                   [ 3  4 ]
(%i2) locate_matrix_entry (m, 1, 1, 2, 2, identity, max);
(%o2)                               [2, 2]
(%i3) locate_matrix_entry (m, 1, 1, 2, 2, identity, min);
(%o3)                               [1, 1]
(%i4) locate_matrix_entry (m, 1, 1, 2, 2, oddp, bool);
(%o4)                               [1, 1]
rtoy commented 1 month ago

Imported from SourceForge on 2024-07-08 01:55:06 Created by robert_dodier on 2020-09-13 18:47:27 Original: https://sourceforge.net/p/maxima/bugs/3653/#c1d2


Closing this ticket as "won't fix" since it's a input syntax problem.

rtoy commented 1 month ago

Imported from SourceForge on 2024-07-08 01:55:10 Created by zmth on 2020-09-15 00:49:26 Original: https://sourceforge.net/p/maxima/bugs/3653/#83f3/f46a


ok from the help file alone how would you have known that ? In particular what does 'identity' mean in this case as related to max or min? and what about this oddp, bool and why does it choose the answer as only [1,1] when also the [2,1] entry of 3 is also odd ? The help file needs to be expanded on that locate_matrix_entry(...) subject with more specific examples also.

rtoy commented 1 month ago

Imported from SourceForge on 2024-07-08 01:55:13 Created by zmth on 2020-09-15 01:09:56 Original: https://sourceforge.net/p/maxima/bugs/3653/#83f3/f46a/57e9


Also the obvious assumption , and should be as it is true for most other statements , is one can leave out the starting and ending row column and if so then it just means the whole matrix which is what i assumed to be true for one.