Maple 2020 Questions and Posts

These are Posts and Questions associated with the product, Maple 2020

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.


 

 

The uploaded worksheet contains a copy of figure of a pencil from a geometry book, followed by a failed attempt to code Maple to produce the same figure.

The book containing the figure gives no indication of how to code for the figure. Can the figure be produced in Maple?

Respondents will have to establish their own path to DirectSearch.

Pencil.mw

I am a newbie in Maple! I tried both ThermophysicalData and its CoolProp package to find saturation pressure of vapor for given air-water mixture temperature.

I want to calculate water vapor density in air or simply Absolute humidity (kg/m3)

But i can not see any meaningful function or combination of functions/properties in CoolProp to give such output.

P_w in CoolProp, HApropSI takes this as input only that is not usefule either way inpoutput

The rationale is to work from RH and then calculate P_w as output: P_w=RH x P_g where P_g is vapor saturation pressure at the given ambient condition.

From there all world is yours!

You can use ideal gas rules to do everything. But i cant use CoolProp to calculate the ABsolute humidty for given RH and ambient condition.

 

Note that clearly i can calculate all these from hand calculation as well as approximation formuale of Clausius-Clapeyron equation. But i wanted to do in Maple with its packages.

 

Any help is appreciated!?

Regards

Sina

 

 

Dear there,

I want to create a new package. 

Goal of the package:

I have two functions psi(n,m,x) and w(n,x).

 

These functions are defined differently in case A, and in case B

 

In my future works,

I want to use the functions psi(n,m,x) and w(n,x) in ONE (same) worksheet by calling the package.

 

Case A;

 K:=2^(k-1):
with(orthopoly): 
psi:=(n,m,x)->piecewise((n-1)/K <= x and x <= n/K,
(sqrt((m+1/2)*2^k))*LegendreP(m,2^k*x-2*n+1), 0);   
w:=(n,x)->1;  
 

 

Case B;

K:=2^(k-1):
with(orthopoly):
unprotect(gamma):
h:=(m,epsilon,gamma)->2^(epsilon+gamma+1)*GAMMA(epsilon+m+1)*GAMMA(gamma+m+1)/((2*m+1+epsilon+gamma)*m!*GAMMA(epsilon+gamma+1));


psi:=(n,m,x)->piecewise((n-1)/K <= x and x <= n/K,  2^(k/2) *h(m,epsilon,gamma)*simplify(JacobiP(m,epsilon,gamma,2^(k)*x-2*n+1)), 0); 
  

w:=(n,x)->(1-x)^(epsilon)*(1+x)^gamma; 

How can we achieve this in the simplest way?

 

MY TRY: (Please click to download the code.mw)

test:=module()
export functionA,functionB;
 option package;


######################################################
functionA:=proc(k,M) local K,h,psi,w; 
K:=2^(k-1):
with(orthopoly): 
psi:=(n,m,x)->piecewise((n-1)/K <= x and x <= n/K,
(sqrt((m+1/2)*2^k))*LegendreP(m,2^k*x-2*n+1), 0);   
w:=(n,x)->1;   
return psi(n,m,x) ,w:
end proc:
######################################################


functionB:=proc(k,M,epsilon,gamma) local K,h,psi,w; 
K:=2^(k-1):
with(orthopoly):
unprotect(gamma):
h:=(m,epsilon,gamma)->2^(epsilon+gamma+1)*GAMMA(epsilon+m+1)*GAMMA(gamma+m+1)/((2*m+1+epsilon+gamma)*m!*GAMMA(epsilon+gamma+1));


psi:=(n,m,x)->piecewise((n-1)/K <= x and x <= n/K,  2^(k/2) *h(m,epsilon,gamma)*simplify(JacobiP(m,epsilon,gamma,2^(k)*x-2*n+1)), 0); 
  

w:=(n,x)->(1-x)^(epsilon)*(1+x)^gamma;   
return psi(n,m,x),w(n,x):
end proc:
######################################################

end module;


savelib(test):


# FOR EXAMPLE
restart:
with(test);

