nm

11353 Reputation

20 Badges

13 years, 14 days

MaplePrimes Activity


These are replies submitted by nm

@Rouben Rostamian  

I am sorry, I do not understand why you said that the degree is not defined for the first example you show.

The first one has degree one, since the power on the highest derivative is one. Using Carl's code given in answer below confirms:

ode:= diff(x(t),t$2)+sin(x(t))=0;
ODEdegree(ode);

           1

The degree becomes 2 in this case

ode:= diff(x(t),t$2)^2+sin(x(t))=0;
ODEdegree(ode);

    2

@Rouben Rostamian  

 

https://en.wikipedia.org/wiki/Degree_of_a_differential_equation

"In mathematics, the degree of a differential equation is the power of its highest derivative, after the equation has been made rational and integral in all of its derivatives"

I need to find this during parsing of ODE to help me decide if I can solve it or not.

@Thomas Richard 

thanks. But it is strange, that Maple, being the best CAS in ODE's does not have a buildin function to find the degree of an ODE in addition to the order.

May be this is something Maplesoft could add for the next release.

First, you do not need to write “c://Users//hello//Documents//h.m”. it is either “c:/Users/hello/Documents/h.m” or  “c:\\Users\\hello\\Documents\\h.m”

But have you tried to open h.m  yourself from outside Maple? does it work? And have you tried to check what security there are on the folder itself?

@Carl Love 

There is still a case which is given a problem. This is what Maple returns solutions as sequence of lists. Here is example


 

restart;

depvars:= (pde::{algebraic, `=`(algebraic), {set,list}(algebraic, `=`(algebraic))})->
   indets(
      indets(convert(pde, diff), specfunc(diff)),
      And(typefunc(name, name), Not(typefunc({mathfunc, identical(diff)})))
   ):

is_solution_trivial:= (pde, sol::{`=`, set(`=`),`function`})->
   evalb(eval(`if`(sol::set, sol, {sol}), depvars(pde)=~ 0) = {0=0}):


pde:= diff(u(x,t),t)= u(x,t)*(1-u(x,t))+ diff(u(x,t),x$2):
sol:={PDEtools:-TWSolutions(pde,u(x,t))};
is_solution_trivial(pde,sol)

{{u(x, t) = 1}, {u(x, t) = (1/4)*tanh(-(5/12)*t-(1/12)*6^(1/2)*x+_C1)^2-(1/2)*tanh(-(5/12)*t-(1/12)*6^(1/2)*x+_C1)+1/4}, {u(x, t) = (1/4)*tanh(-(5/12)*t+(1/12)*6^(1/2)*x+_C1)^2-(1/2)*tanh(-(5/12)*t+(1/12)*6^(1/2)*x+_C1)+1/4}, {u(x, t) = -(1/4)*tanh(-(5/12)*t-((1/12)*I)*6^(1/2)*x+_C1)^2-(1/2)*tanh(-(5/12)*t-((1/12)*I)*6^(1/2)*x+_C1)+3/4}, {u(x, t) = -(1/4)*tanh(-(5/12)*t+((1/12)*I)*6^(1/2)*x+_C1)^2-(1/2)*tanh(-(5/12)*t+((1/12)*I)*6^(1/2)*x+_C1)+3/4}, {u(x, t) = (1/4)*tanh((5/12)*t-(1/12)*6^(1/2)*x+_C1)^2+(1/2)*tanh((5/12)*t-(1/12)*6^(1/2)*x+_C1)+1/4}, {u(x, t) = (1/4)*tanh((5/12)*t+(1/12)*6^(1/2)*x+_C1)^2+(1/2)*tanh((5/12)*t+(1/12)*6^(1/2)*x+_C1)+1/4}, {u(x, t) = -(1/4)*tanh((5/12)*t-((1/12)*I)*6^(1/2)*x+_C1)^2+(1/2)*tanh((5/12)*t-((1/12)*I)*6^(1/2)*x+_C1)+3/4}, {u(x, t) = -(1/4)*tanh((5/12)*t+((1/12)*I)*6^(1/2)*x+_C1)^2+(1/2)*tanh((5/12)*t+((1/12)*I)*6^(1/2)*x+_C1)+3/4}}

