MaplePrimes Questions

I have a code that is built on a module which in turn contains records, procs etc. to model certain electronic devices.

The main program first instantiates the various circuits I am using. These are mostly Maple records. It then enters a loop that iterates over a number of cycles this system executes in order to build up statistics.

My problem is that somewhere the code has a memory leak, and Maple eats up rather vast amounts of memory, that increase with the number of cycles in the loop. I suspect that some of the methods I am calling allocate a new instance on each cycle, which is not the intended behaviour. What I am looking for is a way to diagnose e.g. which record, or which proc, gets allocated anew every time. I know about usage but that prints out only the amount of memory allocated; that does not help; I know the number is large. I am looking for a tool that e.g. tells me that record xx is allocated 1000 times etc.



Dear users! I want to define y-axes like Re^(1/2)*C[f] in the following expression

restart; plot([sin, cos], -Pi .. Pi, title = "Simple Trig Functions", legend = ["Sine Plot", "Cosine Plot"], titlefont = ["ARIAL", 15], labels = ["x values", typeset("Re", C__f)], labeldirections = ["horizontal", "vertical"], labelfont = ["HELVETICA", 16], linestyle = [solid, longdash], axesfont = ["HELVETICA", "ROMAN", 16], legendstyle = [font = ["HELVETICA", 9], location = right], tickmarks = [[-Pi = -180^o, -2*Pi*(1/3) = -120^o, -(1/3)*Pi = -60^o, 0 = `0`^o, (1/3)*Pi = 60^o, 2*Pi*(1/3) = 120^o, Pi = 180^o], default]);

I have noticed that sometimes maple decides to spontaeous stop writing particular symbols in itallic or begin doing so for numerical symbols.


How can i stop this before I hurt my computer? I've just put up with it for around 2 years now and it's getting pretty close to danger zone material.


And sometimes the font colour changes from black to red, and its not in a block, and no i am not pressing anything or anything. It's like someone is intentionally trying to make things hard for me to not get angry in a really subtle way which i can totally appreciate the art of but like, ok it's obviously a bug in the software so if someone can run me through where to download a patch or whatever so this doesnt escalate to the point of concern about skynet initiating mutually assured destruction id really appreciate it.

like just now a particular bullet point i mada was in red where as all the others remain black as per the settings, so yeah laugh all you want it's just a slight uncomfortable feeling if i were to low ball it

Hi All,

I need to generate WienerProcess(), but I want to get result as function Z(t).

Then I want to use this function in solving ODE. How is it possible to do?

I have a spike train which is a series of time points, for example saved as a vector of floats. Could someone tell me how I can plot this spike train as a series of vertical bars at each of these time points ?

I would also like to know how to plot a series of spike trains one above the other[i.e. the raster plot] if I start with a 2-D matrix of floats where each row correspond to one spike train.

Thanks in advance.


I am trying to solve a factorial inequality.

solve(1/(n+1)! * exp(0.1)<=0.00001)

I get no result and a warning, "some solutions may have been lost".

Also same problem with the simpler inequality

solve(1/(n+1)! <=0.00001)

Wolfram has no problem solving it.

Am I entering it wrong? I attached a copy of my worksheet.


The problem came up when solving this problem: What degree of the maclaurin polynomial  is required so that the error in the approximation of e0.1 is less than 0.00001

When I right-click on a Matrix, the cursor rotates, but the context menu does not open at all (in Maple 2017, in document mode, in Win 10).
Any suggestions - Anyone else with this problem?

Hi all,

I have an differential equation in terms of the D-operator and am trying to convert it to diff form. Using convert/Diff works fine as long as partially evaluated functions don't appear in the equation. However, I can't figure out how to get the two to cooperate.

For instance, running

convert(%, Diff);


D[2](eta)(t,x) + Diff(phi(t,x,0),x)

Why is the eta term not converted to diff(eta(t,x),x)?

Thanks a lot!

Hello everyone!

Please help me to resolve following error appeared in PDEs.

I have following system of partial differential equation and tried to solve with numerical method

pde1:=diff(U, t)-(diff(U, x, x))-2*U*(diff(U, x))+diff(U*V, x)