#For k=2,M=3 in FunctionA, let's calculate values of "Psi(2)" and "w(2,x)"
k:=2:
M:=3:
K:=2^(k-1):
N:=K*M:
(psi,w):=functionA(2,3):
psi:=(n,m,x)->psi; 
w:=(n,x)->w;
unprotect(Psi):
Psi:=x->Array([seq(seq(psi(i,j,x),j=0..M-1),i=1..K)] )^+:
Psi(2);
w(2,x);


#Now, let's calculate values of "Psi(2)" and "w(2,x)" For  k=3,M=4, epsilon=1, gamma=2 in FunctionA 

 (psi,w):=functionB(3,4,1,2):
Psi(2);
w(2,x);

 

 

 

restart;
deq1 := diff(u(x, y), x) - diff(u(x, y), y$2) = exp(x+y);
                              /  2         \             
              / d         \   | d          |             
      deq1 := |--- u(x, y)| - |---- u(x, y)| = exp(x + y)
              \ dx        /   |   2        |             
                              \ dy         /             

deq2 := diff(u(x, y), x) - diff(u(x, y), y$2) = exp(1)^(x+y);
                            /  2         \                  
            / d         \   | d          |           (x + y)
    deq2 := |--- u(x, y)| - |---- u(x, y)| = (exp(1))       
            \ dx        /   |   2        |                  
                            \ dy         /                  

pdsolve(deq1, u(x,y));  ### no result
pdsolve(deq2, u(x,y));
                        /                                        
                        |                                        
PDESolStrucApplyFunction|uApplyFunction(x,y)=_F1ApplyFunction(x)
                        \                                        

                        1
  _F2ApplyFunction(y) - -
                        2

                       x+y                                                                                   
  (expApplyFunction(1))    (_C1 expApplyFunction(uminus0y)+_C2 expApplyFunction(y)+_C3 expApplyFunction(y) y)
  -----------------------------------------------------------------------------------------------------------
                                            _C3 expApplyFunction(y)                                          

  ,[{diffApplyFunction(_F1ApplyFunction(x),x)=_c[1] _F1

  ApplyFunction(x),diffApplyFunction(diffApplyFunction(_F2

                                                    \
                                                    |
  ApplyFunction(y),y),y)=_c[1] _F2ApplyFunction(y)}]|
                                                    /

No solution appears when the differential equation is expressed in standard form, but when exp(x + y) is converted to

exp(1)^(x + y) the correct solution appears.

 

I want to create a 2D and 3D graph of the following question. Evaluate F xy+y+z along the curve r(t)=2ti+tj+(2-2t)k, 0<=t<=1 I found the line integral to be 13/2. I am just stuck on how to graph this in 2D and 3D.

Thank you all in advance! I enjoy learning all the new tricks in Maple from you all.

Hello

I am not familiar with the use of notsero in SolveTools:-PolynomialSystem. Is there any special syntax to use it?  In the following example, the trivial solution {x=0,y=0} is to be eliminated.  

SolveTools:-PolynomialSystem({x*(x^2 - 2), y*(y^2 - 2)}, {x, y},explicit=true)

If I issue the command

SolveTools:-PolynomialSystem({x*(x^2 - 2), y*(y^2 - 2)}, {x, y},{x,y},explicit=true)

all roots with either x=0 or y=0 are eliminated.  

Can netzero be used to eliminate only the trivial solution?  

 

Many thanks

 

 

I'm trying to compute the numerical solution for a PDE using the numerical solution of a first-order ODE. I looked at the INTEGRATE keyword of the pdsolve function, but I'm not sure how to use it. Can someone show an example of how to use this keyword?

Hello

I have a funtion defined as 

a := diff(u*ln(m__o/(-q*t + m__o)) - g*t, t)

where m_0, q, g, and u are constants with dimensions. T is the variable and has dimensions as well. I need to print out columns of this function and other similar functions, v and h, in 4 seconds intervals of t. So what I have is this:

