MaplePrimes Questions

Search Questions:

Latest Questions Latest Questions Feed

Dear all

I have the following equaion

Eq := diff(phi(x, k), x, x)+(k^2+2*sech(x))*phi(x, k) = 0;
The solution is given by 

phi := (I*k-tanh(x))*exp(I*k*x)/(I*k-1);

My question : At what value of k is there a bound state and in this case can we give a simple form of the solution phi(x,k)


With best regards


How I can simulate control speed of car with sensor of speed, noise, feedback on maplesim?thanks

I am (again) trying to get Maple to do some parallel work; using the Threads package.

My actual problem involves a vector function with 6 elements, acting on 6-vectors. Each element of the output vector is calculated as a high-order polynomial of all 6 input elements. The whole thing is a map that I want to iterate. I plan to evaluate each of the 6 functions in a separate thread (the input vector of course is the same for all six) and then put the results together in a Vector, to be used as input for the next iteration.

Facing difficulty I finally wrote myself a little toy program to check out the basic mechanism. Here it is:

                "Maple Initialization loaded..."
f:=x -> 1+x^2;
                        f := x -> 1 + x

for i from 1 to 10 do
end do:

So far so good; even the output (not shown) makes sense. BUT: as I increase the number of iterations in the loop, the memory allocation goes up fast, and I hit a point at about 40 iterations where the whole process locks up and the program never ends, cannot even be stopped (at least for 100 iterations), forcing me to abort the whole thing. I have evidence that Maple allocates vast amounts of memory which finally chokes the whole thing (on a 16 GB-RAM machine).

Anyone have any idea what I am doing wrong? I realize the above example does not provide benefits; in the real example there will be 6 Creates and the loop will Wait for all of these to finish.

I'd really like to get this to work as each function can take quite some time and I do expect at least some speed-up from parallelizing this (even after overhead).

This is on Maple 2015 on Mac OS X 10.10.5 with 16 GB of RAM. I should mention that I set UseHardwareFlots:=true in my .mapleinit file.



H2 := [a(t)*(diff(c(t), t))+b(t) = 100, a(t)*(diff(b(t), t))+c(t)*(diff(b(t), t)) = exp(t), a(t)*(diff(c(t), t))+a(t)*(diff(b(t), t))+b(t) = 90];
H1 := subs([diff(a(t),t)=a1,diff(b(t),t)=b1,diff(c(t),t)=c1], H2);
H := subs([a(t)=a0, b(t)=b0, c(t)=c0], H1);
ics := generate_ic(H, {a0=-2..2, b0=-2..2, c0=-2..2,a1 = -2 .. 2, b1 = -2 .. 2, c1 = -2 .. 2, t = 0, energy = 0}, 100);


Error, (in generate_ic) invalid input: `DEtools/generate_ic` expects its 1st argument, H, to be of type algebraic, but received [a0*c1+b0 = 100, a0*b1+c0*b1 = exp(t), a0*c1+a0*b1+b0 = 90]


After trigonometric manipulations in a mechanical problem, I can obtain the desired angles but defined with modulo 2Pi.

I would like to program or find a function which can do this operation :

While angle doesn't belong to [-Pi, Pi]


  If angle > Pi then do angle = angle - 2Pi

  If angle < - Pi then do angle = angle + 2Pi


Is there an existing function which can do this operation ?

Otherwise, may you help me to program it ?

Thanks a lot for your help

Dear all;

I need your help to solve the non-square system of equation


 l1 := [1, 1, 1, 0, 0, 0, 0, 0, 0];

l2 := [0, 0, 0, 1, 1, 1, 0, 0, 0];

l3 := [0, 0, 0, 0, 0, 0, 1, 1, 1];

l4 := [1, 0, 0, 1, 0, 0, 1, 0, 0];

l5 := [0, 1, 0, 0, 1, 0, 0, 1, 0];

l6 := [0, 0, 1, 0, 0, 1, 0, 0, 1];

l7 := [0, 0, 1, 0, 1, 0, 1, 0, 0];

A := Matrix([l1, l2, l3, l4, l5, l6, l7]);
    # Unknown vector                    

