MaplePrimes Questions

Dear all, 

I have a time-fractional PDE as follows.  ( denotes Caputo fractional derivative with respect to t) 

for alpha=1, this is a classical PDE and the exact solution is given as follows (in a book)

 

Question: 

 

1) for alpha=1, I want to find the L2 errors and L∞ errors in a table. 

2) for alpha=0.5, Can Maple find a solution (numeric or exact)?

 

MY TRY: (MAPLE 2020.2)

download the code.mw

restart:
with(plots):
PDE:=diff(y(x,t),t)=y(x,t)*diff(y(x,t),x$3)+y(x,t)*diff(y(x,t),x)+3*diff(y(x,t),x)*diff(y(x,t),x$2) ;


#c is an arbitratry constant
c:=4:
exact_sol:=(x,t)->-8*c/3*(cos ((x-c*t)/4))^2;

# I selected initial and boundary conditions as follows
IBC := { y(x,0)=exact_sol(x,0),y(0,t)=exact_sol(0,t),D[1](y)(0,t)=D[1](exact_sol)(0,t),y(1,t)=exact_sol(1,t)};
 	
numeric_sol := pdsolve(PDE,IBC,numeric);

num3d:=numeric_sol:-plot3d(t=0..1,x=0..1,axes=boxed,
            color=[0,0,y]);
exact3d:=plot3d(exact_sol(x,t),t=0..1,x=0..1,axes=boxed);
display(exact3d,num3d);

pdetest(y(x,t)=exact_sol(x,t),PDE,IBC);


Hi

I have a system of pde that it is solved with pdsolve procedure.

This procedure takes a few time, but when I need to do plots, especially 3d plot the software takes a lot of time (several hours).

How can I make plots faster?
Thanks.

The problem: to simplify the expression

for any negative  x  and  y .

Below we see that Maple copes with the task brilliantly (example 1). For example, it presents  sqrt(x*y)  as  sqrt(-x)*sqrt(-y)  and so on. But the same technique, applied only to the numerator of this expression does not give the desired presentation in the form of a square (example 2 and example 3).

restart;
# Example 1
A:=(x+y-2*sqrt(x*y))/(sqrt(-x)+sqrt(-y));
simplify(A) assuming negative;
factor(%,{sqrt(-x),sqrt(-y)});

                                         

restart;
# Example 2
B:=x+y-2*sqrt(x*y);
simplify(B) assuming negative;
factor(%,{sqrt(-x),sqrt(-y)});

                                           

 

restart;
# Example 3
B:=x+y-2*sqrt(x*y);
R:=simplify(B) assuming positive;
combine(R) assuming positive;
factor(R,{sqrt(x),sqrt(y)});

                                                   

Two questions:

1. Does anyone know the reasons for this behavior.

2. Does anyone know an easy way to simplify in examples 2 and 3 (without  substitutions  like  x=+-u^2  and  y=+-v^2 and so on,  of course)

 

Download sqrt.mw

 

I am using solution given in How-To-Make-Sort-Work-With-Alias which works well.

But on more testing, I found that Latex drops the constant of integration after applying the above solution, when this constant shows at the front of the rhs of the expression.

I have no idea why this happens. I will post two examples. The first shows the problem with the Latex generated, showing the constant is missing from the Latex. The second example is where I moved the constant  to inside the expression keeping everything else the same, and now the Latex generated no longer drops it. 

This is serious problem, since now my solutions are losing constant of integration in Latex display depending on where it is located.

example 1

restart;
assign(seq(`print/_C`||k, k=0..10) = seq(c[k], k=0..10)):
S:=[seq(_C||k = _C||k(), k=0..10)]:

sol:= y(x) = _C1/cosh(x)+(cosh(x)^2+cosh(x)*sinh(x)+x)/cosh(x);
sol:=subs(S, sort(sol));

Now watch what happens to the Latex of the above

Latex(sol)

y \! \left(x \right) = 
\frac{1}{\cosh \! \left(x \right)}+\frac{\cosh^{2}x +\cosh \! \left(x \right) \sinh \! \left(x \right)+x}{\cosh \! \left(x \right)}

Which compiles to 

\documentclass[11pt]{article}
\usepackage{amsmath}
\begin{document}
\[
y \! \left(x \right) = \frac{1}{\cosh \! \left(x \right)}+\frac{\cosh^{2}x +\cosh \! \left(x \right) \sinh \! \left(x \right)+x}{\cosh \! \left(x \right)}
\]
\end{document}

Now will do the same, but move the constant to the second term. Now it shows up