Error, invalid input: is_solution_trivial expects its 2nd argument, sol, to be of type {`=`, function, set(`=`)}, but received {{u(x, t) = 1}, {u(x, t) = (1/4)*tanh(-(5/12)*t-(1/12)*6^(1/2)*x+_C1)^2-(1/2)*tanh(-(5/12)*t-(1/12)*6^(1/2)*x+_C1)+1/4}, {u(x, t) = (1/4)*tanh(-(5/12)*t+(1/12)*6^(1/2)*x+_C1)^2-(1/2)*tanh(-(5/12)*t+(1/12)*6^(1/2)*x+_C1)+1/4}, {u(x, t) = -(1/4)*tanh(-(5/12)*t-((1/12)*I)*6^(1/2)*x+_C1)^2-(1/2)*tanh(-(5/12)*t-((1/12)*I)*6^(1/2)*x+_C1)+3/4}, {u(x, t) = -(1/4)*tanh(-(5/12)*t+((1/12)*I)*6^(1/2)*x+_C1)^2-(1/2)*tanh(-(5/12)*t+((1/12)*I)*6^(1/2)*x+_C1)+3/4}, {u(x, t) = (1/4)*tanh((5/12)*t-(1/12)*6^(1/2)*x+_C1)^2+(1/2)*tanh((5/12)*t-(1/12)*6^(1/2)*x+_C1)+1/4}, {u(x, t) = (1/4)*t ... )*6^(1/2)*x+_C1)^2+(1/2)*tanh((5/12)*t+((1/12)*I)*6^(1/2)*x+_C1)+3/4}}

sol

{u(x, t) = 1}, {u(x, t) = (1/4)*tanh(-(5/12)*t+(1/12)*6^(1/2)*x+_C1)^2-(1/2)*tanh(-(5/12)*t+(1/12)*6^(1/2)*x+_C1)+1/4}, {u(x, t) = (1/4)*tanh((5/12)*t-(1/12)*6^(1/2)*x+_C1)^2+(1/2)*tanh((5/12)*t-(1/12)*6^(1/2)*x+_C1)+1/4}, {u(x, t) = (1/4)*tanh(-(5/12)*t-(1/12)*6^(1/2)*x+_C1)^2-(1/2)*tanh(-(5/12)*t-(1/12)*6^(1/2)*x+_C1)+1/4}, {u(x, t) = (1/4)*tanh((5/12)*t+(1/12)*6^(1/2)*x+_C1)^2+(1/2)*tanh((5/12)*t+(1/12)*6^(1/2)*x+_C1)+1/4}, {u(x, t) = -(1/4)*tanh(-(5/12)*t+((1/12)*I)*6^(1/2)*x+_C1)^2-(1/2)*tanh(-(5/12)*t+((1/12)*I)*6^(1/2)*x+_C1)+3/4}, {u(x, t) = -(1/4)*tanh((5/12)*t-((1/12)*I)*6^(1/2)*x+_C1)^2+(1/2)*tanh((5/12)*t-((1/12)*I)*6^(1/2)*x+_C1)+3/4}, {u(x, t) = -(1/4)*tanh(-(5/12)*t-((1/12)*I)*6^(1/2)*x+_C1)^2-(1/2)*tanh(-(5/12)*t-((1/12)*I)*6^(1/2)*x+_C1)+3/4}, {u(x, t) = -(1/4)*tanh((5/12)*t+((1/12)*I)*6^(1/2)*x+_C1)^2+(1/2)*tanh((5/12)*t+((1/12)*I)*6^(1/2)*x+_C1)+3/4}

convert([sol],`sequence`)

Error, unrecognized conversion: sequence

 


 

Download bug_june_25_2019_2.mw

I had to put {} around the result, since it is sequence, in order to make it a list.  But now it becomes a list of lists, and this is why it gives an error. I'll see if I can find a work around for this case.

 

 

@Carl Love 

Hello; I found a small bug. Sometimes pdsolve returns a solution which of type 'function', and hence your is_solution_trivial function now fails on it. Here is an example


 

restart;

unassign('u,x,t');
depvars:= (pde::{algebraic, `=`(algebraic), {set,list}(algebraic, `=`(algebraic))})->
   indets(
      indets(convert(pde, diff), specfunc(diff)),
      And(typefunc(name, name), Not(typefunc({mathfunc, identical(diff)})))
   );

is_solution_trivial:= (pde, sol::{`=`, set(`=`)})->
   evalb(eval(`if`(sol::set, sol, {sol}), depvars(pde)=~ 0) = {0=0});

pde:= diff(u(x,t),t)-diff(u(x,t),x,x,t)+4*u(x,t)*diff(u(x,t),x)=3*diff(u(x,t),x)*diff(u(x,t),x$2)+u(x,t)*diff(u(x,t),x$3);
sol:=pdsolve(pde,u(x,t));

is_solution_trivial(pde,sol)