for i from -4 by 4 to 80 do
    if i = -4 then printf("%12s %18s %15s %15s \n", "time", "acceleration", "velocity", "altitude"); else printf("%10d %c %10.2f  %s %10.2f  %s %10.2f  %s \n", i, "s", eval(a, t = i), "ft/s^2", eval(v, t = i), "ft/s", eval(h, t = i), "mi"); end if;
end do

this works perfectly fine until I assign units to the constants and t. Then I get the error: Error, (in fprintf) number expected for floating point format. 

Then I also need to plot a v and h against t. Seems like plot doesn't work either with units.

 

So what do i do?

Thanks

Hi, 

Whenever I open Maple 2020 and type one single letter or number (doesn't matter) Maple 2020 will "freeze" and load forever (i have had it open for a long time, just watching that f**king blue circle spin...

I have tried reinstalling, repairing, running as admin, and changing the compatibility mode, still, nothing works:(

 

I run Maple 2020 as a Student with WithGym

Pc specs:

Intel i5-10300h 2.6 ghz

Geforce 1660 ti 6gb

Windows 10 x64

Hi,

 

I don't speak well in english but I 'll try

 

I can't print a matrix multiplication without maplke simplify it

i want 

A*b=x

so 

|1 2 3|     |x|        |1|

|4 5 6|  * |y|    =   |2|

|7 8 9|     |z|        |3|

but maple simplify A*x

so i have something like

|1x 2y 3z|            |1|

|4x 5y 6z|       =   |2|

|7x 8y 9z|            |3|

 

 

Thank a lot.

 

 

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

 

 

Is Prüfer's algorithm available in Maple (given a tree, produce the code, and vice versa)? If not, has anyone written the code for it?

Hello

I need to check if the solution of a polynomial system (for instance a set of polynomial equations in y and z) using two different approaches is the same (equal or symmetric).  I thought if I use simplify plus abs I could solve the problem, but that is not the case.   Here is an example;

The first method returns the following solution:

aa := {{y = -2*X1*X2*alpha[1, 8]*alpha[2, 6]/(sqrt((X1^4*alpha[1, 8]^2*alpha[2, 4]^2 + 2*X1*((-2*X1*X2*alpha[3, 6] - 2*X2*alpha[2, 2] + 2*X3)*alpha[2, 6] + X1*X2*alpha[2, 4]*(alpha[2, 8] + alpha[3, 9]))*alpha[1, 8] + X2^2*(alpha[2, 8] + alpha[3, 9])^2)*alpha[1, 8]^2) + alpha[1, 8]^2*alpha[2, 4]*X1^2 + X2*alpha[1, 8]*(alpha[2, 8] + alpha[3, 9])), z = (-sqrt((X1^4*alpha[1, 8]^2*alpha[2, 4]^2 + 2*X1*((-2*X1*X2*alpha[3, 6] - 2*X2*alpha[2, 2] + 2*X3)*alpha[2, 6] + X1*X2*alpha[2, 4]*(alpha[2, 8] + alpha[3, 9]))*alpha[1, 8] + X2^2*(alpha[2, 8] + alpha[3, 9])^2)*alpha[1, 8]^2) - alpha[1, 8]^2*alpha[2, 4]*X1^2 + (-alpha[3, 9] - alpha[2, 8])*X2*alpha[1, 8])/(2*alpha[1, 8]^2*alpha[2, 6]*X1)}, {y = -2*X2*alpha[1, 8]*alpha[2, 6]*X1/(-sqrt((X1^4*alpha[1, 8]^2*alpha[2, 4]^2 + 2*X1*((-2*X1*X2*alpha[3, 6] - 2*X2*alpha[2, 2] + 2*X3)*alpha[2, 6] + X1*X2*alpha[2, 4]*(alpha[2, 8] + alpha[3, 9]))*alpha[1, 8] + X2^2*(alpha[2, 8] + alpha[3, 9])^2)*alpha[1, 8]^2) + alpha[1, 8]^2*alpha[2, 4]*X1^2 + X2*alpha[1, 8]*(alpha[2, 8] + alpha[3, 9])), z = (sqrt((X1^4*alpha[1, 8]^2*alpha[2, 4]^2 + 2*X1*((-2*X1*X2*alpha[3, 6] - 2*X2*alpha[2, 2] + 2*X3)*alpha[2, 6] + X1*X2*alpha[2, 4]*(alpha[2, 8] + alpha[3, 9]))*alpha[1, 8] + X2^2*(alpha[2, 8] + alpha[3, 9])^2)*alpha[1, 8]^2) - alpha[1, 8]^2*alpha[2, 4]*X1^2 + (-alpha[3, 9] - alpha[2, 8])*X2*alpha[1, 8])/(2*alpha[1, 8]^2*alpha[2, 6]*X1)}}

and the second Method:

bb := {{y = -2*X2*alpha[2, 6]*X1/(-sqrt(X1^4*alpha[1, 8]^2*alpha[2, 4]^2 + 2*X2*alpha[1, 8]*((alpha[2, 8] + alpha[3, 9])*alpha[2, 4] - 2*alpha[2, 6]*alpha[3, 6])*X1^2 - 4*alpha[1, 8]*alpha[2, 6]*(X2*alpha[2, 2] - X3)*X1 + X2^2*(alpha[2, 8] + alpha[3, 9])^2) + (alpha[2, 8] + alpha[3, 9])*X2 + alpha[1, 8]*alpha[2, 4]*X1^2), z = (sqrt(X1^4*alpha[1, 8]^2*alpha[2, 4]^2 + 2*X2*alpha[1, 8]*((alpha[2, 8] + alpha[3, 9])*alpha[2, 4] - 2*alpha[2, 6]*alpha[3, 6])*X1^2 - 4*alpha[1, 8]*alpha[2, 6]*(X2*alpha[2, 2] - X3)*X1 + X2^2*(alpha[2, 8] + alpha[3, 9])^2) - alpha[1, 8]*alpha[2, 4]*X1^2 + (-alpha[3, 9] - alpha[2, 8])*X2)/(2*alpha[1, 8]*alpha[2, 6]*X1)}, {y = -2*X2*alpha[2, 6]*X1/(sqrt(X1^4*alpha[1, 8]^2*alpha[2, 4]^2 + 2*X2*alpha[1, 8]*((alpha[2, 8] + alpha[3, 9])*alpha[2, 4] - 2*alpha[2, 6]*alpha[3, 6])*X1^2 - 4*alpha[1, 8]*alpha[2, 6]*(X2*alpha[2, 2] - X3)*X1 + X2^2*(alpha[2, 8] + alpha[3, 9])^2) + alpha[1, 8]*alpha[2, 4]*X1^2 + (alpha[2, 8] + alpha[3, 9])*X2), z = (-sqrt(X1^4*alpha[1, 8]^2*alpha[2, 4]^2 + 2*X2*alpha[1, 8]*((alpha[2, 8] + alpha[3, 9])*alpha[2, 4] - 2*alpha[2, 6]*alpha[3, 6])*X1^2 - 4*alpha[1, 8]*alpha[2, 6]*(X2*alpha[2, 2] - X3)*X1 + X2^2*(alpha[2, 8] + alpha[3, 9])^2) - alpha[1, 8]*alpha[2, 4]*X1^2 + (-alpha[3, 9] - alpha[2, 8])*X2)/(2*alpha[1, 8]*alpha[2, 6]*X1)}}

Notice (if I am not mistaken) that the first pair of the first solution is equal to the second pair of the second solution.   If I compare them using evalb(simplify(aa[1,1])=simplify(bb[2,1])), Maple returns false.  Again, if I am not mistaken I think they are the same.

a) How can the solutions be compared?

b) I also need to determine if there are symmetric roots in a set of solutions (either in aa or in bb) and a procedure that returns just one solution.  Something like:

func:=(auxsolsx,varsx)->`if`(nops(map(v->op(map(w->abs(subs(w[ListTools:-Search(v,varsx)],v)),auxsolsx)),varsx))=2,ifelse(nops(auxsolsx)=1,auxsolsx,{auxsolsx[1]}),NULL):

Many thanks

 

 

 

First 29 30 31 32 33 34 35 Last Page 31 of 55