example 2

restart;
assign(seq(`print/_C`||k, k=0..10) = seq(c[k], k=0..10)):
S:=[seq(_C||k = _C||k(), k=0..10)]:

sol:= y(x) = 1/cosh(x)+ _C1*(cosh(x)^2+cosh(x)*sinh(x)+x)/cosh(x);
sol:=subs(S, sort(sol));

Now generate the latex

Latex(sol)

y \! \left(x \right) = 
\frac{\left(\cosh^{2}x +\cosh \! \left(x \right) \sinh \! \left(x \right)+x \right) c_{1}}{\cosh \! \left(x \right)}+\frac{1}{\cosh \! \left(x \right)}

Which compiles to 

\documentclass[11pt]{article}
\usepackage{amsmath}
\begin{document}
\[
y \! \left(x \right) = 
\frac{\left(\cosh^{2}x +\cosh \! \left(x \right) \sinh \! \left(x \right)+x \right) c_{1}}{\cosh \! \left(x \right)}+\frac{1}{\cosh \! \left(x \right)}
\] 
\end{document}

I am using 2020.2 with Physics 893 on windows 10.

Any idea what is going on? And why this happens when constant is at front only?

ps. the Purpose of using the solution in the above link, is to be able to use c[1] instead of _C1 in the final latex, and also have these constants show at front (this is what sort does) which makes the final expression better looking).

Thank you

Edit

In the debugger, going over Latex() function, I found where the problem happen.  There is a call near line 20 which does this

              Latex:-Print(e,':-executeprintroutines');

Where is the input. Which in this case is the sol expression passed to the Latex command.

Removing ':-executeprintroutines' from the above call, the constant remain there and is not lost.

It seems assign(seq(`print/_C`||k, k=0..10) = seq(c[k], k=0..10)): used before the call to Latex is confusing things.

Here is illustration:

restart;
assign(seq(`print/_C`||k, k=0..10) = seq(c[k], k=0..10)):
S:=[seq(_C||k = _C||k(), k=0..10)]:
sol:= y(x) = _C1/cosh(x)+(cosh(x)^2+cosh(x)*sinh(x)+x)/cosh(x);
sol:=subs(S, sort(sol));


Latex:-Print(sol,':-executeprintroutines');
Latex:-Print(sol);

And the output of the last 2 commands is

This shows when using ':-executeprintroutines' the constant is lost. I do not know what ':-executeprintroutines' does or where it is defined to try to modify it.

There is a problem here somewhere. Maple hangs on this ODE. Looking at trace, it hangs in trying homogeneous G

is this a known defect and could be resolved?

restart;
infolevel[dsolve]:=4;
dsolve(x^3*diff(y(x),x)^2+x*diff(y(x),x)-y(x) = 0,y(x))

... hangs

Adding different timelimits, it looks like the function gcd/LinZip is the culprit. Since it always seems to be there each time the timelimit expires (if it expires, sometimes it hangs even with timelimit).  But I noticed the above function many times in timelimit. So it seems the above functions is what causes many of the hangs I see.

Using `Lie` method, dsolved finishes almost instantly.

restart;
dsolve(x^3*diff(y(x),x)^2+x*diff(y(x),x)-y(x) = 0,y(x),'Lie')

This is on Maple 2020.2

It would be useful to know the cause of the hang, as fixing it could solve other problems.

I also notice that on Maple 2019.2 the first example above finished very fast also. So this is an issue that was introduced in Maple 2020.

All on windows 10.

I am having hard time controlling my Latex:-Settings now. The issue is that I do not know what each setting accepts as values, and what each value does.  The way I've been doing it is by collecting what useful ones posted in this forum, and what it does and save it in my cheat sheet. 

But now I see I need to change something, but not sure to what.

Is there a way to find what all the settings are, and description  of what each does and accepts as values? For example, 

            powersoftrigonometricfunctions

Accepts mixed and computernotation  But where are these described in terms of what they do? does it accept anything else?  Notice that ?leavespaceafterfunctionname does not show anything.

If I do 

restart;
Latex:-Settings()

it gives

[cacheresults = true, invisibletimes = " ", leavespaceafterfunctionname = false, 
powersoftrigonometricfunctions = mixed, spaceaftersqrt = true, usecolor = true, 
useimaginaryunit = I, useinputlineprompt = true, userestrictedtypesetting = false, 
usespecialfunctionrules = true, usetypesettingcurrentsettings = false]

But do not know how to obtain full description and possible value of each to see what they mean and do.

