30 Reputation

2 Badges

10 years, 196 days

MaplePrimes Activity

These are questions asked by charlesforgy

I am working on a problem that involves a great deal of combinatorics, and I have broken the problem into several procedures.  I am trying to create a first procedure that creates a list output, a second procedure which takes the list and other input and cycles over combinations of two elements from the list and calls a third procedure to perform the calculus needed for each pair.  A simplified example follows:

f1:=proc(a1, a2, ..., an)
(various if-then statements)

return [b1, b2,...,bn];



f2:=proc(alpha, beta,...,L::list)

for i from 1 to n-1 do
     for j from i+1 to n do
     A:= A+ f2(alpha, beta, ..., L[i], L[j])
     end do;
end do;

return A;



f3:=proc(alpha, beta, ..., bi, bj)

(various mathematical manipulations)
return x;



When I first use f1 to get [b1, b2, ..., bn] and then invoke f2 as f2(alpha, beta, ..., [b1, b2, ..., bn]) everything works fine.

However, f1 needs to be invoked by yet a larger function as follows:

L0:=f1(a1, a2, ..., an):
B:=f2(alpha, beta,...,L0):

When I do this, L0 still gets assigned the correct value according the program trace, yet it fails to invoke f3 correctly.  What could the problem be?

I have a series of formulae arranged as a vector.  I need to do two things to this vector:

(1) Optimize it using 'tryhard'.  

(2) Use the optimized results to create a new procedure.


I can do either (1) or (2) alone, but when I try to combine them as one command it never works.  A simplified example of what I'm attempting with the resulting error message is below:

with(codegen, optimize, makeproc);
V := Vector(4);
V[1] := x+y;
V[2] := x^2+y^2;
V[3] := x^3+y^3;
V[4] := x^2+y^2+x+y;

T := makeproc([optimize(V, 'tryhard')], [x, y]);

Error, (in codegen/makeproc) Unrecognized input [t78 = x+y, t73 = y^2, t74 = x^2, t77 = t73+t74, t1 = (Vector(4, {(1) = t78, (2) = t77, (3) = t73*y+t74*x, (4) = t77+t78}))]

It seems that makeproc cannot handle a combination of optimized assignments and a vector of formulae.  Is there anyway to fix this?



I got the following error message when trying to execute a maple code:


"invalid character in short integer encoding 69 E"


I can't find anything about it in the maple documentation, does anyone have any idea what it means?


Page 1 of 1