m := [m1, m2, m3, m4, m5, m6, m7, m8, m9];
# Right hand side                  

 b = [15, 15, 15, 15, 15, 15, 15];


# Let the matrix equation : A m =b

1)I need your help to compute the kernel and general solution of this matrix equation

2) can we find a solution if m_k in { 2 3 4 5 6 7 8 } and each of these number appears at least once

3) If there a solution if we consider m_k in the set {0 1 2 3 4 5 6 7 8 }  and the number used exactly one



Thank you very much for your help




This is my source code to perform several binary arithmetic and HUffman Compression

Freq := proc (s) options operator, arrow; map(proc (x) options operator, arrow; rhs(x) = lhs(x) end proc, {StringTools:-CharacterFrequencies(s)}) end proc; s := readstat("x will be assigned "); Fr := Freq(s);

{1 = "a", 1 = "g", 1 = "l", 1 = "o"}

HuffmanTree := proc (s) options operator, arrow; if nops(s) <= 1 then rhs(s[]) else procname(`union`(s[3 .. -1], {lhs(s[1])+lhs(s[2]) = [rhs(s[1]), rhs(s[2])]})) end if end proc; HT := HuffmanTree(Fr);

[["a", "g"], ["l", "o"]]

HuffmanCoding := proc (s, p := "") if s::string then s = p else procname(s[1], cat(p, 0)), procname(s[2], cat(p, 1)) end if end proc; HC := HuffmanCoding(HT);

"a" = "00", "g" = "01", "l" = "10", "o" = "11"

C := table([HC]); b := cat(map(proc (x) options operator, arrow; C[x] end proc, StringTools:-Explode(s))[]);


# Begin the procedure with make string to integer
z := parse(b);

                                                                   100111    #Should be 00100111 after parsing

# Step 1:add 1 to z
binaryAdd := proc (z, y) options operator, arrow; convert(convert(z, decimal, 2)+convert(y, decimal, 2), binary) end proc;
z1 := binaryAdd(z, 1);


# Step 2: Reverse the number from left to right
z2 := convert(z1, base, 10);

[0, 0, 0, 1, 0, 1]

z3 := (parse@cat@op)(z2);

                                                                101  #Should be 000101 after parsing

 # Step 3: Addition between the first secret key and the Huffman Code


p := rand(0 .. 2^(length(z3)-2)):

rn := convert(p(), binary);


z4 := binaryAdd(z3, rn);


# Step 4:Obtain 2's complement

s := length(z4);

z5 := convert(z4, decimal, binary);


z6 := [Bits:-GetBits(-z5, -1 .. 0, bits = s)];

[0, 1, 0]

z7 :=(parse@cat@op)(z6);

                                                       10  # Should be 010 after passing


The Bold part is MAPLE answer. My problem for this MAPLE source code is the underlined answer  as I can't get the answer I need after I have my parsing of string or list. Do this problem can be solved or it is impossible to make the leading zero all the way of the process. I try to figure it out for several solution but it still the same results. Thus hope some experts or someone can help me solve it together. Appreciated if get solved.

Dear All

I have simple problem related to ploting of 2-D graph

What I need is listed as below:

1. How I can re-scale axes by 1/2.

2. How to give custom gap between graph and its title.

3. How to place two legends in vertical format in opposite to horizontal.

4. How to assigne custom gap between legends and graph

5. How to place label 'q[b]' on the right side of vertical axes.

f[1] := 0.6553e-2+0.61277e-1*cos(.9976156575*x)-0.3448e-2*cos(1.995231315*x)+0.164e-3*cos(2.992846972*x)



f[2] := 0.6601e-2+0.61212e-1*cos(.9878156204*x)-0.3834e-2*cos(1.975631241*x)+0.182e-3*cos(2.963446861*x)



plot([diff(f[1], x), diff(f[2], x)], x = -3.2 .. 3.2, color = ["Red", "Green"], linestyle = [solid, dash], legend = ["undistorted ( n=0.0, q=0.0)", "undistorted"], labels = [tau*``, q[b]*`\` `], labeldirections = [HORIZONTAL, VERTICAL], size = [500, "golden"], title = "Radial velocity curve of Polytropic Model of Index N=3", titlefont = ["ROMAN", 15], legendstyle = [font = ["HELVETICA", 9], location = bottom]);




