Carl Love

Carl Love

28025 Reputation

25 Badges

12 years, 313 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

I suspect that this is a bug with the one-argument add, which is new to Maple 2015. Try replacing your add command with add(x, x= maMat[5, 1..-1]).

Initial and boundary conditions of PDEs must be specified with notation rather than diff notation. Your boundary conditions given above become

bc[1]:= -D[2](phi)(x,-d) = 0;
bc[2]:= D[1](phi)(0,z) = D[1](phi)(2*Pi,z);

where the [1] and [2] denote differentiation with respect to the first and second variable, respectively. To pass the conditions to pdsolve use

pdsolve({pde, bc[1], bc[2]}, HINT= X(x)*Z(z));

which will quickly (5 seconds or so) return a solution. I did this in Maple 18. I don't know whether Maple 13 will solve it with the boundary conditions, but I am sure that you must use notation for them.

Here are three procedures, one for each of your matrix templates:

M:= proc(i::nonnegint, alpha, N::nonnegint)
local k;
     Matrix(
          N+1, N+1,
          [seq([0$(N-k)], k= 0..i-1), [seq(1/GAMMA(k*alpha+1), k= 0..N-i)]],
          scan= band[0,i]
     )
end proc:

WF:= (w,u,f,x,lambda,N::nonnegint,m::nonnegint)->
     < < Matrix(N-m+1, N+1, (i,j)-> w[i-1,j-1]), Matrix(m, N+1, (i,j)-> u[i-1,j-1]) > |
          Vector(N+1, fill= `;`) |
         < Vector(N-m+1, i-> f(x[i-1])), Vector(m, i-> lambda[i-1]) >
     >
:

X:= (a,x,c,N::nonnegint)-> Matrix(N+1, N+1, (i,j)-> (x[i-1]-c)^((j-1)*a));

Use op. Let's say that MyProc() generates lengthy output. Then do

Result:= MyProc(): #End with a colon!
N:= nops(Results); #Number of operands
op(1..1000, Results); #Iff N > > 1000

It's very simple: D(f)

Here are the commands to numerically solve the PDE. The notation D[2] in the initial conditions refers to differentiation with respect to the second variable, t. The 0 as the third argument to each piecewise is a default value to be used when the condition (the first argument) is not satisfied.

restart:
PDE:= diff(u(x,t),t,t)-2*diff(u(x,t),x,x)+diff(u(x,t),x,t) = 0;
ICs:=
    u(x,0) = piecewise(abs(x) < 1, 1-x, 0),
    D[2](u)(x,0) = piecewise(abs(x) < 1, cos(Pi*x), 0)
;
BCs:= u(-4,t) = 0, u(4,t) = 0:
Sol:= pdsolve({PDE}, {ICs,BCs}, numeric, time= t, timestep= 0.025, spacestep= 0.1);

And here are some of the numerous plots you can generate:

Sol:-plot(x=0, t= 0..1);
Sol:-plot(t=1, x= -4..4);
Sol:-animate(x= -4..4, t= 0..3, numpoints= 100);

See ?pdsolve,numeric for more.

I believe that the memory will be freed at the first garbage collection after the restart. You can either wait for the garbage collection to come around on its own schedule, or you can force the collection with the command

gc();

 

Unknown error? I think that the error message is fairly clear for this one. You are trying to add a 3-element row Vector to a scalar.

Tr(X) and Tr(X0) are row Vectors, and H[1] is a scalar. So Tr(X).H[1]-Tr(X0).H[1] is a row Vector. Dtau1CC[1], and Tr(Dtau2) are 3x1 Matrices, and is a 3-element column Vector, so 3*(Tr(X).Dtau1.CC[i].Tr(Dtau2).U) is a scalar.

L:=[seq([i,i^2], i=1..4)]:

plots:-animate(
     plot,
     [L[1..trunc(k)]],
     k= 1..nops(L), frames= nops(L),
     style= point, symbol= circle, symbolsize= 12,
     view=[0..4,0..16]
);

Your problem is excessive calls to randomize(). Just use it once, at the top of your code.

The Maple clock has much lower resolution than your CPU clock. The Maple clock hasn't advanced between your calls to randomize() in the loop. Thus, the randomize() is setting the random sequence back to the same position.

You (or the code that you're calling) is trying to store a symbolic value, L, into a Matrix which is restricted to numeric values only. You must give a numeric value.

If that's not enough information for you to correct your code, then you'll need to post your code.

You could pad the lines with blanks so that every line has the same number of characters. Then there would be an easy correspondence between lines and byte positions.

int(X^2+3*y+3*z+X^7, X= 1..10);

They're called Code Edit Regions. You can find them on the Insert menu.

The answer depends on how large k is. For small k, simply use

Expand~(M^~k) mod p;

This may not be efficient for large k.

First 261 262 263 264 265 266 267 Last Page 263 of 395