nm

11353 Reputation

20 Badges

13 years, 13 days

MaplePrimes Activity


These are replies submitted by nm

@wanderson 

Can you give me some references??

A good way to find what methods Maple used to solve an ode or pde is to turn on the infolevel for that command before calling the solver. For your system, it gives

restart; 
infolevel[pdsolve]:=4;
pde1:= diff(C(x,t),t)=d* diff(C(x,t),x$2)- k*epsilon(x)*C(x,t);
ode:= diff(epsilon(x),x)=-mu*k*epsilon(x)*C(x,t);
pdsolve([pde1,ode],[C(x,t),epsilon(x)]) assuming x>a,x<=b,t>0

Then  looking at the trace output printed will show what methods/algorithm were used. 

......
First set of solution methods (general or quasi general solution)
   -> trying differential factorization for linear PDEs ...
   -> trying methods for PDEs "missing the dependent variable" ...
   -> trying missing independent variables
   -> trying the Laplace's method
   -> trying a first integral mapping the PDE into and ODE plus parameters
.....

For an example, let's take a look at a simpler and more standard diffusion/heat PDE on 1D on finite domain since we know that the most common analytical method, learned from text books is the seperation of variables which generate a series solution. And this is indeed what Maple uses:

restart; 
infolevel[pdsolve]:=4;
pde := diff(T(x,t), t) = k*diff(T(x,t), x$2);
bc  := T(0,t) = 0, T(L,t) = 0;
ic  := T(x,0) = f(x);
pdsolve([pde, ic, bc],T(x,t)) assuming k>0,L>0,t>0,x>0

Looking at the trace printed on screen it says

....
* trying method "Series" for 2nd order PDEs
....
      HINT = *
      Trying methods for second order linear PDEs
....
<- method "Series" for 2nd order PDEs successful

So it uses separation of variables (also called the series method, since the output is series)

So you can use this to find more how Maple solves pde's and ode's and what methods/algorithms it uses.

 

@wanderson 

But the second equation ist Not a pde!

Yes I know. I just called the variable pde2 as I was writing. But will correct it now by calling the variable ode instead as follows

restart; 
pde1:= diff(C(x,t),t)=d* diff(C(x,t),x$2)- k*epsilon(x)*C(x,t);
ode:= diff(epsilon(x),x)=-mu*k*epsilon(x)*C(x,t);
pdsolve([pde1,ode],[C(x,t),epsilon(x)]) assuming x>a,x<=b,t>0

pdsolve can be used on system of equations, if one of them is pde. Like this

ode:=diff(y(x),x)=x;
pde:=diff(v(x,t),t)=v(x,t)+y(x);
pdsolve([ode,pde],[v(x,t),y(x)])

btw, the title of your own question is called

                      "coupled partial differential equations"

Which numerical method the maple use?

There are no numerical methods at all used here. It is an analytical solution. Numerical methods can't be used on this problem since it is missing initial/boundary conditions and contains parameters which have no numerical values.

 

@BrettKnoss 

Why did you add C:\Program Files\Maple 2020\bin.X86_64_WINDOWS  to TEXINPUTS environment variable? It should be the folder that contains the style files. On my PC they are in C:\Program Files\Maple 2020\etc

Search for this folder on your PC if there are somewhere else. 

@Carl Love 

It is possible to use Latex for both HTML and PDF final output, I do this all the time. My whole web site is written in Latex.

To generate HTML from latex, TeXLives comes with tex4ht, which is a program written many years ago by a Professor who unfortunately passed away too young.

This program is called tex4ht and is still in active development and part of texlive, and converts Latex to HTML.

Current version of tex4ht, also supports mathjax, which means the Latex is displayed in the browser using mathjax, which gives a very pretty display of Latex/Math on the web page, much better than anything out there.

Maplesoft should use Latex for its HTML help pages on the net, to make them readable as compared to what they look now, half of them one can't even read the math on them, since it is all mangled up and missing many items.

I also have no idea why OP is generating Latex and adding those "#mt" and "#mn" stuff in there. This makes no sense. I never used these "#" things, since all my output from Maple ends up as Latex.

 

@Preben Alsholm 

I put new video. it might depends if you do this from Fresh Maple or not. You might need to try couple of time, as the new video shows. I do not understand what is going on myself, but you can see the solution changes.

 

@tomleslie 

FYI, I added a movie also. 

I am using windows 10 pro, 64 bit.