proc (pde::{algebraic, `=`(algebraic), ({list, set})(algebraic, `=`(algebraic))}) options operator, arrow; indets(indets(convert(pde, diff), specfunc(diff)), And(typefunc(name, name), Not(typefunc({mathfunc, identical(diff)})))) end proc

proc (pde, sol::{`=`, set(`=`)}) options operator, arrow; evalb(eval(`if`(sol::set, sol, {sol}), `~`[:-`=`](depvars(pde), ` $`, 0)) = {0 = 0}) end proc

diff(u(x, t), t)-(diff(diff(diff(u(x, t), t), x), x))+4*u(x, t)*(diff(u(x, t), x)) = 3*(diff(u(x, t), x))*(diff(diff(u(x, t), x), x))+u(x, t)*(diff(diff(diff(u(x, t), x), x), x))

PDESolStruc(u(x, t) = _F1(x)*_F2(t), [{diff(_F2(t), t) = _c[2]*_F2(t)^2, diff(diff(diff(_F1(x), x), x), x) = -(diff(diff(_F1(x), x), x)-_F1(x))*_c[2]/_F1(x)-(diff(_F1(x), x))*(3*(diff(diff(_F1(x), x), x))-4*_F1(x))/_F1(x)}])

Error, invalid input: is_solution_trivial expects its 2nd argument, sol, to be of type {`=`, set(`=`)}, but received PDESolStruc(u(x, t) = _F1(x)*_F2(t), [{diff(_F2(t), t) = _c[2]*_F2(t)^2, diff(diff(diff(_F1(x), x), x), x) = -(diff(diff(_F1(x), x), x)-_F1(x))*_c[2]/_F1(x)-(diff(_F1(x), x))*(3*(diff(diff(_F1(x), x), x))-4*_F1(x))/_F1(x)}])

whattype(sol)

function

 


 

Download bug_june_25_2019.mw

I add `function` as one of allowed types to accept, and now it seems to work OK. I hope this was the correct way to fix this.

 


 

restart;

depvars:= (pde::{algebraic, `=`(algebraic), {set,list}(algebraic, `=`(algebraic))})->
   indets(
      indets(convert(pde, diff), specfunc(diff)),
      And(typefunc(name, name), Not(typefunc({mathfunc, identical(diff)})))
   ):

is_solution_trivial:= (pde, sol::{`=`, set(`=`),`function`})->
   evalb(eval(`if`(sol::set, sol, {sol}), depvars(pde)=~ 0) = {0=0}):

pde:= diff(u(x,t),t)-diff(u(x,t),x,x,t)+4*u(x,t)*diff(u(x,t),x)=3*diff(u(x,t),x)*diff(u(x,t),x$2)+u(x,t)*diff(u(x,t),x$3):
sol:=pdsolve(pde,u(x,t));

is_solution_trivial(pde,sol)

PDESolStruc(u(x, t) = _F1(x)*_F2(t), [{diff(_F2(t), t) = _c[2]*_F2(t)^2, diff(diff(diff(_F1(x), x), x), x) = -(diff(diff(_F1(x), x), x)-_F1(x))*_c[2]/_F1(x)-(diff(_F1(x), x))*(3*(diff(diff(_F1(x), x), x))-4*_F1(x))/_F1(x)}])

false

 


 

Download bug_june_25_2019_fixed.mw

 

Maple 2019.1

 

@Carl Love 

Thanks. Your functions worked very well. Verified on Maple 2019.1

@tomleslie 

Nice. But I do not think you need max there.

