Items tagged with procedure procedure Tagged Items Feed

In the below file, I have tried to create tree using Graphtheory and export it to file. But exporting works only if I read the procedure twice and that too after running the procedure.


Another easy question from a newbie:

Say I have a procedure which, along the its execution, needs to pass a parameter to a different procedure (which, in this case, would be a subroutine) to be elaborated and returned to go on.

This process may happen a few times during the execution and the passing parameter, which may have the same name but different value, needs to be worked on by the subrooutine.

My question is: how do I invoke a procedure from a parent procedure passing one or more parameters and have them returned?

Thank you

Every time I try to write a procedure I get stuck.

This time is no different:


global a:=0.081819221, PI:=3.1415926535897932384626433832795;
return d;
end proc;

I digit the following to get a result

and this is what I get (in blue)

Every single time. I can never have a procedure that works right away. It's getting on my nerves

Hi everyone! Please help me..

I want to do the procedure for the FirstReturn of a map. I think my procedure is not correct.
I want to write a procedure 
FirstReturn:=proc(F,x,p,q) where F is any map (function), x is the integer and the starting point, and p&q is the integer that form an interval [p,q].
If i start from the point x in [p,q], then after some iterations, there is Ft(x) in the interval [p,q].
I am interested with the the value of Ft(x) and the iteration, t when it comes back to the interval [p,q]  to be the output of the procedure.
What i did is shown below. But I dont have any idea to make it work!

Please help. Really appreciate your help.. 

FirstReturn := proc (F, x, p, q)
local t, z;
if p <= x and x <= q then F(x) := x end if;
for t while x < p and q < x or t = 1 do
x := z;
if p <= z and z <= q then
end if;
end do;
return (z, t);
end proc;

I am not sure how/why, but here is the worksheet.


The function evalutes fine and can be used for sequence. But it does not seem to be working with plot or Maximize.

V is assumed to between 0 and 1.

Need some help.





Hello, could someone please help me to understand this warning that i'm getting?

Warning, `N4ds` is implicitly declared local to procedure `SFunc`



I have a procedure wich is something like 


F:=proc(a,b,l) limit(f(a,b),b=l); end proc;

For my specific problem, the limit always exists and is a well defined function

After that, I would like to generate other functions, depending on F(a,b,l), e.g.:


G:=proc(a,b,N) add(F(a,b,l),l=1..N); end proc;


However, when I tried to do that, Maple inserts in G an unevaluated F, depending on the results of the limits. This makes G not work properly (unevaluated), since the limit is not computed before G. I tried to use some intermediate steps, like using unapply command, but it does not works.

If someone can help, I would appreciate.



I want to test linearly dependence of a polynomial f on a list of polynomials F by additional condition on parametric coefficients of linear parametric polynomial (linear for variables not parameters). Please note that:

  1. The polynomialand the members of are always homogenous in the variables.
  2. The coefficients of f, the coefficients of the members of F are all always polynomials in the parameters or contant and the members of N and W are all always polynomials in the parameters.


For example let


(a,b,c,d,e,h are parameters and A1,A2,A3 are variables).

If I use PolyLinearCombo(F,f,{A1,A2,A3}) (see its output is false,[].

Now we let to condition sets for parameters as the following:



The elements of N must be zero means that ebc+ahd=0

and the elements of W are non-zero that is a<>0 and c <>0.

Let a=b=c=d=h=1 and e=-1. This specialization satisfy in the above condition sets N and W. By this specialization we have:


Now if I use PolyLinearCombo(F,f,{A1,A2,A3}) then its output is true,[-1,1].

By this additional two condition sets I have to check that whether f is linearly independent of F or not. How can I do this without specialization? In fact I want an algorithm that its input is (null condition N, not-null condition W, list of polynomials F, a polynomial f, the set of variables) and its output is true and coefficients if f is linearly dependent of F w.r.t. null and not-null conditions N and W, else its output is false.

If the name of new procedure is ExtPolyLinearCombo and 



I want the output of

ExtPolyLinearCombo(N,W,F,f,{A1,A2,A3}) be true,[coefficients]

Thank you very much in advance.



The following toy procedure does not work (I give a value to a symbol). How to make it work ? Thanks.

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

$15 is spread among four different bags. How  can you can make any whole number of dollars from $1 to $15 by selecting some of these bags of money, without taking any money out of the bags.
How is the money distributed ?

One bag must have $1 in it.
To be able to make $2, and each bag is different, so one bag must have $2 in it.
 can now make $3, but can’t make $4, so the third bag must have $4 in it.
With $1, $2 and $4 in three bags, can make every total up to $7. The last bag has the rest of his money in it – $8.

so the answer is $[1,2,4,8]

wondering how to do this with maple procedure. unsurprisingly my code doesn't work



Could someone help me understand what is happening to this procedure. When I run it, I get the subject error. Thanks.

game := proc()
  local player1, player2, roll;
  roll := rand( 1..6 );
  player1 := roll():
  player2 := roll(2):
  if player1>player2 then "A wins"
  elif player1=player2 then "Tie"
  else "B wins"
  end if;
end proc:

Dear all,

I have one probem in using Maple in comparison with Matlab.

Generally, when using Matlab, I write a long program with 500 lines (for example) and where I use some matricial calculations and other. When I want to repeat this program for some parameters (variables) many times, I transform the program to a procedure "Function" with just adding the command Function in the start of the program.

When using Maple, I have a difficulty to transform a long program which I want to repeat for some variables to a procedure "proc". The program uses packages like LinearAlgebra and other procedures.

Is there a simple way to transform a long Maple program to a procedure which should be repeated many times for some variables in Maple. 

I have especially problems with the commands local, global, use (for packages), etc.. and the warning related to the variables. It is not easy for a long program with many variables to write them in local or global variables.

Thank you.

Hi Maple People,

I got stuck trying to write a procedue for my project today.  My topic is Prime Constellations.

If you want to help me, please read my primer on constellations

The procedure should refine an offset Vector and increase a multiplier scalar.


I want to delay putting the broken procedure until I can simplify it and try again.


Matt Anderson

Write a recursive Maple procedure, called “decToBin”, that converts an integer from decimal (base 10) to binary (base 2). Ensure that only integers are allowed as arguments to the procedure. Passing a negative integer should result in no output. Test your procedure by outputting the result of the following:
decToBin(“A”) # should result in an “invalid input” error

1 2 3 4 5 6 7 Last Page 1 of 18