@dharr 

The "x" there does not look the same as the "x" I get from Latex itself (default font, computer modern). Which is (in math mode $x$)

Is it possible to get your example to look like the above? 

 

 

 

 

@dondomingo 

I've added 2 examples. I've used solve() here. There is also PDEtools:-Solve() command you might want to look at.

@ecterrab 

Thank you very much for this new setting.  I removed the macro. Not needed any more. This setting is even better, as it seems somehow smart enough to know when \, is needed and when not needed. I do not know how it does this.

Here is the result for example. One can see \,  is added only in the places where it was a problem. In the case of the macro I had, the \, was added everywhere after \sqrt even when is not needed.

This is why I said fixing things at the source of generation is always better than afterwords.

Thanks for this fix.


 

interface(version);
Physics:-Version();

`Standard Worksheet Interface, Maple 2020.2, Windows 10, November 11 2020 Build ID 1502365`

`The "Physics Updates" version in the MapleCloud is 884 and is the same as the version installed in this computer, created 2020, November 25, 16:49 hours Pacific Time.`

restart;

Latex:-Settings(UseImaginaryUnit=i,
      UseColor = false,
      powersoftrigonometricfunctions= computernotation,
      leavespaceafterfunctionname = true,
      cacheresults = false,
      spaceaftersqrt = true     
);

`* Partial match of  '`*UseImaginaryUnit*`' against keyword '`*useimaginaryunit*`' `

`* Partial match of  '`*UseColor*`' against keyword '`*usecolor*`' `

[powersoftrigonometricfunctions = computernotation, leavespaceafterfunctionname = true, cacheresults = false, spaceaftersqrt = true, useimaginaryunit = i, usecolor = false]

expr1:=sqrt((3+x)^2+1)*a+sin(x);
Latex(expr1)

((3+x)^2+1)^(1/2)*a+sin(x)

\sqrt{\left(3+x \right)^{2}+1}\, a +\sin \left(x \right)

expr2:=sqrt((3+x)^2+1)/5+b;
Latex(expr2)

(1/5)*((3+x)^2+1)^(1/2)+b

\frac{\sqrt{\left(3+x \right)^{2}+1}}{5}+b

expr3:=sqrt(x)/5+b;
Latex(expr3)

(1/5)*x^(1/2)+b

\frac{\sqrt{x}}{5}+b

expr4:=(sqrt((3+x^2)+3)*c)/5+b;
Latex(expr4)

(1/5)*(x^2+6)^(1/2)*c+b

\frac{\sqrt{x^{2}+6}\, c}{5}+b

expr5:=diff(y(x),x)=sqrt(x+y)*a;
Latex(expr5)

diff(y(x), x) = (x+y)^(1/2)*a

\frac{d}{d x}y \left(x \right) = \sqrt{x +y}\, a

 


 

Download improved_space_after_sqrt.mw

 

I get an error in Maple 2020.2

 

 

@ecterrab 

Thanks for the new setting. But this will have a global adverse effect, as it affects all products spacing, which I did not want. 

I was only looking for space after sqrt. But good to have this new setting there, in case someone could use it.

I ended up just adding a small macro for the \sqrt, to redefine it, to add space. Please see below. I added this to my Maple latex preamble. And it seem to work OK. (But I need to test this more on my main Latex file)

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{longtable}
\usepackage{mleftright}  
\mleftright

