nm

11353 Reputation

20 Badges

13 years, 20 days

MaplePrimes Activity


These are questions asked by nm

most people who post here seem to use .mw written in 2D, which I do not like to use.

Is there a tool to convert such a file to 1D worksheet that one can use from the command line before opening the document itself in Maple?

The reason I ask, sometimes opening the original file and trying to do this from inside Maple by selecting the code using the mouse, then  Format->ConvertTo->1D   does not work, and gives an error.

Also, sometimes, when I try to first create an empty worksheet document, and then try to copy/paste the code from the other document over, it also does not work. This happens when there are syntax errors in the original document. The error that comes up is

        Parse:-ConvertTo1D, "first argument to _Inert_ASSIGN must be assignable"

As an example, please see the attached file in the following question

https://www.mapleprimes.com/questions/227506--I-Need-Help-Trying-To-Write-A-Code

It will good to have a tool that converts such documents to 1D worksheet or even plain Maple code (.mpl) but I did not see such option under SAVE AS either. Also, when I tried to export it as .mpl file, I get the same error as above in the file. So I gave up.

 

I wanted to remove entry from a list that contain y=y or x=x in it. Here is an example

f:= (x-1)*y^4/(x^2*(2*y^2-1));
S:=[singular(f)]

Where I wanted to remove those entries highlighted above to obtain

This is below how I ended up doing it. I'd like to ask if there is a better or more elegent way. I had to use map, since could not get remove() to work on the original list in one shot. 

foo:= z->remove(has,z,{y = y,x = x});
map(foo,[singular(f)])

Which gives the output above.

Is there a better way to do this? I always learn when I find how to do something better.

Maple 2019.1

 

 

Are there commands in Maple to find the order and degree of an ODE?  Searching help I could not find anything so far.

For an example, given 

restart;
ode:=(1+diff(y(x),x)^2)^(3/2)=diff(y(x),x$2)

I want the command to return 2 for the order of the ODE and degree is also 2 in this case.

I looked at DEtools package and googled. I am sure Maple have build in commands to do this without me having to parse the ODE myself to find out.

fyi, there seems to be a problem here. Maple 2019, Physics version 395 on windows 10.

The solution given to this wave PDE by Maple as sum that starts from zero, has "n" in the denominator. When n=0, this gives division by zero.  Is this a bug?

restart;
L:=3: c:=4: h:=1/10: b:=Pi*c/L:
f:=piecewise(0<=x and x<=L/3,3*h/L*x,L/3<x and x<=L,h):
pde := diff(u(x,t),t$2) + b*diff(u(x,t),t) = c^2*diff(u(x,t),x$2):
bc  := u(0,t)=0,D[1](u)(L,t)=0:
ic  := D[2](u)(x,0)=0,u(x,0)=f:
sol:=pdsolve([pde,bc,ic],u(x,t));
subs(n=0,sol)

u(x, t) = Sum(-((3/10)*I)*sin((1/6)*(1+2*n)*Pi*x)*(3^(1/2)*sin((1/3)*Pi*n)+cos((1/3)*Pi*n))*((2*I)*exp((4/3)*t*(I*n^(1/2)*(n+1)^(1/2)-1/2)*Pi)*n^(1/2)*(n+1)^(1/2)+(2*I)*exp(-(4/3)*(I*n^(1/2)*(n+1)^(1/2)+1/2)*t*Pi)*n^(1/2)*(n+1)^(1/2)+exp((4/3)*t*(I*n^(1/2)*(n+1)^(1/2)-1/2)*Pi)-exp(-(4/3)*(I*n^(1/2)*(n+1)^(1/2)+1/2)*t*Pi))/(n^(1/2)*(n+1)^(1/2)*Pi^2*(1+2*n)^2), n = 0 .. infinity)

Error, numeric exception: division by zero

 


 

Download bug_july_11_2019.mw

 

I solved this PDE by hand to verify Maple's solution. I think Maple solution is wrong. This PDE is the heat PDE on a bar (1D) with boundary coditions on both ends are function of time and zero initial conditions.

unassign('A,B,x,t,L,k,f');
pde := diff(u(x,t),t)= diff(u(x,t),x$2):
bc := u(0, t) = A(t), u(1, t) = B(t):
ic := u(x, 0) = 0:
sol1:=pdsolve([pde, ic, bc], u(x, t));

#now try when A(t)=sin(t),B(t)=t, use 20 terms for the sum
sol2:=simplify(subs([infinity=20,B(tau)=tau,A(tau)=sin(tau),A(0)=0,B(0)=0,A(t)=sin(t),B(t)=t],sol1)):
sol3:=simplify(value(subs(t=1,sol2))):
evalf(subs(x=0.5,sol3))

 

Also doing pdetest(sol1,pde); on the above solution does ot return zero as expected.

To verify more, I solved the same PDE again, but now using an explicit values for the boundary conditions A(t), B(t). Using A(t)=sin(t), B(t)=t. Then found the value again of the solution u at x=0.5 and t=1 like in the above, and it gives different value:

unassign('A,B,x,t,L,k,f');
pde := diff(u(x,t),t)= diff(u(x,t),x$2):
bc := u(0, t) = sin(t), u(1, t) = t:
ic := u(x, 0) = 0:
sol4:=pdsolve([pde, ic, bc], u(x, t));
sol5:=simplify(subs(infinity=20,sol4)):
sol6:=simplify(value(subs(t=1,sol5))):
evalf(subs(x=0.5,sol6))

Then I typed my hand solution into Maple and for the same values x=0.5, t=1 and same number of terms, I also get the same value 0.819. 

I do not see at all where the function sin integral should come into play in this solution. 

Could some Maple expert please check to see what is going on with this solution to Maple? 

Using Maple 2019.1 and Physics version 370

 

First 140 141 142 143 144 145 146 Last Page 142 of 199