> pde2 := diff(V, t)-(diff(V, x, x))-2*V*(diff(V, x))+diff(U*V, x);
> ics := { U(x, 0) = sin(x),  V(x, 0) = sin(x)};

sol:=pdsolve(pde1,pde2,ics,numeric,time=t, range=1..20)

I am get following error

Error, (in pdsolve) invalid input: `pdsolve/numeric` expects its 2nd argument, IBCs, to be of type {set, list}, but received 0

Now, I'm not the professional here, you guys are, since this is how the software has been built to produce this code automatically as i can only assume to be educational purposes for the user, concerning the analytic extension of the factorial on C, the gamma function. 

I feel that doing this is in no way helping or promoting your product, clearly despite the idea indeed having merit, it is not applicable to the extent it has been written into your convert function, and look, show me the mathematics of why it makes sense to have things designed this way. 


I am not saying i know anything important or am trying to be insulting, I just feel like this is some kind of joke to be honest, i mean how can for the most part the software be an exceptional in terms of computational power, and then this garbage is thrown at me? yeah just silly.



product(n/k^2-1/(k*n), k = 1 .. n-3)



seq(product(n/k^2-1/(k*n), k = 1 .. n-3), n = 3 .. 10)

1, 15/4, 138/25, 6545/1296, 16215/4802, 2342949/1310720, 7512505/9565938, 29537761/100000000


seq(convert(-(-1)^(n-2)*GAMMA(-n^2+n-2)*(1/n)^(n-2)*n/(GAMMA(n-2)^2*GAMMA(-n^2+1)), 'factorial'), n = 3 .. 10)

Error, (in GAMMA) numeric exception: division by zero


Um there is no gamma it was converted to a factorial.....? but ok....

convert(-(-1)^(n-2)*GAMMA(-n^2+n-2)*(1/n)^(n-2)*n/(GAMMA(n-2)^2*GAMMA(-n^2+1)), 'factorial')



seq(-(-1)^(n-2)*factorial(-n^2+n-3)*(1/n)^(n-2)*n/(factorial(n-3)^2*factorial(n^2)), n = 100 .. 100)

Error, numeric exception: division by zero





Just like the title described, I have encountered an error when I use the command "expand". Actually, I just follow the example, but it doesn't work. Please help me or tell me how can I solve it in other commands.

alias(epsilon = e, omega = w, omega[0] = w0, t[1] = t1, t[2] = t2); e := proc (t1, t2) options operator, arrow; e end proc; w0 := proc (t1, t2) options operator, arrow; w0 end proc; a := proc (t1, t2) options operator, arrow; a end proc; f := proc (t1, t2) options operator, arrow; f end proc; mu := proc (t1, t2) options operator, arrow; mu end proc;
ode := (D@@2)(u)+2*mu*e*D(u)+w0^2*u+e*w0^2*u^3-e*f*cos(omega*t) = 0;
     @@(D, 2)(u) + 2 mu epsilon D(u) + omega[0]  u

                          2  3                             
        + epsilon omega[0]  u  - epsilon f cos(omega t) = 0
e_oredr := 1;
ode := simplify(subs(D = sum('e^(i-1)*D[i]', 'i' = 1 .. e_oredr+1), ode), {e^(e_oredr+1) = 0});
 / 3         2                                                 
 \u  omega[0]  + 2 (epsilon D[2] + D[1])(u) mu - cos(omega t) f

                  \                   2                   
    + 2 D[1, 2](u)/ epsilon + omega[0]  u + D[1, 1](u) = 0
simplify(collect(%, e), {e^(e_oredr+1) = 0});

u := sum('v[i]*e^i', 'i' = 0 .. e_oredr);
                      epsilon v[1] + v[0]
ode := simplify(collect(ode, e), {e^2 = 0});
for i from 0 to e_oredr do eq[i] := coeff(lhs(ode), e, i) = 0 end do;
               omega[0]  v[0] + D[1, 1](v[0]) = 0
       3         2           2                       
   v[0]  omega[0]  + omega[0]  v[1] + 2 D[1](v[0]) mu

      - cos(omega t) f + 2 D[1, 2](v[0]) + D[1, 1](v[1]) = 0