%change \sqrt to add \, after. Use letltxmacro package (safer)
\usepackage{letltxmacro}
\LetLtxMacro{\oldsqrt}{\sqrt}
\renewcommand{\sqrt}[1]{\oldsqrt{#1}\,}
%end patch

\begin{document}
\begin{longtable}{|p{3in}|p{3in}|}\hline
\[
y'(x)=\sqrt{x+y}a
\]\\\hline 
\[
\sqrt{\left(3+x \right)^{2}+1} a +\sin \left(x \right)
\]
\\\hline 
\[
\frac{\sqrt{\left(3+x \right)^{2}+1}}{5}+b
\]
\\\hline 
\[
\frac{\sqrt{x}}{5}+b
\]
\\\hline 
\[
\frac{\sqrt{x^{2}+6} c}{5}+b
\]
\\\hline 
\end{longtable}
\end{document}

Gives

Without this macro, the output will look like this (which is what one will get from Maple now)

Thanks.

@itsme 

you mention \int, but do you really mean \sqrt? or did i miss something?

opps, sorry that was a typo. I was talking about sqrt. I do not know why I wrote int.  it was very late.

There is no such issue with int. Since int will either evaluate automatically and if not, then Maple Latex automatically puts a () around it, which avoids the issue with  the spacing in the case of the sqrt as you can see below
 

interface(version);
Physics:-Version();

`Standard Worksheet Interface, Maple 2020.2, Windows 10, November 11 2020 Build ID 1502365`

`The "Physics Updates" version in the MapleCloud is 882. The version installed in this computer is 881 created 2020, November 21, 11:11 hours Pacific Time, found in the directory C:\Users\me\maple\toolbox\2020\Physics Updates\lib\`

restart;

Latex:-Settings(UseImaginaryUnit=i,
      UseColor = false,
      powersoftrigonometricfunctions= computernotation,
      leavespaceafterfunctionname = true,
      cacheresults = false
);

`* Partial match of  '`*UseImaginaryUnit*`' against keyword '`*useimaginaryunit*`' `

`* Partial match of  '`*UseColor*`' against keyword '`*usecolor*`' `

[powersoftrigonometricfunctions = computernotation, leavespaceafterfunctionname = true, cacheresults = false, useimaginaryunit = i, usecolor = false]

expr1:=Int((3+x)^2+1,x)*a;
Latex(expr1)

(Int((3+x)^2+1, x))*a

\left(\int \left(\left(3+x \right)^{2}+1\right)d x \right) a

expr2:=int(f(x),x)*a;
Latex(expr2)

(int(f(x), x))*a

\left(\int f \left(x \right)d x \right) a

expr3:=int((3+x)^2+1,x)*a;
Latex(expr3)

((1/3)*(3+x)^3+x)*a

\left(\frac{\left(3+x \right)^{3}}{3}+x \right) a

 

 

Download space_after_int.mw

Often latex is excellent at doing the formatting/typesetting just right, although I agree that in some circumstances one might like to do some tweaking.

Yes, sure. 99% of the Latex questions at tex.stackexchange.com are about this kind of tweeking. And only Latex experts who know Latex very well (which I am not one of them) can craft such macros, since some can be complicated. 

So if these tweeks can be automated and fixed at the Latex generation source, all the better, as it will benefit everyone.

Having this in settings options is good idea also, in case one wants to turn on/off, using Latex:-Settings(....).

ps. I generate lots of Latex, 10'000 of pages of PDF's each time. All automated from CAS, so having good Latex quality is very important. 

 

Was something wrong with the reply I gave earlier for your deleted question

?

If so, why not reply to that post instead? Now my reply is lost.

 

You said

Eliminate hangs when using timelimit(). On long runs, random hangs happen when timelimit() do not expire as requested. Posted about this before.

I thought to post a typical example of this most annoying problem for me in Maple. Since it cause hangs in a script at places I have no control over. So when I run a script, I never know if it will hang or not and where as it seems to be random and it depends on the amount of timeout used.

I hope this gets fixed in next version of Maple. I have many many more such examples.

restart;
ode:=diff(y(t),t) = 1+y(t)+y(t)^2*cos(t);
sol:=dsolve(ode,y(t)):
timelimit(60,odetest(sol,ode));

And now it hangs. I waited for over 15 minutes, even though the time out is 60 seconds.

I know the solution is very complicated. But Maple should never hangs in a timelimit, in spite of what help says.

Note: In some cases, the execution may not abort at exactly the time limit imposed, but will abort as soon as it can do so safely.  This can happen when execution is in critical sections of certain built-in routines.

I am not asking for exact timeout ofcourse, but it should not be much more than 60 seconds, give and take few seconds.

I am sorry, but the above is just not acceptable for a software that has been around for more than 30 years now.

I worked on the development of the internals of a major operating system before. I know timeouts could always be implemented, no matter what the circumstances are, even if code is running inside a critical section. 

In Mathematica for example, this never happens. https://reference.wolfram.com/language/ref/TimeConstraint.html and timeouts there always timeout. Each time and everytime. 

Maple 2020.2 on windows 10.

Thank you

edit

After few more minutes, the above example did time out finally.  But took much much longer than the actual timelimit given. Waiting for say 20 minutes, when the timelimit is 1 minute is not right. As I said, it is not determistic. So each time it seems to behave differently.

 

 

First 45 46 47 48 49 50 51 Last Page 47 of 91