nm

11353 Reputation

20 Badges

13 years, 10 days

MaplePrimes Activity


These are answers submitted by nm

the function you have produces complex result. To plot the real part, and assuming I understood what you want

n:=100;
step:=0.1;
sol:=seq([i,Re(eval(Simpson(f,i,i+0.1,n)))],i=0..10-step,step):
plot([sol]);

To plot the complex part, Im can be used.

an easy way to handle this is as follows (I do this all the time). It takes about 10 extra seconds of post processing the pdf file: Open the pdf file, Tools->Advanced editing->Crop tool, draw the reactangle around the area you want to crop, double click on the area when done. Click OK, save the file.

Now the PDF file will contain the plot and no other empty space. Now you can include it in latex using \includegraphics{file.pdf}

restart;
DE1 := diff(y(t),t) = z(t);
DE2 := diff(z(t),t) = -y(t)*cos(t);
DEtools[phaseportrait]([DE1,DE2],[y(t),z(t)],t=-5..5,[[y(0)=1,z(0)=0],[y(0)=0,z(0)=2],[y(0)=0,z(0)=-2]],y=-Pi..Pi,z=-3..3,color=aquamarine,linecolor=[red,blue,green]);

restart;
f:=x->x+3;
map(f,[seq(i,i=50..70,5)]);


or

restart;
f:=x->x+3;
seq(f(i),i=50..70,5);

or

restart;
f:=x->x+3;
data:=[seq(i,i=50..70,5)];
f~(data);



 

restart;
eq:=diff(y(x),x$2)+(4/x)*diff(y(x),x)-a*x=0;
dsolve(eq,y(x))

updated, OP made an error in problem statement. The new one is nonlinear. These are hard to find analytical solution for. Did you try it? You can try some specific numeric values for "a" and "n" and use some initial/boundary conditions, and compare the solution from dsolve with numerical dsolve and see if the plots of y(x) are similar.

restart;
eq:=diff(y(x),x$2)+(4/x)*diff(y(x),x)-a*y(x)^n=0;
dsolve(eq,y(x));

collect(A,u);

 

I am not familar with Maple pde solver at all, but with look at help, I get this. You can verify if this look correct

restart; with(PDEtools);
L:=1;
pde:= diff(u(x,t),t$2)+2*diff(u(x,t),t)-diff(u(x,t),x$2)=18*sin(3*Pi*x/L);


ic:={u(0,t)=0,u(L,t)=0,u(x,0)=0,D[2](u)(x,0)=0};
sol:=pdsolve(pde,ic,u(x,t),numeric);
sol:-plot3d(t=0..10,x=0..L,axes=boxed);



fff:=z->z^k;
int(fff(z),z=0..x[2],continuous);

Try help kernelopts and look for printbytes:

--------------------------
printbytes
true/
Print the "bytes used.." message after

false
every garbage collection (tty version).


Default value is true.
-------------------------------

so try kernelopts(printbytes=false)

for interface/notebook version, try

interface(printbytes=false)

and if this does not work, try

interface(quiet=true)

"An interface constant that will suppress all auxiliary printing (logo, garbage collection messages, bytes used messages, and prompt)."

eq:=(a*b+a)^n*a^(-n);
simplify(eq) assuming positive;

 

I've had many hangs in the update to 18.02, where at the end, where the progress bar reaches the end, it stops and the update never finishes.

I tried few times, then on the 4th or 5th time, it actually completed. You might thought the download was completed.

I suggest you try again, and make sure the update actually finishes ok.

(ps. this the first time this happned updating Maple) I am on windows and was updating from 18.01 to 18.02

 

------------------------------------
restart;
  f:=x->piecewise(-Pi<x and x<Pi/2,-1,
                  Pi/2<x and x<1,0,1): #square wave to approximate using fourier
    
  nmaFourier2:=proc(f,freq,from_,to_,maxN)
         local n::integer,denomC,denomS,a,b;
         denomC:=( to_ - from_ ) / 2;
         denomS:=( to_ - from_ ) / 2;
 
         a:=proc(n)
           int(f(x)*cos(n*freq*x),x=from_..to_) /denomC;
         end proc;
 
         b:=proc(n)
           int(f(x)*sin(n*freq*x),x=from_..to_) / denomS;
         end proc;
 
         evalf(denomC);
 
         1/2*a(0) + sum( a(n) * cos(n*freq*x) ,n=1..maxN)
                  + sum( b(n) * sin(n*freq*x) ,n=1..maxN)
  end proc:
----------------------------------

To plot all do

r:=[seq(nmaFourier2(f,1,-Pi,Pi,n),n=1..5)]:
plot(r,x=-Pi..Pi);

To animate do

----------------------------------------
g:=n->plot(nmaFourier2(f,1,-Pi,Pi,n),x=-2*Pi..2*Pi);
plots:-animate(g,[n],n=1..40);
-----------------------------------------

and click on the plot and open the animate->play

 

I am sure there is a better way, how about:

M:=Matrix(3,[[1,1,1],[2,2,2],[3,3,3]]);
StringTools:-Join(map(x->convert(x,string),convert(M^%T,list)),"");
sscanf(%,"%d");


 

restart;
ode:= 5*(diff(theta1(t), t))+diff(theta2(t), t);
Physics:-diff(ode, diff(theta1(t),t));

            5

one option is to call gc() in the loop.

http://www.maplesoft.com/support/help/Maple/view.aspx?path=gc

"Invocation of this function causes a garbage collection to occur. Garbage collection has the effect of deleting all data to which no references are made. It also cleans the remember tables of procedures with an option system or option builtin by removing entries that have no other references to them. "

But they say "Note, as of Maple 16 the use of gc is discouraged." with no reason why.

I am using now in a loop myself, and it seems to have helped in having Maple not use too much memory.

 

First 16 17 18 19 20 Page 18 of 20