remove(has, lhs(eq[1]), cos); convert(%(t1, t2), diff);
eq[1] := %-convert(f*cos(sigma*t2+t1*w0), 'exp');

v[0] := A(t2)*cos(w0*t1+B(t2)); convert(%, 'exp'); v[0] := unapply(%, t1, t2);
       (t1, t2) -> A(t2) |- exp(I (omega[0] t1 + B(t2)))

            1                              \
          + - exp(-I (omega[0] t1 + B(t2)))|
            2                              /

Error, (in property/ConvertProperty) invalid input: PropRange uses a 2nd argument, b, which is missing
collect(%, exp(I*w0*t1));
Error, (in collect) invalid 1st argument proc (t1, t2) options operator, arrow; A(t2)*((1/2)*exp(I*(w0*t1+B(t2)))+(1/2)*exp(-I*(w0*t1+B(t2)))) end proc
coeff(%, exp(I*w0*t1));
map(proc (x) options operator, arrow; x*exp(-I*B(t2)) end proc, %);
combine(%, 'exp');
subs(I*B(t2) = I*sigma*t2-I*C(t2), B(t2) = sigma*t2-C(t2), %);
conds := combine(%, 'exp');


With this feature, it requires the worksheet from which to import a result from executing it from the worksheet with the Run worksheet command to have section titles as Input  and Calculation respectively.


This is a really helpful feature, but what i need is to "fetch" the content from a number of worksheets in a folder from a specified particular section name, for a number of different section names.

Hi everyone,
I was wondering how to create a function, as we create in MatLab, in Maple. Here is an example of MatLab function, that I should convert to Maple:

function Y=fsin(delta,b,n)

if n==0
if n==1
if n==2
    Y=1+log(b^2 + 1)/2-b*atan(1/b);
if n==3
    Y=0.5*(2*delta-3*b-2*b*log(b^2 + 1)/2+atan(1/b)*(b^2-1));
if n==4
    Y=(1/36)*(18*delta^2-36*delta*b+33*b^2-11+6*log(b^2 + 1)/2*(3*b^2-1)+6*b*atan(1/b)*(3-b^2));
if n==5
    Y=(1/72)*(24*delta^3-36*delta^2*b+12*delta*(3*b^2-1)+25*b-25*b^3+12*b*log(b^2 + 1)/2*(1-b^2)+3*atan(1/b)*...
if n==6
        60*log(b^2 + 1)/2*(5*b^4-10*b^2+1)+60*b*atan(1/b)*(-5+10*b^2-b^4));
if n==7
        60*b*log(b^2 + 1)/2*(-3*b^4+10*b^2-3)+30*atan(1/b)*(-1+15*b^2-15*b^4+b^6));

  Thank you,  

In Maple 2018 help written:

The interpolation methods available in the Interpolation package all work as follows. First, the user calls one of the commands in the package, submitting the input points and the values at these points. This returns an object encapsulating all the data and options submitted. This object can then be used like a normal mathematical function, e.g. for plotting, integration, or just to evaluate at a given point.

The Interpolation[Interpolate] command was introduced in Maple 2018

My test example:


points := [seq(x, x = 0 .. 10, 1)]; data := [seq(sqrt(1.+x^2), x = 0 .. 10, 1)];

f := Interpolate(points, data);

f(1); # OK works :).

int(f(x), x = 0 .. 1); # Not working ?

int(f(x), x = 0 .. 1,numeric); # Not working ?

eval(diff(f(x), x), x = 2);# Not working ?

plot(f(x), x = 0 .. 10);#  OK works :)

plot([f(x), diff(f(x), x)], x = 0 .. 10);# Not working ?

plot([f, diff(f, x)], 0 .. 10);# Only a half  working ?





Hi everybody,

I am a newbie in Maple. Could you please help me to convert the following short code from Matlab to Maple: 


for i1=1:3

  for i2=1:3

    for i3=1:3

      for i4=1:3

        if i1==i2 && i2==i3 && i3=i4









Thank you,

First 528 529 530 531 532 533 534 Last Page 530 of 2132