jakubi

1369 Reputation

12 Badges

19 years, 339 days

MaplePrimes Activity


These are replies submitted by jakubi

Setting:

_LatexSmallFractionConstant:=0:

apparently solves this particular problem:

 latex(1/2);
{\frac {1}{2}}

Sounds like including this line in the init file would be a good idea. As usual, I have not found any documentation about it.

By the way, I get:

_LatexSmallFractionConstant;
                                  50

already in Maple 6.02... So, I do not find very serious the standard argument:

If it's not documented, we may just change its behaviour substantially from relase to release, or even remove it completely, for internal use reasons, and your code will then break.

as an excuse not to document it.

As far as I know, the solution is limited to one period. The option 'AllSolutions' does not help to get the rest. Indeed, the documentation should be more clear on this point.

And yes, information on periodicity is still waiting to be added to the FunctionAdvisor database. And be used throughout the system. I guess that this kind of information is available somewhere, in many routines perhaps, but implemented with shortsighted vision in that it cannot be readily shared with other routines.

As far as I know, the solution is limited to one period. The option 'AllSolutions' does not help to get the rest. Indeed, the documentation should be more clear on this point.

And yes, information on periodicity is still waiting to be added to the FunctionAdvisor database. And be used throughout the system. I guess that this kind of information is available somewhere, in many routines perhaps, but implemented with shortsighted vision in that it cannot be readily shared with other routines.

I have looked in more detail at the 'latex' code for fractions (may be a well known issue) and found that the problem seems to lay here:

showstat(`latex/latex/numeric`,9..11);
`latex/latex/numeric` := proc(e)
local texlist, `\\frac `, `-`, `/`, `{`, `}`, ll;
       ...
   9     if type(e,`latex/short_fraction`) then
  10       texlist := op(1,e), `/`, op(2,e)
         else
  11       texlist := `{`, `\\frac `, `{`, op(1,e), `}`, `{`, op(2,e), `}`, `}`
         end if
       ...
end proc

where

showstat(`type/latex/short_fraction`);
`type/latex/short_fraction` := proc(e)
   1   type(e,'fraction') and abs(op(1,e)*op(2,e)) < _LatexSmallFractionConstant
end proc

_LatexSmallFractionConstant;

                                  50

So, it seems to me that, in this case, the solution is rather patching `latex/latex/numeric`.  Or directly choosing another value for '_LatexSmallFractionConstant'. I guess that it would not affect anything else in the system. Isn't it?

I wonder what had in mind this person that "knew better" to chose 50...

This refactored code makes patching `latex/print` cleaner, but I wonder how far we can get by patching `latex/print`.

I have tried adding a substitution rule to get fractions in \frac form. Namely, as Algolib 'latex' does:

LaTeX:-latex(2/3);
\frac{2}{3}

At least for simple cases, this 'RegSubs' call works:

with(StringTools):
RegSubs( "(([a-zA-Z1-9]+))/(([a-zA-Z1-9]+))" = "\\\\frac{\\1}{\\3}", "2/3" );

                            "\frac{2}{3}"

RegSubs( "(([a-zA-Z1-9]+))/(([a-zA-Z1-9]+))" = "\\\\frac{\\1}{\\3}", "a/2" );

                            "\frac{a}{2}"

RegSubs( "(([a-zA-Z1-9]+))/(([a-zA-Z1-9]+))" = "\\\\frac{\\1}{\\3}", "a/b" );

                            "\frac{a}{b}"

So, I have inserted this substitution equation into the sequence:

...
        return foldr(StringTools:-RegSubs
                      , ExprsToLaTeX(expr)
                      , ListTools:-Reverse([regsubs])[]
                      , "\\\\!"            = ""      # remove \!
                      , "{([0-9])}"        = "\\1 "  # strip braces from single digits
                      , "\\\\_"            = "_"     # change \_ to _
                      , " \\\\right\\)"    = ")"     # remove \right)
                      , " \\\\left\\( "    = "("     # remove \left)
                      , "{\\\\it ([^}]*)}" = "\\1"   # remove italics from variables
                      , "\\\\,"            = " "     # remove \,
     , "(([a-zA-Z1-9]+))/(([a-zA-Z1-9]+))" = "\\\\frac {\\1} {\\3}"
                     );