I rewrote your function a little to make it easier for me to understand (I do not like the style of using () over many lines, I find it hard for me to read, I've also seen others use the style you are using here).  (ps. I understand code style is a personal thing. All what I am saying is that I find this harder for me to read, that is all).

DETools:-difforder worked without using max in the following

restart;
get_order:=proc(expr,fun,var)
  local the_list,i;
  the_list := convert( indets(expr, function),list);
  PDETools:-difforder(select( i-> has(i, diff(fun,var)),the_list))
end proc:

Now 

f:= 2*y*(diff(x(t), t))^2+3*(diff(x(t), t$3))-3*x*(diff(y(t), t));
get_order(f, y(t),t);
get_order(f, x(t),t);

Returned 1 and 3 also.

 

@Carl Love 

Thanks. I verified your solution also works very well on Maple 2019.1

@acer 

Thanks. I verified your code works with no problem on 2019.1

@Joe Riel 

Thanks, but it did not work on the following example:


 

restart;

`latex/int` := FromInert(subsindets(ToInert(eval(`latex/int`)), 'specfunc(_Inert_STATSEQ)', f -> op(0,f)(op(2..,f)))):

lap:=diff(u(r,z,t),r$2)+ 1/r*diff(u(r,z,t),r)+diff(u(r,z,t),z$2);
bc:=u(r,0,t)=0,u(r,1,t)=0, u(1,z,t)=0;
ic:=u(r,z,0) = f(r,z);
sol:=pdsolve([diff(u(r,z,t),t) = lap,bc,ic],u(r,z,t)) assuming t>0

diff(diff(u(r, z, t), r), r)+(diff(u(r, z, t), r))/r+diff(diff(u(r, z, t), z), z)

u(r, 0, t) = 0, u(r, 1, t) = 0, u(1, z, t) = 0

u(r, z, 0) = f(r, z)

u(r, z, t) = `casesplit/ans`(Sum(Sum(4*BesselJ(0, lambda[n1]*r)*sin(n*Pi*z)*exp(-t*(Pi^2*n^2+lambda[n1]^2))*(Int(BesselJ(0, lambda[n1]*r)*r*(Int(sin(n*Pi*z)*f(r, z), z = 0 .. 1, AllSolutions)), r = 0 .. 1, AllSolutions))/hypergeom([1/2], [1, 2], -lambda[n1]^2), n = 1 .. infinity), n1 = 1 .. infinity), {And(lambda[n1] = BesselJZeros(0, n1), 0 <= lambda[n1])})

latex(sol)

Error, (in latex/int) invalid input: lhs received bnds, which is not valid for its 1st argument, expr

 


Do I need something else other than type the command you showed? Using Maple 2019.1 on windows.

 

Download bug_june_6_2019_3_45_pm.mw

@Carl Love 

Thanks for the reply. But the latex command should internally handle these issues.

What if you have 10,000 equations to process? Is a user supposed to check each time for something and make a workaround to make latex work?

Latex can simply use \text{All Solutions} or anything else it needs to make the latex conversion work.

Sorry, I do not understand your objection about me using "internal" error. I used this to mean the error is coming from internal to Maple. What difference does it make if it comes from int() or Int() or any other function? These all are just internal functions for a user.

 

@Rouben Rostamian  

"What is the domain of the unknown function u(r,z,t)?   It is
0 < r < 1,    0 < z < 1,   t > 0.
"

Yes. Actually the book uses 0<r<a and 0<z<H.  To help Maple, I used a numerical value for both radius and height of the cylinder. Both give the same Bessel error.

"Thus, the correct boundary conditions are:
bc := u(r,0,t)=0, u(r,1,t)=0, u(1,z,t)=0, D[1](u)(0,z,t)=0;
"

I did not make up the BC. This is a problem from well known book. It is at page 335 from Richard Habeman Applied Partial differential equations, 4th edition.

I see nothing wrong with these boundary conditions. They say that the temperature is zero on the all the cylinder surfaces?

I solved this PDE by hand correctly using these boundary conditions. Because the problem says that it is independent of theta, so I used "u(r,z,t)" only and not "u(r,theta,z,t)" as normally would be the case for a cylinder.  Notice the book uses "a" and "H" which I replaced by "1" each to make it is easier for Maple. Not that changes anything.

"A boundary condition on the edge r=0 is missing"

It is not missing. It is always assumed that at r=0 (center of cylinder) the solution is finite. This is an implicit assumption in such problems. This leads to discarding one of the two Bessel eigenfunctions solutions (the second kind) that results from the radial Bessel ODE since that  blows at r=0 leaving one solution  (The Bessel J_0() of order zero)

 

@tomleslie 

"where f(r,z) is undefined is going to cause all sorts of weird problems - because it isn't really a meaningful inital condition: it provides no useful information"

Sorry, I am not following what you are saying.

It is not meaningful at all. Initial conditions are needed to obtain the final unknowns in the series solution. This is how half the problems in the books are specified. Need an initial condition!

But thanks for the trick to get the Lapacian without theta dependency. I will use that next time instead of manually type it.

 

@tomleslie 

The specification of PDE itself is valid inside the domain and when time is involved, for t>0.

The solution of the PDE should ofcourse satisfy the PDE itself and also the initial and boundary conditions.  But this is how the PDE itself is always given/specified in text books:

 

----------------------------------------

--------------------------------

------------------------

And many more. 

I was just trying to help Maple by giving assumptions (sometimes they help and sometimes they are not needed). In this case, If I use no assumptions, or use t>0 or t>=0, it does not matter, the error in Bessel is there.

I need to check now if this error is new or not. A PDE with Laplacian in Cylinderical or Polar coordinates will generate Bessel ODE for the radial part of the solution, so need to check if this affect other PDE's as well. 

 

First 62 63 64 65 66 67 68 Last Page 64 of 91