From: Stavros M. <mac...@gm...> - 2024-10-29 18:33:40
|
By the way, in my last email, I would have liked some way to print that matrix in *display2d:true* mode, but I couldn't figure out how. For one thing, multiline strings don't stay within their matrix cell: matrix(["two liner", "oneliner"], ["oneliner", "two << note embedded Newlines liner"]); => [ two liner oneliner ] [ ] [ oneliner two liner ] where I'd want to see [ two oneliner ] [ liner ] [ ] [ oneliner two ] [ liner ] For another, I don't know how to get a 2d representation output as a string with embedded Newlines. Looking at the code in *displa.lisp*, it doesn't look hard, but I don't think there's any standard function for doing it, or is there? -s On Tue, Oct 29, 2024 at 1:56 PM Stavros Macrakis <mac...@gm...> wrote: > Good point. > > The documentation for *powerdisp* is incomplete/misleading. It reads: > > When ‘powerdisp’ is ‘true’, a sum is displayed with its terms in > order of increasing power. > > But as you say, it actually reverses *all* the terms, not just the powers: > > apply('matrix,makelist( [ string(ex), block([powerdisp:true],string(ex))], > ex, [x+y, a+b, x^3+y^2+z, z^3+y^2+x, z^2+x^2])); > [ y+x x+y ] > [ ] > [ b+a a+b ] > [ ] > [ z+y^2+x^3 x^3+y^2+z ] > [ ] > [ z^3+y^2+x x+y^2+z^3 ] > [ ] > [ z^2+x^2 x^2+z^2 ] > > > > On Tue, Oct 29, 2024 at 1:28 PM Robert Dodier <rob...@gm...> > wrote: > >> On Tue, Oct 29, 2024 at 8:33 AM Stavros Macrakis <mac...@gm...> >> wrote: >> >> > Using great ordering for displaying products and reversed great >> ordering for sums is, as I said, "a crude heuristic, but it produces pretty >> good results". To improve on that, great should not be modified -- that >> should be done in nformat, which already does things like >> a*b^-1*c*q^-1*w*x^-1*y*z^-1 (internal format) => (a*c*w*y)/(b*q*x*z) >> (external format), rat(2,3)*x => (2*x)/3, x^rat(-1,2) => 1/sqrt(x), etc. >> > >> > Maybe you could start by making a list of cases where you think Maxima >> is producing suboptimal display orderings. Keep in mind that the ordering >> often depends on what is considered a "variable" and what is considered a >> "parameter". >> >> I haven't been following closely, but anyway see also the global flag >> powerdisp which governs whether "+" expressions are displayed with >> terms as ordered by GREAT, or in the opposite order. I forget which is >> the default. >> >> HTH >> >> Robert >> > |