...

and what I get, though not completely bad, is not what I would like.

First a minor problem perhaps. E.g. here brackets are removed:

MyLaTeX(2/3);
                            "\frac 2  3 "

(though texing it would work the same).

On the other hand, it sounds to me that running first through `latex/print` would make it harder to get good output as  Algolib 'latex' does here:

LaTeX:-latex(a/2);
\frac{a}{2}

instead of:

MyLaTeX(a/2);
                          "\frac 1  2  a"

Perhaps you could provide also those links for the threads that generated these corrections, so that we could know/refresh more easily what these issues were about (an open issue tracker providing this information would be even better).

 

I would like to know which is the update plan for these online help pages. I.e. update their contents in sync with the release of Maple versions or keep updating them independently, in advance wrt these releases.

I see this Online Help as a good step forward. The mean load time that I observe is about 1s. Not so slow, but it could be faster.

Perhaps my main objection from an early inspection is that most input is shown in 2D mode, implying a png file for each input line. And the alternate text for these images is missing.

So, on the one hand, it is not possible to copy&paste such input into a worksheet or editor (instead of downloading the whole worksheet). And on the other hand, the length of this graphic representation may be much larger than the length of the text itself (something like a 800B file for 20 characters). So, I think that web help pages with text input would load somewhat faster.

 

 

Elinks is a successor of links in current development.

What I get, either  if I set interface('verboseproc'=3) outside of the procedure or not is a text window with the following output:

    |\^/|      Maple 12 Diagnostic Program
._|\|   |/|_.  Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2007
 \  MINT   /   All rights reserved. Maple is a trademark of
 <____ ____>   Waterloo Maple Inc.
      |        
on line     1: `convert/CompSeq` := proc(e1)  ...  end;
                                                   ^ syntax error
Exit Value: 3

But I have not looked yet what this problem could be.

You have basically two methods: 'assume' the property 'real' or calculate under the package 'RealDomain', eg like:

simplify(sqrt(x^2)) assuming real;
                                | x |

use RealDomain in simplify(sqrt(x^2)) end use;

                                | x |

You have basically two methods: 'assume' the property 'real' or calculate under the package 'RealDomain', eg like:

simplify(sqrt(x^2)) assuming real;
                                | x |

use RealDomain in simplify(sqrt(x^2)) end use;

                                | x |

Using 'PDEtools[declare]', for a more compact output, you may do it like:

Xi:=F(eta,t)/(a(t)^2);
Xi1:=subs(eta=y/a(t),Xi);
PDEtools[declare]([a(t)],quiet,prime=t);
expand(diff(Xi1,t));


        D[1](F)(y/a, t) y a'   D[2](F)(y/a, t)   2 F(y/a, t) a'
      - -------------------- + --------------- - --------------
                  4                   2                 3
                 a                   a                 a

 

Using 'PDEtools[declare]', for a more compact output, you may do it like:

Xi:=F(eta,t)/(a(t)^2);
Xi1:=subs(eta=y/a(t),Xi);
PDEtools[declare]([a(t)],quiet,prime=t);
expand(diff(Xi1,t));


        D[1](F)(y/a, t) y a'   D[2](F)(y/a, t)   2 F(y/a, t) a'
      - -------------------- + --------------- - --------------
                  4                   2                 3
                 a                   a                 a

 

This adapted version is working for me in command line Maple 12 under Win XP:

mint := proc(f,extras::string:="")
  local fname,oldiface;
    fname := "c:/temp/foo";
    oldiface := interface('verboseproc');
    interface('verboseproc'=3);
    writeto(fname);
    printf("%a := ", f);
    print(f);
    printf(":\n");
    writeto(terminal):
    fclose(fname);
    interface('verboseproc'=oldiface);
    system(cat(kernelopts(bindir),"/mint ",extras," ",fname));
    NULL;
  end proc:

Note that I have installed Maple 12 in a directory without spaces.
I have not got it work from a GUI yet.

First 51 52 53 54 55 56 57 Last Page 53 of 123