Items tagged with programming programming Tagged Items Feed

Hello everyone!

This is a procedure which I have writern. I know I write false, X=x because in maple, x is a table.although I did write x::Vector. Can you help me? Sorry, my English is not very good! :(

Hello everbody!


uses LA=LinearAlgebra;  

local      i,k,n:= LA:-RowDimension(A),    

        x:= Vector(LA:-RowDimensions(A)),    

        p:= Vector(LA:-RowDimensions(A));  


 while  k<=n do      

       for i to n while i<>j do          

          x[i]:=1/(A[i,i])*(-add(A[i,j]*p[j],j=1..n)+b[i]);       end do;      

        if abs(x-p)<epsilon do return x; end if;    



 end do;  


end proc:


I'm having some issues with this procedure it seems to take a very long time to evaluate. There is also an error in the Histogram I can't seem to fix... Does anybody know why? Any help would be greatly appreciated! Thank you in advance!

Kind regards,

Gambia man

Hi everyone, I'd like to know if it's possible to use the startup code editor as a general editor when writing large programs. It nicely recognizes keywords such as "if" and "proc" and you can indent code using TAB. However I'm not sure whether you can/should use it as a general editor to run code. I've read something about user-profiles related to the startup code but I just don't understand how it works.


Im a chemical engineer student with very little knowledge of Maple and its possibilities (which seem endless). I have very little coding experience, even though i do write in LaTeX (which i suppose is referred to as pseudo-code). 

I figured, that as a student, i often run into the same number x problems, that each can be solved in x different ways. Since Maple is so good with units and calculations, aswell as defining variables. I could make some very smart notes, which would allow me to solve different (mostly simple) problems in a very easy and fast manner. 

Now, since i dont know much about Maple, i want to seek som help. 

How do i proceed to make such a document / multiple documents for my purpose? My first idea was to simply create a bunch of different variables defined to a given input, and then simply change the variables as i get a new problem. But i figured that there must be smarter and more neet ways to make this. 

Let me know what you think. 


Sincerely, Mikkel.


i was stuck with some simple problem. I tried using if condition in program that involves a truth condition. If maple cannot determine the condition is true or false i want to assign o to a particular varable. I  show a similar program.



h[1] := -1;

for i from 1 by 1 while(i<150 and h[i]<0) do

p1[i] := .989347189582843*x^2-0.139423979061219e-1*x-1.82559474469870*10^8*x^15+1.30761381361453*10^8*x^16-6.88520063191821*10^7*x^17+2.51079317463498*10^7*x^18-5.66094206949155*10^6*x^19+5.94129446612678*10^5*x^20-6812.74182685426*x^5+59230.0931084044*x^6-3.83520584559500*10^5*x^7+1.90126822307036*10^6*x^8-7.34991883857609*10^6*x^9+2.24203561757434*10^7*x^10-5.43284775909785*10^7*x^11+1.04806113793011*10^8*x^12-1.60600324339222*10^8*x^13+1.94090536353833*10^8*x^14+559.557918804679*x^4-30.6576714427729*x^3-3.93727537464007*10^(-15)-i^2-i; fsolve(p1[i]-0.312e-1, x, -1 .. 1);

if fsolve(p1[i]-0.312e-1, x, -.2 .. 0) < 0 then h[i+1] := fsolve(p1[i]-0.312e-1, x, -.2 .. 0) elif FAIL then h[i+1] := 0 end if;

print(i, h[i])

end do;

i got an error message

Error, cannot determine if this expression is true or false: () < 0

how can i get a value of 0 for h[i] if the error comes.





Can i make a system of equations like this in maple?


What i am trying to do is i want to get all system of equations. For example when n=2, then we should get 8 equations like D(1,1,1), D(1,1,2),D(1,2,1),D(1,2,2),D(2,1,1),D(2,1,2),D(2,2,1) and D(2,2,2). If n=3 then the number of equations is 27 and so on. Can someone please advice me on this?



Maple’s Code Generation makes it possible to translate your Maple code to various other programming languages including C, Python, and several others. In Maple 2015, we added a new Code Generation target to one of my other personal favourite languages, R. R is a programming language designed for statistical computing and graphics, so no code translation from Maple to R would be complete without attempting to translate as many commands as possible from Maple’s Statistics package. 

Translating code from one language to another is tricky business. Maple 2015 represented the first time that any Code Generation target language added the ability to translate commands from the Statistics package. With R, we found that many common statistics commands had almost a one-to-one mapping, such as Statistics:-Mean = mean, but several others were much more complicated, including several commands for dealing with probability functions that did not have direct mappings due to differences in how the systems handle symbolic probability functions.

A list of statistics commands that can be translated from Maple to R can be found here.

In addition to assisting me recall the correct syntax in R, having worked with CodeGeneration[R] for several months now, I find that one of my most common uses for Maple’s code generation to R is simply to pass data between the systems. A simple example:

 CodeGeneration:-R( LinearAlgebra:-RandomMatrix( 5, 2 ) );

translates to the following in R:

 cg <- matrix(c(-4,27,8,69,99,29,44,92,-31,67),nrow=5,ncol=2)

To see a couple more short examples, here’s a short video that I recorded on Code Generation to R:


A little known fact about Code Generation is that the translation files can be viewed in from the “samples” directory in your Maple install directory. Similar to many of Maple’s packages, you can view all of the source code that Code Generation uses for its translations. For example, you can view the translations for the commands that I mentioned above from the “” file inside of your “%MapleInstallDir%/ samples/CodeGeneration/R” directory.

Should you have any feedback on this translation, or any other, please feel free to contact us. We’re also on the hunt for our next code generation targets, so let us know what other languages you would like to see added as Code Generation targets.

I have a large program and when i add a line, i obtain as result [La longueur de sortie dépasse la limite de 1% noeuds]. pLease, can someone help me to continue my program.

Thanks in advance.

I have an expression of derrivative, lets say (D[2, 2](G))(x, y).

How to get this numbers - [2,2] programmicaly from it?

i was to design a GUI using embedded components, i started as shown in the screenshot i uploaded but i had alittle problem trying to code the `evaluate at params` bottton i wanted the botton to return the evaluation of the mathematical expression at the value of the various parameters [delta,gamma,alpha,G,C] into the mathcontainer infront of it i.e evaluating at these points which can be change as new vualues are type in the textfeilds. such as

this is the code i used and it poping out an error message

use DocumentTools in

local f,q,delta,gamma,alpha,G,C;



end module;
pls i need some one to correct me

hi, I want calculate lambda(lagrange multiplier) for lane emden type equation, I have made a programme for it but here is error at the end of programme,plz help

Hi dear friends

How do I improve my ability to manipulate code?





Digits := 30: m := 20: p0 := 8.: g := -0.3: nu := 0.3: a := 1:

w := sum(b[n]*r^(1.02*n), n = 1 .. m):

ODE := r^3*(g*r+a)^3*(diff(w, r, r, r, r))+2*(diff(w, r, r, r))*r^2*(4*g*r+a)*(g*r+a)^2+(diff(w, r, r))*r*(3*g^3*nu*r^3+P*a^3*r^2+6*a*g^2*nu*r^2+11*g^3*r^3+3*a^2*g*nu*r+15*a*g^2*r^2+3*a^2*g*r-a^3)+(diff(w, r))*(6*g^3*nu*r^3+P*a^3*r^2+6*a*g^2*nu*r^2-2*g^3*r^3-3*a*g^2*r^2+a^3):

for P from p0 by 0.1e-1 to p0+1 do
W := simplify(subs(solve({seq(evalf(subs(r = j/(m+2), ODE)), j = 2 .. m-1), subs(r = 1, diff(w, r))}, {seq(b[j], j = 1 .. m)}), w/b[m])):
F := (int(((diff(W, `$`(r, 2))+(diff(W, r))/r)^2-(2*(1-nu))*(diff(W, `$`(r, 2)))*(diff(W, r))/r)*r*(1+g*r/a)^3, r = 0 .. a))/(int((diff(W, r))^2*r, r = 0 .. a)):
delta[trunc(100*(P-p0))] := abs(F-P) end do:

plot(W, r = 0 .. a);

Min := min(seq(delta[j], j = 0 .. 100)):

for j from 0 to 100 do if delta[j] = Min then print(p0+j/(100.)) else  end if end do;

To begin with my code is:




for i from 1 by 1 to 100 do


end do


for i from 1 by 1 to 100 do


  from j from 1 by 1 to 1000 do


  end do

end do


My goal is to produce as an output in the software's screen the values of 1000 bootstrap means for each of 100 original samples in order to export the results to Excel. Based on my basic knowledge of programming I thought that I can do that through the use of the vectors. Unfortunately though when I trigger the operation the software seems to be evaluating (with the homonymous indication in the bottom left corner of the screen) it for an indefinite period of time, obliging me to stop it at some point. However, let me point out that when I do the same process for i and j 4 and 10 for example then I have results, therefore presumably my code is correct. I know that I can do the same operation in Excel and I have already created a respective macro, however I wanted to use Maple in order to take advantage of its fast operation of calculations, which is pointless in case that I have to wait more time for the results than I have already waited to be eventually produced.

Any thought and idea would be appreciated, thank you very much in advance!

Hi everybody:

I'm going to learn programming with maple 18, are there any good and new pdf files for learn it?

with regards...


1 2 3 4 5 6 7 Page 1 of 8