I think having Latex:-Settings() is a great idea, as it allows maximum flexibility for user to configure how they want the Latex output to be, but as more options are added, this type of information become more important to know and to keep track of.

I am using 2020.2 and Physics version 893

 

Maple seems to have difficulty computing this sum, which occurs in molecular physics of the H atom.

fd := j -> 2^8*j^5*(j-1)^(2*j-4)/(3*(j+1)^(2*j+4));

sum(fd(n)*ln(1-1/n^2), n=2..infinity);

Can anybody discover a solution, please?

It's been about a year since I've been able to display any worksheet at all on MaplePrimes. In the example below, I took a very simple worksheet that had been displayed in an Answer to another recent Question and tried to upload it. So, we know that it's somehow possible to display this particular worksheet on MaplePrimes.

Maple Worksheet - Error
Failed to load the worksheet /maplenet/convert/prove.mw .
Download prove.mw

hi. 

i want to plot these two equation that z is complex. 

i try it by implicitplot but for the second one it's not work. thank you

I was trying to find if the type of module wide variable is considered local or global.

I have an exported variable in module. Maple then said it was local . OK

restart;
foo:=module()
   export n::integer;
   export boo:=proc()::integer;
     return n;
   end proc;       
end module;
                   

n:=foo:-boo():
type(n,`local`);

               # true

But when I did this

restart;
foo:=module()
   export n::integer;
end module;

n:=foo:-n;
type(n,`local`)

         #false

Now Maple says it no longer local.

What is the difference? The module wide variable is exported in both cases. So one can access it directly like in the second example above, or via call to a proc inside the module, which returns it.

Why in one case it is local and in the second case it is not?

Ok, I found the issue. It seems when doing return  n; in the first example above, it created and returned a local n to the proc itself (where n was not declared in the example). (even though maplemint did not complain. Strange).

I have assumed when doing return n Maple will know this is the module wide variable n since that is the closest one around.  i.e. the proc is inside the module. And sits inside the module. So return n should referenced this variable. But it did not, because when I changed the code to this

restart;
foo:=module()
   export n::integer;
   export boo:=proc()::integer;
     return foo:-n;
   end proc;       
end module;

n:=foo:-boo():
type(n,`local`);

     #false

Now it returned false. The same as the second example.

But it also returned false when asking if it is global

n:=foo:-boo():
type(n,`global`);

    #false

So the module wide variable in this example is not local and is not global.

Is there another type to use to check if the variable/symbol returned is a module wide type?

Maple 2020.2

I assume the goal is to have the Latex output close to the screen output in Maple. In these examples this is the case.

Example 1

restart;
A:=Matrix([[1,-1,0,2],[1,2,2,-2],[0,2,3,-1]]):
LinearAlgebra:-NullSpace(A)

But the Latex generated for the above, using the Latex() command is

\{ \left[\begin{array}{c}0 \\2 \\-1 \\1 \end{array}\right] \} 

Which when compiled

\documentclass[11pt]{article}
\usepackage{amsmath}
\begin{document}
\[
\{ \left[\begin{array}{c}0 \\2 \\-1 \\1 \end{array}\right] \} 
\]
\end{document}

gives

The latex should instead be 

\left\{ \left[\begin{array}{c}0 \\2 \\-1 \\1 \end{array}\right] \right\} 

Which compiles to

Example 2

restart;
A:=Matrix([[1,-1,0,2],[1,2,2,-2],[0,2,3,-1]]):
LinearAlgebra:-RowSpace(A)

The Latex of the above is 

[\left[\begin{array}{cccc}1 & 0 & 0 & 0 \end{array}\right], 
\left[\begin{array}{cccc}0 & 1 & 0 & -2 \end{array}\right], 
\left[\begin{array}{cccc}0 & 0 & 1 & 1 \end{array}\right]]

Which when compiled gives

\documentclass[11pt]{article}
\usepackage{amsmath}
\begin{document}
\[
[\left[\begin{array}{cccc}1 & 0 & 0 & 0 \end{array}\right], 
\left[\begin{array}{cccc}0 & 1 & 0 & -2 \end{array}\right], 
\left[\begin{array}{cccc}0 & 0 & 1 & 1 \end{array}\right]]
\]  
\end{document}

gives

A better Latex would be

\left[\left[\begin{array}{cccc}1 & 0 & 0 & 0 \end{array}\right], 
\left[\begin{array}{cccc}0 & 1 & 0 & -2 \end{array}\right], 
\left[\begin{array}{cccc}0 & 0 & 1 & 1 \end{array}\right]\right]

