Items tagged with programming programming Tagged Items Feed


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...


Hello Forum:

In the Programming Guide, section 14.3 (Programming Guide: Advanced Connectivity), the subsection `Runtime Environment Prerequisites' a sample script is given in order to set up the environment varibales MAPLE and LD_LIBRARY_PATH:


export MAPLE="/usr/local/maple"
. $MAPLE/bin/maple -norun
myapp $*


For testing, `my app $*' can be replaced by `printenv': it seems not to work with Maple 2015.

Any hint ?

Thanks in advance,





  Suppose I have a file,, which includes a subroutine



  local res;

  return res;

end proc:


   Now I am writing another file, I would like to load the subroutine, aver, in How shall I write in to use that subroutine in


Thank you very much

Hello. I have a question. If you can help me, i am pleasure.

Have nice day. :)


soru := proc(n,x)
local top::0;
for x from 2 to n do
top =top+(((x^(2+i))*top)^(1/(n+2-i)));
end proc;



Error, (in soru) illegal use of a formal parameter

Hi all,
can you help in that please?
How can I use this small procedure (root_of_cheb) as a sub-procedure in  the next procedure (EvalInt) ?
is it possible?

   local xk,b,k:
   local xk:

Thank you

Dear all,

I have a question regarding the computation speed of Maple. I'm doing some numerical work with Maple and when I'm not using the build in Maple routines, but write my one routines to solve e.g. a system of partial differential equations using a finite differencing method, it takes Maple sometimes up to two hours to finish the computation. I also noticed that Maple is only using around 30% of my CPU. I know it's more efficient to do numerical work with C++ or other programming languages (at least that's what most people I know are using) but do any of you know some ways to improve the computation speed of Maple or to make it use more of my CPU to do the calculations faster?

1 2 3 4 5 6 7 Page 1 of 8