nm

11353 Reputation

20 Badges

13 years, 19 days

MaplePrimes Activity


These are questions asked by nm

New error seems to have been introduced 

restart;
expr:=arccos(1/x);
Physics:-Latex(expr);

it seems to happen with the inverse trig functions when there is a fraction inside.

Do others have the same issue? I am currently using  869.  Maple 2020.1

Rolling back Physics version one at a time, I found the version this happened at. It was OK in version 865, but gives the error starting at version 866.

Hopefully this should make it easy to find the code change which caused it using source control diff.

 

As Latex improves in Maple (thanks to Physics:-Latex), I'd like to suggest not using \rm and replacing it with \mathrm.

\rm is now obsolete for long time. Reference: https://tex.stackexchange.com/questions/107186/how-to-write-norm-which-adjusts-its-size

 In addition, some Latex classes give warning or error when using it and workarounds are needed. For an example

\documentclass{scrbook}%notice the class is not article.
\usepackage{amsmath}
\begin{document}
${\rm e}^{-t}$
\end{document}

When compiled using lualatex foo4.tex gives

(base) >lualatex foo4.tex
This is LuaHBTeX, Version 1.12.0 (TeX Live 2020)
 restricted system commands enabled.
(./foo4.tex
LaTeX2e <2020-02-02> patch level 5
 L3 programming layer <2020-08-07> (/usr/local/texlive/2020/texmf-dist/tex/latex/koma-script/scrbook.cls
Document Class: scrbook 2020/07/22 v3.31 KOMA-Script document class (book)
(/usr/local/texlive/2020/texmf-dist/tex/latex/koma-script/scrkbase.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/koma-script/scrbase.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/keyval.sty) (/usr/local/texlive/2020/texmf-dist/tex/latex/koma-script/scrlfile.sty))) (/usr/local/texlive/2020/texmf-dist/tex/latex/koma-script/tocbasic.sty) (/usr/local/texlive/2020/texmf-dist/tex/latex/koma-script/scrsize11pt.clo) (/usr/local/texlive/2020/texmf-dist/tex/latex/koma-script/typearea.sty)) (/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/local/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def) (./foo4.aux) (/usr/local/texlive/2020/texmf-dist/tex/latex/base/ts1cmr.fd)

! Class scrbook Error: undefined old font command `\rm'.

See the scrbook class documentation for explanation.
Type  H <return>  for immediate help.
 ...MAClassName  Error: undefined old font command `\string \rm '.

See the \KOMAClassName  class documentation for explanation.
Type  H <return>  for immediate help\@err@
                                                                                                                                                                                                        
l.7 ${\rm
        e}^{-t}$
?

And Maple generates lots of these. For example

Physics:-Latex(exp(-t))
 
          {\rm e}^{-t}

mathrm works and give same output. Here is an example, where now I change the class to article to make it compile 

\documentclass{article}
\usepackage{amsmath}
\begin{document}

${\rm e}^{-t}$

$\mathrm{e}^{-t}$

$e^{-t}$

\end{document}

gives

The first is \rm, the second is mathrm and the last is the default with no modification.

Do others see any problem if this change could be made to Maple's Latex?

I am using Maple 2020.1 and Physics  867

Any idea why

if 2+89^(1/2)>0 then
   print("yes");
else
   print("no");
fi;

gives

Since 

evalf(2+89^(1/2))

is 11.4339.

 

I tried in Mathematica, and it works there

If[2 + 89^(1/2) > 0, Print["Yes"], Print["No"]]

What is the correct way to do this in Maple? i.e. to check that a numerical value is >0 ?

This is done in code, where the value I am doing this check on are known to be numeric, but I do not know what form they will be, I just know they will contain no floating point numbers. Only exact numbers.

The problem is the 89^(1/2). Maple knows it is >0 

is(89^(1/2)>0)

        true

but 

if (89)^(1/2)>0 then
   print("yes");
else
   print("no");
fi;

May be because 89 is prime. Should I replace my if with is for this check? 

interface(version)
Standard Worksheet Interface, Maple 2020.1, Windows 10, July 30 

   2020 Build ID 1482634


Physics:-Version()
The "Physics Updates" version in the MapleCloud is 867 and is 

   the same as the version installed in this computer, created 

   2020, November 12, 9:14 hours Pacific Time.


 

 

In this ODE

dsolve gives 

When A=3 but  not when A=1 or A=2

restart;
ode:=(1+y(x))*diff(y(x),x$2)-A*diff(y(x),x)^2=x;
A:=1;
dsolve(ode):
A:=2;
dsolve(ode):
A:=3;
dsolve(ode):

The problem is not with the particular solution. Maple can find that

DEtools:-particularsol(ode,y(x))

And it can solve the homogeneous ODE for any A:

restart;
ode:=(1+y(x))*diff(y(x),x$2)-A*diff(y(x),x)^2=0;
A:=1;
dsolve(ode):
A:=2;
dsolve(ode):
A:=3;
dsolve(ode);

 

Is this a known issue and why it happens on some values?

Maple 2020.1 and Physics 861 on windows 10

 

 

When translating initial conditions, for derivatives, to Latex, the output is not easy to read, and was wondering how to make it more standard.

For example, let say initial conditions for second order ODE are [y(0)=0,D(y)(0)=3] in Maple syntax.  I convert these to Latex using

restart;
ic:=[y(0)=0,D(y)(0)=3];
Physics:-Latex(ic)

which gives

               [y \left(0\right) = 0, D\left(y \right)\left(0\right) = 3]

The problem is with derivatives. They are hard to read, unless someone knows Maple. The above renders are

I'd like to get the above to standard form 

Which more easily understood and is the standard in textbooks and papers.

This issue does not show up in Mathematica, because in Mathematica initial conditions can be entered as  {y[0]==0,y'[0]==3} and this translates directly as is

Which renders a

I know in Maple document mode, 2D math input, one can also enter the IC the same as with Mathematica, which is easier, but the Latex translation still the same as with the worksheet 1-D math.

Going back to Maple, I could enter the initial conditions instead as follows

restart;
ic:=[y(0)=0,eval(diff(y(x),x)=3,x=0)];
Physics:-Latex(ic)

And now the latex generated renders as

Which might be more understandble but too heavy weight compared to the simpler form y'(0)=3 and I remember reading that use eval() as above is not as safe as using the D(y)()... notation for initial conditions.

Are there any other tricks that would allow the latex of derivative to show in the standard form to make it easier to read?

Is it possible for Physics:-Latex to automatically detect the form D(y)(x0)=y0 and generate y'(x0)=y0 for its Latex? This will be the ideal solution. This will apply to higher derivatives as well. For example 

Physics:-Latex( (D@@2)(y)(0)=3)

Now gives

         D^{\left(2\right)}\left(y \right)\left(0\right) = 3

which renders as

While a much better output would be the standard

This will go a long way towards improving the Latex generated by Maple.

Any suggestions?

 

 

First 106 107 108 109 110 111 112 Last Page 108 of 199