Which compiles to

Now the size of the [[ is the same on both ends.

example 3

restart;
A:=Matrix([[1,-1,0,2],[1,2,2,-2],[0,2,3,-1]]):
LinearAlgebra:-ColumnSpace(A)

The Latex given for the above is

[\left[\begin{array}{c}1 \\0 \\0 \end{array}\right], 
\left[\begin{array}{c}0 \\1 \\0 \end{array}\right], 
\left[\begin{array}{c}0 \\0 \\1 \end{array}\right]]

Which when compiled

\documentclass[11pt]{article}
\usepackage{amsmath}
\begin{document}
\[
[\left[\begin{array}{c}1 \\0 \\0 \end{array}\right], 
\left[\begin{array}{c}0 \\1 \\0 \end{array}\right], 
\left[\begin{array}{c}0 \\0 \\1 \end{array}\right]]
\]  
\end{document}

gives

A better Latex is

\left[\left[\begin{array}{c}1 \\0 \\0 \end{array}\right], 
\left[\begin{array}{c}0 \\1 \\0 \end{array}\right], 
\left[\begin{array}{c}0 \\0 \\1 \end{array}\right]\right]

Which compiles to 

Maple 2020.2 with Physics  891 

I'm trying to just use "ThermophysicalData:-Chemical" function  to calculate below:

1 mol water vapor(H2O,g) condenses to liquid water  at 100C and 101.325kPa

Is there a function embeded to calculate DeltaW/H/S while switching the phases of matter.

thank you.

 

Here is the problem. I am trying to use sort() to make solution to ode show up with constant of integrations _C1 at the front of the term, instead of how Maple shows it, which is after the term, which does not look good.

As recommened in  Why-Maple-Refuses-To-Change-Location

sort() works well. Except for this: I am also using alias for the constant of integrations, to get nicer Latex output, as recommended in earlier post (which I can't find now). 

But once I use alias, now sort no longer produce the result I want. Here is an example

restart;
sol:=dsolve(diff(y(x),x) = x+y(x),y(x));
sort(sol)

Here sort works. It moved the term with constant of integration to the front, and _C1 at front, which is what I want as it looks more clear.

But when I do 

restart;
alias(seq(c[k]=_C||k,k=0..10)):
sol:=dsolve(diff(y(x),x) = x+y(x),y(x));
sort(sol)

This is because, I am assuming, the order of _C1 is higher than c[1] and sort is using the alias of _C1 to sort on and not _C1 itself.

The only reason I am using alias, is to get nicer Latex output when converting the solution to Latex vs. when using _C1

Is there a way to tell sort to treat c[1] as _C1, and c[2] as _C2, etc...  in terms of lexicographical ordering?

I see an order option for the command sort() in help, but so far did not know how to use it for the above purpose. This only affects _C1,_C2,_C3,_C4,.. and nothing else and I only use sort() on the output of the solution of ode. May be I need to write an order function and in there tell it c[1] has same order as _C1? But _C1 has c[1] as alias? so I do not think this will not work.

Basically I want to use the alias, but also use sort() on the result as if these constants of integrations where _C1,_C2, etc..

in my code, I set the alias at the global level, before I call any function in my package.

Any ideas how to do this or workaround this?

Maple 2020.2 on windows

 

An exercise of 1948 commits me to form the equation of conics passing by 3 points. Let P=0, Q=0, R=0 be the equations of the sides of the triangle ABC; if we associate these sides 2 to 2 we obtain 3 conics passing through points A, B, C having for equations QR=0, RP=0, PQ=0. As a result, the general equation of conics around the triangle ABC is: aQR+bRP+cPQ=0. P, Q, R being equations of the form mx+ny+pz=0 (so-called homogeneous coordinates). Then change to refined coordinates with x+y+z=1 (formula found on the internet and surely misinterpreted). Is it necessary to change of base ? Thank you for your help.

Given a metric, to compute quantities in the NP formalism one needs to specify a null tetrad. In the various examples in the help pages, sometimes the tetrad is specified simply as a list of 4 vectors, e.g., NT := [...] and sometimes evalDG is applied as in NT := evalDG({...]). Using the first format, Maple accepted NT as argument in NPSpinCoefficients but  NPCurvatureScalars(SpinCoefficients,NT) complained that the second argument wasn't a list of four vectors. When I used the second format, both commands returned the expected results. Why the difference?

RobinsonTrautmanSpinDG.mw

First 343 344 345 346 347 348 349 Last Page 345 of 2308