nm

11353 Reputation

20 Badges

13 years, 19 days

MaplePrimes Activity


These are questions asked by nm

Given an expression, I want to obtain list of all functions in it, that contains as argument, anywhere another function.  

I can do this now using 2 steps. I was wondering if there is a way to do it in one call.

Here is an example.

expr:=sin(x)+ln(abs(x))+ln(x+1/sqrt(abs(x+3)))+ln(x^3);

The goal is to find all ln functions, with abs inside them. Now, I do this

restart;
expr:=sin(x)+ln(abs(x))+ln(x+1/sqrt(abs(x+3)))+ln(x^3);
lis:=indets(expr,'specfunc(anything,ln)');
select(Z->has(Z,abs),lis)

I could not find a way to do it in one call, If I do this

indets(expr,'specfunc(abs(anything),ln)');

it only finds

Which overlooked the other one, since abs there is elsewhere in side ln.

I looked at help Definition of a Structured Type in Maple but do not know yet if there is an option there to do this. 

Is it possible to do this on one call?  Just wondering, that is all. The above works OK for me now.

 

Maple 2020.2

Is there one place which summarizes major difference between using solve vs. PDEtools:-Solve to solve equation? (ofcourse can one read help for both commands, and try to figure the differences this way, but this is not as easy as it sounds. I was looking more for a short basic summary type list. So I am making one myself in my maple cheat sheet).

I am trying to switch to PDEtools:-Solve from solve, but I keep noticing strange differences. Here is an example

example A

restart;
ode:=(x+1)*diff(y(x),x)+y(x)^(1/2) = 0;
ic:=y(0) = 1;
sol:=dsolve([ode,ic],y(x));
check:=odetest(sol,ode);
PDEtools:-Solve(check=0,x) assuming x>-1,x<6

Error, (in assuming) when calling 'PDEtools:-Solve'. Received: 'not a system with respect to the unknowns {x}'

Compare to 

restart;
ode:=(x+1)*diff(y(x),x)+y(x)^(1/2) = 0;
ic:=y(0) = 1;
sol:=dsolve([ode,ic],y(x));
check:=odetest(sol,ode);
solve(check=0,x) assuming x>-1,x<6;

                               x

Now, back to first example above using Solve. I moved the assuming inside, and now the error went away

Example B

restart;
ode:=(x+1)*diff(y(x),x)+y(x)^(1/2) = 0;
ic:=y(0) = 1;
sol:=dsolve([ode,ic],y(x));
check:=odetest(sol,ode);
PDEtools:-Solve(check=0,x,assume=[x>-1,x<6]);

But I noticed I can not do the same with solve. i.e. move the assuming inside solve, it now gives an error

restart;
ode:=(x+1)*diff(y(x),x)+y(x)^(1/2) = 0;
ic:=y(0) = 1;
sol:=dsolve([ode,ic],y(x));
check:=odetest(sol,ode);
solve(check=0,x,assume=[x>-1,x<6]);

Error, invalid input: too many and/or wrong type of arguments passed to solve; first unused argument is assume = [-1 < x, x < 6]

So first difference is that one can use assume= inside Solve, but not inside solve. Which is fine.

But I still not sure why first example A above gives error with Solve but not with solve. Any idea why that is?  Notice that example A gives an error with Solve, only when adding x<6 to the assumption. So this works

restart;
ode:=(x+1)*diff(y(x),x)+y(x)^(1/2) = 0;
ic:=y(0) = 1;
sol:=dsolve([ode,ic],y(x));
check:=odetest(sol,ode);
PDEtools:-Solve(check=0,x) assuming x>-1

No error, and now it gives

But was trying to find why it failed when adding x<6

Maple 2020.2 on windows 10.


 

This ode

restart;
ode:=(x+1)*diff(y(x),x)+y(x)^(1/2) = 0;
ic:=y(0) = 1;
sol:=dsolve([ode,ic],y(x))

Direct use of odetest does not give zero.

res:=odetest(sol,ode)

When asking Solve for possible values of x which makes the above zero, it only gave the upper bound

PDEtools:-Solve(res=0,x)

The actual range which makes res=0 is actually -1<x<exp(2)-1

res:=odetest(sol,ode) assuming -1<x,x<exp(2)-1

How could one using Maple obtain this range -1<x<exp(2)-1? 

Mathematica gives the answer using Reduce:

res=Log[Sqrt[x+1]]-1+Sign[Log[(x+1)]-2]*Log[Sqrt[x+1]]-Sign[Log[x+1]-2];
Reduce[res==0,x,Reals]

Is it possible to obtain such result in Maple, since Solve did not give complete answer.

Maple 2020.2

I do not underand why these two gives different results

restart;
mysol:= exp(sqrt( y(x)^2/x^2+1)) = _C1*x;
ode:=diff(y(x),x) = (y(x)^2+(x^2+y(x)^2)^(1/2)*x)/x/y(x);

And now case A:

simplify(odetest(mysol,ode)) assuming x>0;

                  0

But case B

res:=odetest(mysol,ode):
simplify(res) assuming x>0;

      #does not give zero

 

Why is putting the result in a variable first makes it give a different result?

What should one do so both case A and B give 0 ?

It looks like scoping issue of assuming. But this is really confusing, I did not expect that putting an intermediate result in a variable first will make a difference.