Hello All,

This morning I tested for the first time Maple's CUDA capablities.

(I took the following example on the Maplesoft website)

with(LinearAlgebra); CUDA:-Enable(false); CUDA:-IsEnabled(); a := RandomMatrix(4000, datatype = float[8]); b := RandomMatrix(4000, datatype = float[8]); t := time[real](); c := a . b; time[real]()-t;
with(LinearAlgebra); CUDA:-Enable(true); CUDA:-IsEnabled(); a := RandomMatrix(4000, datatype = float[8]); b := RandomMatrix(4000, datatype = float[8]); t := time[real](); c := a . b; time[real]()-t;
Error, (in unknown) CUBLAS internal error

As we can see there is not significant improvment on my machine with/out CUDA.

(I don't understand the CUBLAS error)

My graphics card is a GTX960 4 Go GDDR and 1024 cores.






I want to run an entire worksheet step by step to see errors and how variables are flowing and so on.

I know that I can invoke de debbuger but it doesn't allow me to do so from start.

How can I do that, is that possible?

It´s like:


<I want to start a step by step from here>
<and stop here>

Thanks in advance.


i'm trying to figure out where i did a mistake by coding reducedEchelonForm.

 local l:=1, m:=RowDimension(M),n:=ColumnDimension(M),i,j; # l current column
 for i from 1 to m do # going trough every row item
  if n<l then # ColumnDimension need to be bigger than current column
   return M;
  end if;
 j:=i; # given current row item
 while M[j,l]=0 do # search for first rom item unequal zero
  if m<j then # end of row
   if n<l then # end of rows and columns -> finish
    return M;
  end if;
 end if;
end do;
M:= perm(m,n,j,i).M; #permute row j and i
if not(M[i,l]=0) then # multiply row i with M[i,l])^(-1)
 M:= multiplikation(m,n,i,(M[i,l])^(-1)).M;
end if;
for j from 1 to m do # subtract every row j with row i for M[j,l]-times
 if not(j=i) then
  M:= addition(m,n,j,i,-M[j,l]).M;
 end if;
end do;
l:=l+1; # increase l by 1, next iteration i increase either
end do;
end proc:


Hint: perm(...),multiplikation(...) and addition(...) are the elementary matrices. They are working.


Now i got an error by running it: 

Error, (in reduced) invalid left hand side in assignment

Can someone explain me these error? And maybe a hint what i need to fix in my code?

Greets felix


I have a subscripts error, or it seems to be an error.

As you can see on the picture, then I have defined the varible I__K, but when I need it again I get another result or It seems to be another result that looks like this I[K]. I use the esc buttom to recall the varible.

Are there anybody that has a solution to this? I have been looking at other treads, but there seems not to be a solution that works or maybe I'm looking the wrong places.





Maple Coding:

z4:=11000010010000 (in binary form)

s = length(z4);




[Bits:-GetBits(-%, -1 .. 0, bits = s)];

z5 := subsop(1 = 0, %);

z6 := (`@`(`@`(parse, cat), op))(z5)

Suppose after two's complement of 11000010010000 will be 00111101110000 but when i parse it down it will become 11110110000 which two 0's bit is disappeared,how i can get back the original answer in maple?Thanks

Hello everyone!

I am wondering why the Tabulate command does not work with Explore. E.g.:

Explore(`DocumentTools:-Tabulate`([plot(sin(a*x)), plot(cos(x-a))]), parameters = [[a = 0 .. 10, controller = slider]])

I know that I can display an array of plots with the display(Array([....])) which works fine with explore but Tabulate is another good way to display multiple plots and it gives better control over individual plots properties (e.g. setting different size to different plots). Is this a bug or Tabulate is just not meant to work in that context?  

If L is a list [a,c,b,d,f,e]

S is a list [b,c,f,e]

I want to use the permutation opf S to rearrange L [b,c,f,e,a,d]

In my case a,b,c,d,e,f are equations.

2 3 4 5 6 7 8 Last Page 4 of 1302