nm

9899 Reputation

19 Badges

12 years, 85 days

MaplePrimes Activity


These are questions asked by nm

I might be doing something wrong since I expected Maple to be able to solve this. Could some Maple manage to make Maple solve the following beam PDE problem taken from a textbook?

 

This is what I tried.

restart;
pde:=diff(u(x,t),t$2)+diff(u(x,t),x$4)=0;
bc:=u(0,t)=-12*t^2,u(1,t)=1-12*t^2,D[1,1](u)(0,t)=0,D[1,1](u)(1,t)=12;
ic:=u(x,0)=x^4,D[2](u)(x,0)=0;
sol:=pdsolve({pde,ic,bc},u(x,t));

But Maple returns no solution.

I am using Maple 2017.3 on windows.

 

I am trying to see if Maple can solve Laplace PDE inside the disk in polar coordinates. Standard textbook problem. Radius of disk is `a`. The boundary conditions on the disk is `f(theta)`. One of the conditions needed also is that the solution is finite in the center of the disk.

I do not know how to tell Maple that the solution should be finite in the center of the disk. If I do not give this conditions, Maple gives me strange looking solution, which does not look like anything close to the standard series solution one gets from hand solution. There is not even a series solution.

This is what I tried

restart;
pde:=diff(u(r,theta),r$2)+1/r*diff(u(r,theta),r)+1/r^2*diff(u(r,theta),theta$2)=0;
bc:=u(a,theta)=cos(theta);
sol:=pdsolve([pde,bc],u(r,theta)) assuming r<=a,r>0

Now, how to tell it that `u(0,theta)` is bounded? So that the `ln(r)` solution do not show up? Adding `u(0,theta)<infinity` to the boundary conditions, gives error

restart;
pde:=diff(u(r,theta),r$2)+1/r*diff(u(r,theta),r)+1/r^2*diff(u(r,theta),theta$2)=0;
bc:=u(a,theta)=cos(theta),u(0,theta)<infinity;
sol:=pdsolve([pde,bc],u(r,theta)) assuming r<=a,r>0

The standard solution to this PDE is

Where `c0` and `cn` and `kn` above are found from boundary conditions at $u(a,\theta)$.

How can one get Maple to give the above solution? How to tell it that $u$ is bounded at $r=0$?

 

 

I have a function inside a file called proc2.mpl

When I read the file from a worksheet using the command read("proc2.mpl"); I see warning messages

Warning, incomplete string;  use " to end the string
Warning, incomplete string;  use " to end the string

printed on the screen.  Now if I copy the same exact code and past it into the worksheet and invoke the function, I see no warning messages.

Why is that? Here is the content of "proc2.mpl"

process_file := proc()
  local str,fileName;


  fileName := "output.txt";
  
  str:="
   \\begin{align*}
     A =& B  \\\\ 
       =& 3
   \\end{align*}
  ";
	
  writebytes(fileName, str);
  close(fileName);

end proc:

Here is screen shot loading the function from worksheet

But now when I call it using process_file(); it works as expected.

Now here is screen shot with same code inside the worksheet itself. No warning messages show up when I call it.

And the above call also works as expected.

So I am now ignoring these warning messages since I also do not know what causes them.

Any ideas why they show up when the code is inside a .mpl file and not in the work sheet?

Maple 2017.3 on windows.

 

 

 

I want to save multiline string to a file. I am not sure Maple likes my string. Also when I look at the textfile after writing the string to it, the string does not look like what is expected. I given small example

First, created a "proc.mpl" in the folder. Here is the content of "proc.mpl"

process_file := proc()
local str;
  
str:="
   \\begin{align*}
     A =& B \\\\
       =& 3
   \\end{align*}
";

FileTools[Text][WriteString]("output.txt", str);
FileTools[Text][Close]("output.txt");

end proc:

Then opened Maple, and from a worksheet, called the above proc() like this

restart;
currentdir("C:\\where_the_file_is");
read("proc.mpl");
Warning, incomplete string;  use " to end the string
Warning, incomplete string;  use " to end the string
Warning, incomplete string;  use " to end the string
process_file();

You see these warnings there. So how does one make a multiline string in Maple? Please tell me it is possible. Else this whole process will not work.

When I look at the "output.txt", where the string is written, this is what shows


   \begin{align*}
     A =& B \      =& 3
   \end{align*}

Which is wrong, I expected this


   \begin{align*}
     A =& B \\     
        =& 3
   \end{align*}

 

I use \ to escape each \, since this is Latex code. 

QUestions are:

1) Can one have multiline string in Maple? as in

"
line one
line two
"

With implied carriage return, just as it appears in the input?  I do this all the time in Mathematica.

2) Is something wrong with how I am saving the string to the file?
 

On a side note: I noticed I had to close the textfile to see the output in it. It looks like FileTools[Text][WriteString] does not flush the string autmatically to a otuput file after each write() which is a little annoying.

Using Maple 2017.3 on windows.

This is how the above is done in Mathematica

And this is "test.txt" which shows the output as expected

   \begin{align*}
     A =& B \\
       =& 3
   \end{align*}

I'd like to do the same in Maple.

First, is patmatch command is the main Maple command for doing pattern matching on expressions?  

I trying to understand how it works, but failing on the most basic expressions. 2 basic questions

1)patmatch( x^n/y^n,  x∷symbol^n::symbol /  y::symbol^n::symbol);
                               false

It did not like that I told it x::symbol in the above. Why? But when I remove ::symbol it works

patmatch(x^n/y^n,x^n::symbol/y^n::symbol);
                   true

But when I do "whattype(x);" Maple replies saying it is "symbol"

2)Trying to match x^2/y^2, not having any luck
patmatch(x^2/y^2,x^n::nonunit(integer)/y^n::nonunit(integer));
                        false

patmatch(x^2/y^2,x^n::integer/y^n::integer);
                         false

How to match x^2/y^2? Why the above fail? 

I learn better by examples. Is there a place where one can look at many examples using patmatch? 

The help page have only few examples, and the link to the page called "examples,patmatch" does not help either with few examples and many are the same as the other page.  I tried to run it using 

infolevel[all]:=5:
printlevel:=10:

To see if I can figure what is wrong, but did not understand any of the code printed.

Compare this to Mathematica, where pattern matching there has hundreds of examples and detailed tutorials just on this one subject.

 



   


 

First 149 150 151 152 153 154 155 Last Page 151 of 185