Maple 2020.2, Physis 897

In Latex 897 correct Latex is generated for the following code. In 905, wrong Latex is generated. This is different from the other cases I posted about (links below) and new issue.

In 897, the Latex generated for this example compiles with no error

restart;
sol:=(Vector(2, [x__1(t),x__2(t)])) = (Vector(2, [2^(3/4)*3^(1/4)*(exp(2^(3/4)*3^(1/4)*t)*_C1-exp(-2^(3/4)*3^(1/4)*t)*_C2-sin(2^(3/4)*3^(1/4)*t)*_C3+cos(2^(3/4)*3^(1/4)*t)*_C4),2*6^(1/2)*(exp(2^(3/4)*3^(1/4)*t)*_C1+exp(-2^(3/4)*3^(1/4)*t)*_C2-sin(2^(3/4)*3^(1/4)*t)*_C4-cos(2^(3/4)*3^(1/4)*t)*_C3)]));
Latex(sol)

Now compiling the Latex gives

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{maplestd2e}  

\begin{document}
\[
\left[\begin{array}{c}x_{1} \! \left(t \right) \\x_{2} \! \left(t \right) \end{array}\right]
 = 
\left[\begin{array}{c}2^{\frac{3}{4}} 3^{\frac{1}{4}} \left({\mathrm e}^{2^{\frac{3}{4}} 3^{\frac{1}{4}} t} \mathit{\_C1} -{\mathrm e}^{-2^{\frac{3}{4}} 3^{\frac{1}{4}} t} \mathit{\_C2} -\sin \! \left(2^{\frac{3}{4}} 3^{\frac{1}{4}} t \right) \mathit{\_C3} +\cos \! \left(2^{\frac{3}{4}} 3^{\frac{1}{4}} t \right) \mathit{\_C4} \right) \\2 \sqrt{6}\, \left({\mathrm e}^{2^{\frac{3}{4}} 3^{\frac{1}{4}} t} \mathit{\_C1} +{\mathrm e}^{-2^{\frac{3}{4}} 3^{\frac{1}{4}} t} \mathit{\_C2} -\sin \! \left(2^{\frac{3}{4}} 3^{\frac{1}{4}} t \right) \mathit{\_C4} -\cos \! \left(2^{\frac{3}{4}} 3^{\frac{1}{4}} t \right) \mathit{\_C3} \right) \end{array}\right]
\]
\end{document}

In 905

The Latex(sol) gives

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{maplestd2e}  

\begin{document}
\[
\left[\begin{array}{c}x_{1} \! \left(t \right) 
\\
 x_{2} \! \left(t \right) \end{array}\right]
 = 
\left[\begin{array}{c}2^{\frac{3}{4}} 3^{\frac{1}{4}} 
\\
\left({\mathrm e}^{2^{\frac{3}{4}} 3^{\frac{1}{4}} t} \textit{\_C1} -{\mathrm e}^{-2^{\frac{3}{4}} 3^{\frac{1}{4}} t} \textit{\_C2} -
\\
\sin \! \left(2^{\frac{3}{4}} 3^{\frac{1}{4}} t \right) \textit{\_C3} +\cos \! \left(2^{\frac{3}{4}} 3^{\frac{1}{4}} t \right) \textit{\_C4} \right) 
\\
 2 \sqrt{6}\, 
\\
\left({\mathrm e}^{2^{\frac{3}{4}} 3^{\frac{1}{4}} t} \textit{\_C1} +{\mathrm e}^{-2^{\frac{3}{4}} 3^{\frac{1}{4}} t} \textit{\_C2} -
\\
\sin \! \left(2^{\frac{3}{4}} 3^{\frac{1}{4}} t \right) \textit{\_C4} -\cos \! \left(2^{\frac{3}{4}} 3^{\frac{1}{4}} t \right) \textit{\_C3} \right) \end{array}\right]
\]
\end{document}

Which when compiled using texlive lualatex gives error. There is a missing \right. 

>lualatex foo5.tex
This is LuaHBTeX, Version 1.12.0 (TeX Live 2020)
 restricted system commands enabled.
(./foo5.tex
LaTeX2e <2020-10-01> patch level 2
.....
..Defaults to "dvips" Driver
(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/epsfig.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/graphicx.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/keyval.sty) (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/graphics.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/trig.sty) (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics-cfg/graphics.cfg) (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics-def/dvips.def))))
Defining Automatic Style Generation Macros
Defining Maple Spreadsheet Environments
Maple Spreadsheet and Table Support
) (/usr/local/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-luatex.def) (./foo5.aux) (/usr/local/texlive/2020/texmf-dist/tex/latex/base/ts1cmr.fd)
! Missing \right. inserted.
<inserted text>
\right .
l.14 \\

?


 

Maple 2020.2, Physics 905

Fyi, the issues I know about in Latex()  as of now are these 4

https://www.mapleprimes.com/questions/231398-Regression-In-Latex-Between-897-And?sq=231398

https://www.mapleprimes.com/questions/231397-Latex-Latex-Generates-Command-Not-In

https://www.mapleprimes.com/questions/231273-Why-Latex-Fail-To-Convert-Solution

https://www.mapleprimes.com/questions/231262-Latex-Generates-Wrong-Latex-For-This-Example

 

First 94 95 96 97 98 99 100 Last Page 96 of 199